Changeset 290647 in webkit for trunk/Source/JavaScriptCore/jit/SlowPathCall.cpp
- Timestamp:
- Mar 1, 2022, 7:42:50 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/SlowPathCall.cpp
r277974 r290647 37 37 namespace JSC { 38 38 39 #if ENABLE(EXTRA_CTI_THUNKS) 39 namespace { 40 constexpr GPRReg bytecodeOffsetGPR = JIT::argumentGPR3; 41 } 40 42 41 43 void JITSlowPathCall::call() … … 45 47 ASSERT(BytecodeIndex(bytecodeOffset) == m_jit->m_bytecodeIndex); 46 48 47 UNUSED_VARIABLE(m_pc); 48 constexpr GPRReg bytecodeOffsetReg = GPRInfo::argumentGPR1; 49 m_jit->move(JIT::TrustedImm32(bytecodeOffset), bytecodeOffsetReg); 49 m_jit->move(JIT::TrustedImm32(bytecodeOffset), bytecodeOffsetGPR); 50 50 m_jit->emitNakedNearCall(vm.jitStubs->ctiSlowPathFunctionStub(vm, m_slowPathFunction).retaggedCode<NoPtrTag>()); 51 51 } … … 55 55 CCallHelpers jit; 56 56 57 constexpr GPRReg bytecodeOffsetReg = JIT::argumentGPR1;57 jit.emitCTIThunkPrologue(); 58 58 59 #if CPU(X86_64) 60 jit.push(X86Registers::ebp); 61 #elif CPU(ARM64) 62 jit.tagReturnAddress(); 63 jit.pushPair(CCallHelpers::framePointerRegister, CCallHelpers::linkRegister); 59 // Call slow operation 60 jit.store32(bytecodeOffsetGPR, CCallHelpers::tagFor(CallFrameSlot::argumentCountIncludingThis)); 61 jit.prepareCallOperation(vm); 62 63 #if OS(WINDOWS) && CPU(X86_64) 64 // On Windows, return values larger than 8 bytes are retuened via an implicit pointer passed as 65 // the first argument, and remaining arguments are shifted to the right. Make space for this. 66 static_assert(sizeof(SlowPathReturnType) == 16, "Assumed by generated call site below"); 67 jit.subPtr(MacroAssembler::TrustedImm32(16), MacroAssembler::stackPointerRegister); 68 jit.move(MacroAssembler::stackPointerRegister, GPRInfo::argumentGPR0); 69 constexpr GPRReg callFrameArgGPR = GPRInfo::argumentGPR1; 70 constexpr GPRReg pcArgGPR = GPRInfo::argumentGPR2; 71 static_assert(noOverlap(GPRInfo::argumentGPR0, callFrameArgGPR, pcArgGPR, bytecodeOffsetGPR)); 72 #else 73 constexpr GPRReg callFrameArgGPR = GPRInfo::argumentGPR0; 74 constexpr GPRReg pcArgGPR = GPRInfo::argumentGPR1; 75 static_assert(noOverlap(callFrameArgGPR, pcArgGPR, bytecodeOffsetGPR)); 76 #endif 77 jit.move(GPRInfo::callFrameRegister, callFrameArgGPR); 78 jit.loadPtr(CCallHelpers::addressFor(CallFrameSlot::codeBlock), pcArgGPR); 79 jit.loadPtr(CCallHelpers::Address(pcArgGPR, CodeBlock::offsetOfInstructionsRawPointer()), pcArgGPR); 80 jit.addPtr(bytecodeOffsetGPR, pcArgGPR); 81 82 CCallHelpers::Call call = jit.call(OperationPtrTag); 83 84 #if OS(WINDOWS) && CPU(X86_64) 85 jit.pop(GPRInfo::returnValueGPR); // pc 86 jit.pop(GPRInfo::returnValueGPR2); // callFrame 64 87 #endif 65 88 66 jit. store32(bytecodeOffsetReg, CCallHelpers::tagFor(CallFrameSlot::argumentCountIncludingThis));89 jit.emitCTIThunkEpilogue(); 67 90 68 jit.loadPtr(CCallHelpers::addressFor(CallFrameSlot::codeBlock), GPRInfo::argumentGPR0); 69 70 jit.prepareCallOperation(vm); 71 72 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, CodeBlock::offsetOfInstructionsRawPointer()), GPRInfo::argumentGPR0); 73 static_assert(JIT::argumentGPR1 == bytecodeOffsetReg); 74 jit.addPtr(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1); 75 jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 76 77 CCallHelpers::Call call = jit.call(OperationPtrTag); 78 CCallHelpers::Jump exceptionCheck = jit.emitNonPatchableExceptionCheck(vm); 79 80 #if CPU(X86_64) 81 jit.pop(X86Registers::ebp); 82 #elif CPU(ARM64) 83 jit.popPair(CCallHelpers::framePointerRegister, CCallHelpers::linkRegister); 84 #endif 85 jit.ret(); 86 87 auto handler = vm.getCTIStub(popThunkStackPreservesAndHandleExceptionGenerator); 91 // Tail call to exception check thunk 92 CCallHelpers::Jump exceptionCheck = jit.jump(); 88 93 89 94 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 90 95 patchBuffer.link(call, FunctionPtr<OperationPtrTag>(slowPathFunction)); 91 patchBuffer.link(exceptionCheck, CodeLocationLabel( handler.retaggedCode<NoPtrTag>()));96 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 92 97 return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "SlowPathCall"); 93 98 } 94 95 #endif // ENABLE(EXTRA_CTI_THUNKS)96 99 97 100 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.