Commit 831342d8 authored by barraclough@apple.com's avatar barraclough@apple.com

Move jit compilation from linking thunks into cti_vm_lazyLink methods.

Reviewed by Geoff Garen.

* jit/JITOpcodes.cpp:
(JSC::JIT::privateCompileCTIMachineTrampolines):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileCTIMachineTrampolines):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent cfc1e9fd
2010-05-28 Gavin Barraclough <barraclough@apple.com>
Reviewed by Geoff Garen.
Move jit compilation from linking thunks into cti_vm_lazyLink methods.
* jit/JITOpcodes.cpp:
(JSC::JIT::privateCompileCTIMachineTrampolines):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileCTIMachineTrampolines):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
2010-05-28 Gavin Barraclough <barraclough@apple.com>
Reviewed by Sam Weinig.
......
......@@ -75,46 +75,24 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
Label virtualCallLinkBegin = align();
compileOpCallInitializeCallFrame();
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
Jump hasCodeBlock1 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForCall)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction1 = call();
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
restoreReturnAddressBeforeReturn(regT3);
hasCodeBlock1.link(this);
preserveReturnAddressAfterCall(regT3);
emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
restoreArgumentReference();
Call callLazyLinkCall1 = call();
Call callLazyLinkCall = call();
restoreReturnAddressBeforeReturn(regT3);
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
jump(regT0);
// VirtualConstructLink Trampoline
// regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
Label virtualConstructLinkBegin = align();
compileOpCallInitializeCallFrame();
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
Jump hasCodeBlock2 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForConstruct)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction2 = call();
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
restoreReturnAddressBeforeReturn(regT3);
hasCodeBlock2.link(this);
preserveReturnAddressAfterCall(regT3);
emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
restoreArgumentReference();
Call callLazyLinkCall2 = call();
Call callLazyLinkConstruct = call();
restoreReturnAddressBeforeReturn(regT3);
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
jump(regT0);
// VirtualCall Trampoline
......@@ -127,7 +105,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
Jump hasCodeBlock3 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForCall)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction3 = call();
Call callCompileCall = call();
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
restoreReturnAddressBeforeReturn(regT3);
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
......@@ -146,7 +124,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
Jump hasCodeBlock4 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForConstruct)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction4 = call();
Call callCompileConstruct = call();
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
restoreReturnAddressBeforeReturn(regT3);
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
......@@ -174,13 +152,11 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
patchBuffer.link(string_failureCases3Call, FunctionPtr(cti_op_get_by_id_string_fail));
#endif
#if ENABLE(JIT_OPTIMIZE_CALL)
patchBuffer.link(callJSFunction1, FunctionPtr(cti_op_call_jitCompile));
patchBuffer.link(callLazyLinkCall1, FunctionPtr(cti_vm_lazyLinkCall));
patchBuffer.link(callJSFunction2, FunctionPtr(cti_op_construct_jitCompile));
patchBuffer.link(callLazyLinkCall2, FunctionPtr(cti_vm_lazyLinkConstruct));
patchBuffer.link(callLazyLinkCall, FunctionPtr(cti_vm_lazyLinkCall));
patchBuffer.link(callLazyLinkConstruct, FunctionPtr(cti_vm_lazyLinkConstruct));
#endif
patchBuffer.link(callJSFunction3, FunctionPtr(cti_op_call_jitCompile));
patchBuffer.link(callJSFunction4, FunctionPtr(cti_op_construct_jitCompile));
patchBuffer.link(callCompileCall, FunctionPtr(cti_op_call_jitCompile));
patchBuffer.link(callCompileConstruct, FunctionPtr(cti_op_construct_jitCompile));
CodeRef finalCode = patchBuffer.finalizeCode();
*executablePool = finalCode.m_executablePool;
......
......@@ -72,22 +72,10 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
Label virtualCallLinkBegin = align();
compileOpCallInitializeCallFrame();
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
Jump hasCodeBlock1 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForCall)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction1 = call();
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
restoreReturnAddressBeforeReturn(regT3);
hasCodeBlock1.link(this);
preserveReturnAddressAfterCall(regT3);
emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
restoreArgumentReference();
Call callLazyLinkCall1 = call();
Call callLazyLinkCall = call();
restoreReturnAddressBeforeReturn(regT3);
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
jump(regT0);
......@@ -96,22 +84,10 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
Label virtualConstructLinkBegin = align();
compileOpCallInitializeCallFrame();
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
Jump hasCodeBlock2 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForConstruct)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction2 = call();
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
restoreReturnAddressBeforeReturn(regT3);
hasCodeBlock2.link(this);
preserveReturnAddressAfterCall(regT3);
emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
restoreArgumentReference();
Call callLazyLinkCall2 = call();
Call callLazyLinkConstruct = call();
restoreReturnAddressBeforeReturn(regT3);
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
jump(regT0);
......@@ -127,7 +103,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
Jump hasCodeBlock3 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForCall)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction3 = call();
Call callCompileCall = call();
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
restoreReturnAddressBeforeReturn(regT3);
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
......@@ -146,7 +122,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
Jump hasCodeBlock4 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForConstruct)), Imm32(0));
preserveReturnAddressAfterCall(regT3);
restoreArgumentReference();
Call callJSFunction4 = call();
Call callCompileCconstruct = call();
emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
restoreReturnAddressBeforeReturn(regT3);
loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
......@@ -174,13 +150,11 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
patchBuffer.link(string_failureCases3Call, FunctionPtr(cti_op_get_by_id_string_fail));
#endif
#if ENABLE(JIT_OPTIMIZE_CALL)
patchBuffer.link(callJSFunction1, FunctionPtr(cti_op_call_jitCompile));
patchBuffer.link(callLazyLinkCall1, FunctionPtr(cti_vm_lazyLinkCall));
patchBuffer.link(callJSFunction2, FunctionPtr(cti_op_construct_jitCompile));
patchBuffer.link(callLazyLinkCall2, FunctionPtr(cti_vm_lazyLinkConstruct));
patchBuffer.link(callLazyLinkCall, FunctionPtr(cti_vm_lazyLinkCall));
patchBuffer.link(callLazyLinkConstruct, FunctionPtr(cti_vm_lazyLinkConstruct));
#endif
patchBuffer.link(callJSFunction3, FunctionPtr(cti_op_call_jitCompile));
patchBuffer.link(callJSFunction4, FunctionPtr(cti_op_construct_jitCompile));
patchBuffer.link(callCompileCall, FunctionPtr(cti_op_call_jitCompile));
patchBuffer.link(callCompileCconstruct, FunctionPtr(cti_op_construct_jitCompile));
CodeRef finalCode = patchBuffer.finalizeCode();
*executablePool = finalCode.m_executablePool;
......
......@@ -1966,11 +1966,13 @@ DEFINE_STUB_FUNCTION(void*, vm_lazyLinkCall)
if (executable->isHostFunction())
codePtr = executable->generatedJITCodeForCall().addressForCall();
else {
codeBlock = &static_cast<FunctionExecutable*>(executable)->bytecodeForCall(stackFrame.callFrame, callee->scope().node());
FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
codeBlock = &functionExecutable->bytecodeForCall(stackFrame.callFrame, callee->scope().node());
functionExecutable->jitCodeForCall(callFrame, callee->scope().node());
if (callFrame->argumentCount() == codeBlock->m_numParameters)
codePtr = static_cast<FunctionExecutable*>(executable)->generatedJITCodeForCall().addressForCall();
codePtr = functionExecutable->generatedJITCodeForCall().addressForCall();
else
codePtr = static_cast<FunctionExecutable*>(executable)->generatedJITCodeForCallWithArityCheck();
codePtr = functionExecutable->generatedJITCodeForCallWithArityCheck();
}
CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(callFrame->returnPC());
......@@ -1994,11 +1996,13 @@ DEFINE_STUB_FUNCTION(void*, vm_lazyLinkConstruct)
if (executable->isHostFunction())
codePtr = executable->generatedJITCodeForConstruct().addressForCall();
else {
codeBlock = &static_cast<FunctionExecutable*>(executable)->bytecodeForConstruct(stackFrame.callFrame, callee->scope().node());
FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
codeBlock = &functionExecutable->bytecodeForConstruct(stackFrame.callFrame, callee->scope().node());
functionExecutable->jitCodeForConstruct(callFrame, callee->scope().node());
if (callFrame->argumentCount() == codeBlock->m_numParameters)
codePtr = static_cast<FunctionExecutable*>(executable)->generatedJITCodeForConstruct().addressForCall();
codePtr = functionExecutable->generatedJITCodeForConstruct().addressForCall();
else
codePtr = static_cast<FunctionExecutable*>(executable)->generatedJITCodeForConstructWithArityCheck();
codePtr = functionExecutable->generatedJITCodeForConstructWithArityCheck();
}
CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(callFrame->returnPC());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment