|
Lines 28-33
Source/JavaScriptCore/ftl/FTLLink.cpp_sec1
|
| 28 |
|
28 |
|
| 29 |
#if ENABLE(FTL_JIT) |
29 |
#if ENABLE(FTL_JIT) |
| 30 |
|
30 |
|
|
|
31 |
#include "ArityCheckFailReturnThunks.h" |
| 31 |
#include "CCallHelpers.h" |
32 |
#include "CCallHelpers.h" |
| 32 |
#include "CallFrameInlines.h" |
33 |
#include "CallFrameInlines.h" |
| 33 |
#include "CodeBlockWithJITType.h" |
34 |
#include "CodeBlockWithJITType.h" |
|
Lines 46-51
using namespace DFG;
Source/JavaScriptCore/ftl/FTLLink.cpp_sec2
|
| 46 |
void link(State& state) |
47 |
void link(State& state) |
| 47 |
{ |
48 |
{ |
| 48 |
CodeBlock* codeBlock = state.graph.m_codeBlock; |
49 |
CodeBlock* codeBlock = state.graph.m_codeBlock; |
|
|
50 |
VM& vm = state.graph.m_vm; |
| 49 |
|
51 |
|
| 50 |
// LLVM will create its own jump tables as needed. |
52 |
// LLVM will create its own jump tables as needed. |
| 51 |
codeBlock->clearSwitchJumpTables(); |
53 |
codeBlock->clearSwitchJumpTables(); |
|
Lines 61-67
void link(State& state)
Source/JavaScriptCore/ftl/FTLLink.cpp_sec3
|
| 61 |
|
63 |
|
| 62 |
// Create the entrypoint. Note that we use this entrypoint totally differently |
64 |
// Create the entrypoint. Note that we use this entrypoint totally differently |
| 63 |
// depending on whether we're doing OSR entry or not. |
65 |
// depending on whether we're doing OSR entry or not. |
| 64 |
CCallHelpers jit(&state.graph.m_vm, codeBlock); |
66 |
CCallHelpers jit(&vm, codeBlock); |
| 65 |
|
67 |
|
| 66 |
OwnPtr<LinkBuffer> linkBuffer; |
68 |
OwnPtr<LinkBuffer> linkBuffer; |
| 67 |
CCallHelpers::Label arityCheck; |
69 |
CCallHelpers::Label arityCheck; |
|
Lines 84-110
void link(State& state)
Source/JavaScriptCore/ftl/FTLLink.cpp_sec4
|
| 84 |
jit.store32( |
86 |
jit.store32( |
| 85 |
CCallHelpers::TrustedImm32(CallFrame::Location::encodeAsBytecodeOffset(0)), |
87 |
CCallHelpers::TrustedImm32(CallFrame::Location::encodeAsBytecodeOffset(0)), |
| 86 |
CCallHelpers::tagFor(JSStack::ArgumentCount)); |
88 |
CCallHelpers::tagFor(JSStack::ArgumentCount)); |
| 87 |
jit.storePtr(GPRInfo::callFrameRegister, &state.graph.m_vm.topCallFrame); |
89 |
jit.storePtr(GPRInfo::callFrameRegister, &vm.topCallFrame); |
| 88 |
CCallHelpers::Call callArityCheck = jit.call(); |
90 |
CCallHelpers::Call callArityCheck = jit.call(); |
| 89 |
#if !ASSERT_DISABLED |
91 |
#if !ASSERT_DISABLED |
| 90 |
// FIXME: need to make this call register with exception handling somehow. This is |
92 |
// FIXME: need to make this call register with exception handling somehow. This is |
| 91 |
// part of a bigger problem: FTL should be able to handle exceptions. |
93 |
// part of a bigger problem: FTL should be able to handle exceptions. |
| 92 |
// https://bugs.webkit.org/show_bug.cgi?id=113622 |
94 |
// https://bugs.webkit.org/show_bug.cgi?id=113622 |
| 93 |
// Until then, use a JIT ASSERT. |
95 |
// Until then, use a JIT ASSERT. |
| 94 |
jit.load64(state.graph.m_vm.addressOfException(), GPRInfo::regT1); |
96 |
jit.load64(vm.addressOfException(), GPRInfo::regT1); |
| 95 |
jit.jitAssertIsNull(GPRInfo::regT1); |
97 |
jit.jitAssertIsNull(GPRInfo::regT1); |
| 96 |
#endif |
98 |
#endif |
| 97 |
jit.move(GPRInfo::returnValueGPR, GPRInfo::regT0); |
99 |
jit.move(GPRInfo::returnValueGPR, GPRInfo::regT0); |
| 98 |
jit.emitFunctionEpilogue(); |
100 |
jit.emitFunctionEpilogue(); |
| 99 |
mainPathJumps.append(jit.branchTest32(CCallHelpers::Zero, GPRInfo::regT0)); |
101 |
mainPathJumps.append(jit.branchTest32(CCallHelpers::Zero, GPRInfo::regT0)); |
| 100 |
jit.emitFunctionPrologue(); |
102 |
jit.emitFunctionPrologue(); |
|
|
103 |
jit.move(CCallHelpers::TrustedImmPtr(vm.arityCheckFailReturnThunks->returnPCsFor(vm, codeBlock->numParameters())), GPRInfo::regT5); |
| 104 |
jit.loadPtr(CCallHelpers::BaseIndex(GPRInfo::regT5, GPRInfo::regT0, CCallHelpers::timesPtr()), GPRInfo::regT5); |
| 101 |
CCallHelpers::Call callArityFixup = jit.call(); |
105 |
CCallHelpers::Call callArityFixup = jit.call(); |
| 102 |
jit.emitFunctionEpilogue(); |
106 |
jit.emitFunctionEpilogue(); |
| 103 |
mainPathJumps.append(jit.jump()); |
107 |
mainPathJumps.append(jit.jump()); |
| 104 |
|
108 |
|
| 105 |
linkBuffer = adoptPtr(new LinkBuffer(state.graph.m_vm, &jit, codeBlock, JITCompilationMustSucceed)); |
109 |
linkBuffer = adoptPtr(new LinkBuffer(vm, &jit, codeBlock, JITCompilationMustSucceed)); |
| 106 |
linkBuffer->link(callArityCheck, codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck); |
110 |
linkBuffer->link(callArityCheck, codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck); |
| 107 |
linkBuffer->link(callArityFixup, FunctionPtr((state.graph.m_vm.getCTIStub(arityFixup)).code().executableAddress())); |
111 |
linkBuffer->link(callArityFixup, FunctionPtr((vm.getCTIStub(arityFixup)).code().executableAddress())); |
| 108 |
linkBuffer->link(mainPathJumps, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction))); |
112 |
linkBuffer->link(mainPathJumps, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction))); |
| 109 |
|
113 |
|
| 110 |
state.jitCode->initializeAddressForCall(MacroAssemblerCodePtr(bitwise_cast<void*>(state.generatedFunction))); |
114 |
state.jitCode->initializeAddressForCall(MacroAssemblerCodePtr(bitwise_cast<void*>(state.generatedFunction))); |
|
Lines 120-127
void link(State& state)
Source/JavaScriptCore/ftl/FTLLink.cpp_sec5
|
| 120 |
jit.emitFunctionEpilogue(); |
124 |
jit.emitFunctionEpilogue(); |
| 121 |
CCallHelpers::Jump mainPathJump = jit.jump(); |
125 |
CCallHelpers::Jump mainPathJump = jit.jump(); |
| 122 |
|
126 |
|
| 123 |
linkBuffer = adoptPtr(new LinkBuffer( |
127 |
linkBuffer = adoptPtr(new LinkBuffer(vm, &jit, codeBlock, JITCompilationMustSucceed)); |
| 124 |
state.graph.m_vm, &jit, codeBlock, JITCompilationMustSucceed)); |
|
|
| 125 |
linkBuffer->link(mainPathJump, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction))); |
128 |
linkBuffer->link(mainPathJump, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction))); |
| 126 |
|
129 |
|
| 127 |
state.jitCode->initializeAddressForCall(linkBuffer->locationOf(start)); |
130 |
state.jitCode->initializeAddressForCall(linkBuffer->locationOf(start)); |