Bug 39898 - Move arity check into callee.
Reviewed by Sam Weinig.
We can reduce the size of the virtual call trampolines by moving the arity check
into the callee functions. As a following step we will be able to remove the
check for native function / codeblocks by performing translation in a lazy stub.
* interpreter/CallFrame.h:
(JSC::ExecState::init):
(JSC::ExecState::setReturnPC):
* jit/JIT.cpp:
(JSC::JIT::privateCompile):
(JSC::JIT::linkCall):
(JSC::JIT::linkConstruct):
* jit/JIT.h:
(JSC::JIT::compile):
* jit/JITOpcodes.cpp:
(JSC::JIT::privateCompileCTIMachineTrampolines):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileCTIMachineTrampolines):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* runtime/Executable.cpp:
(JSC::FunctionExecutable::generateJITCodeForCall):
(JSC::FunctionExecutable::generateJITCodeForConstruct):
(JSC::FunctionExecutable::reparseExceptionInfo):
* runtime/Executable.h:
(JSC::NativeExecutable::NativeExecutable):
(JSC::FunctionExecutable::generatedJITCodeForCallWithArityCheck):
(JSC::FunctionExecutable::generatedJITCodeForConstructWithArityCheck):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/interpreter/CallFrame.h b/JavaScriptCore/interpreter/CallFrame.h
index bde4072..66045e2 100644
--- a/JavaScriptCore/interpreter/CallFrame.h
+++ b/JavaScriptCore/interpreter/CallFrame.h
@@ -125,7 +125,7 @@
setCodeBlock(codeBlock);
setScopeChain(scopeChain);
setCallerFrame(callerFrame);
- static_cast<Register*>(this)[RegisterFile::ReturnPC] = vPC; // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
+ setReturnPC(vPC); // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
setArgumentCount(argc); // original argument count (for the sake of the "arguments" object)
setCallee(function);
}
@@ -142,6 +142,7 @@
void setArgumentCount(int count) { static_cast<Register*>(this)[RegisterFile::ArgumentCount] = Register::withInt(count); }
void setCallee(JSFunction* callee) { static_cast<Register*>(this)[RegisterFile::Callee] = callee; }
void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[RegisterFile::CodeBlock] = codeBlock; }
+ void setReturnPC(void* value) { static_cast<Register*>(this)[RegisterFile::ReturnPC] = (Instruction*)value; }
private:
static const intptr_t HostCallFrameFlag = 1;