diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index ae9ad0652d65..3b5ef9751d59 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -3293,7 +3293,7 @@ ICGetElemNativeCompiler::emitCallScripted(MacroAssembler& masm, Register objR // Push argc, callee, and descriptor. { Register callScratch = regs.takeAny(); - EmitCreateStubFrameDescriptor(masm, callScratch); + EmitBaselineCreateStubFrameDescriptor(masm, callScratch); masm.Push(Imm32(0)); // ActualArgc is 0 masm.Push(callee); masm.Push(callScratch); @@ -7215,7 +7215,7 @@ ICGetProp_CallScripted::Compiler::generateStubCode(MacroAssembler& masm) // Note that we use Push, not push, so that callJit will align the stack // properly on ARM. masm.Push(R0); - EmitCreateStubFrameDescriptor(masm, scratch); + EmitBaselineCreateStubFrameDescriptor(masm, scratch); masm.Push(Imm32(0)); // ActualArgc is 0 masm.Push(callee); masm.Push(scratch); @@ -8747,7 +8747,7 @@ ICSetProp_CallScripted::Compiler::generateStubCode(MacroAssembler& masm) // Stack: [ ..., R0, R1, ..STUBFRAME-HEADER.., padding? ] masm.PushValue(Address(BaselineFrameReg, STUB_FRAME_SIZE)); masm.Push(R0); - EmitCreateStubFrameDescriptor(masm, scratch); + EmitBaselineCreateStubFrameDescriptor(masm, scratch); masm.Push(Imm32(1)); // ActualArgc is 1 masm.Push(callee); masm.Push(scratch); @@ -10171,7 +10171,7 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm) masm.popValue(val); callee = masm.extractObject(val, ExtractTemp0); - EmitCreateStubFrameDescriptor(masm, scratch); + EmitBaselineCreateStubFrameDescriptor(masm, scratch); // Note that we use Push, not push, so that callJit will align the stack // properly on ARM. @@ -10474,7 +10474,7 @@ ICCall_Native::Compiler::generateStubCode(MacroAssembler& masm) masm.push(argcReg); Register scratch = regs.takeAny(); - EmitCreateStubFrameDescriptor(masm, scratch); + EmitBaselineCreateStubFrameDescriptor(masm, scratch); masm.push(scratch); masm.push(ICTailCallReg); masm.enterFakeExitFrame(NativeExitFrameLayout::Token()); @@ -10572,7 +10572,7 @@ ICCall_ClassHook::Compiler::generateStubCode(MacroAssembler& masm) // Construct a native exit frame. masm.push(argcReg); - EmitCreateStubFrameDescriptor(masm, scratch); + EmitBaselineCreateStubFrameDescriptor(masm, scratch); masm.push(scratch); masm.push(ICTailCallReg); masm.enterFakeExitFrame(NativeExitFrameLayout::Token()); @@ -10659,7 +10659,7 @@ ICCall_ScriptedApplyArray::Compiler::generateStubCode(MacroAssembler& masm) // All pushes after this use Push instead of push to make sure ARM can align // stack properly for call. Register scratch = regs.takeAny(); - EmitCreateStubFrameDescriptor(masm, scratch); + EmitBaselineCreateStubFrameDescriptor(masm, scratch); // Reload argc from length of array. masm.extractObject(arrayVal, argcReg); @@ -10760,7 +10760,7 @@ ICCall_ScriptedApplyArguments::Compiler::generateStubCode(MacroAssembler& masm) // All pushes after this use Push instead of push to make sure ARM can align // stack properly for call. Register scratch = regs.takeAny(); - EmitCreateStubFrameDescriptor(masm, scratch); + EmitBaselineCreateStubFrameDescriptor(masm, scratch); masm.loadPtr(Address(BaselineFrameReg, 0), argcReg); masm.loadPtr(Address(argcReg, BaselineFrame::offsetOfNumActualArgs()), argcReg); @@ -10893,7 +10893,7 @@ ICCall_ScriptedFunCall::Compiler::generateStubCode(MacroAssembler& masm) callee = masm.extractObject(val, ExtractTemp0); Register scratch = regs.takeAny(); - EmitCreateStubFrameDescriptor(masm, scratch); + EmitBaselineCreateStubFrameDescriptor(masm, scratch); // Note that we use Push, not push, so that callJit will align the stack // properly on ARM. diff --git a/js/src/jit/SharedIC.cpp b/js/src/jit/SharedIC.cpp index 5539e92f3269..a3f3a85ec1a3 100644 --- a/js/src/jit/SharedIC.cpp +++ b/js/src/jit/SharedIC.cpp @@ -746,7 +746,12 @@ ICStubCompiler::tailCallVM(const VMFunction& fun, MacroAssembler& masm) MOZ_ASSERT(fun.expectTailCall == TailCall); uint32_t argSize = fun.explicitStackSlots() * sizeof(void*); - EmitTailCallVM(code, masm, argSize); + if (engine_ == Engine::Baseline) { + EmitBaselineTailCallVM(code, masm, argSize); + } else { + uint32_t stackSize = argSize + fun.extraValuesToPop * sizeof(Value); + EmitIonTailCallVM(code, masm, stackSize); + } return true; } @@ -760,7 +765,10 @@ ICStubCompiler::callVM(const VMFunction& fun, MacroAssembler& masm) return false; MOZ_ASSERT(fun.expectTailCall == NonTailCall); - EmitCallVM(code, masm); + if (engine_ == Engine::Baseline) + EmitBaselineCallVM(code, masm); + else + EmitIonCallVM(code, fun.explicitStackSlots(), masm); return true; } @@ -778,7 +786,10 @@ ICStubCompiler::callTypeUpdateIC(MacroAssembler& masm, uint32_t objectOffset) void ICStubCompiler::enterStubFrame(MacroAssembler& masm, Register scratch) { - EmitEnterStubFrame(masm, scratch); + if (engine_ == Engine::Baseline) + EmitBaselineEnterStubFrame(masm, scratch); + else + EmitIonEnterStubFrame(masm, scratch); MOZ_ASSERT(!inStubFrame_); inStubFrame_ = true; @@ -793,12 +804,21 @@ ICStubCompiler::leaveStubFrame(MacroAssembler& masm, bool calledIntoIon) { MOZ_ASSERT(entersStubFrame_ && inStubFrame_); inStubFrame_ = false; - EmitLeaveStubFrame(masm, calledIntoIon); + + if (engine_ == Engine::Baseline) + EmitBaselineLeaveStubFrame(masm, calledIntoIon); + else + EmitIonLeaveStubFrame(masm); } void ICStubCompiler::pushFramePtr(MacroAssembler& masm, Register scratch) { + if (engine_ == Engine::IonMonkey) { + masm.push(Imm32(0)); + return; + } + if (inStubFrame_) { masm.loadPtr(Address(BaselineFrameReg, 0), scratch); masm.pushBaselineFramePtr(scratch, scratch); diff --git a/js/src/jit/arm/SharedICHelpers-arm.h b/js/src/jit/arm/SharedICHelpers-arm.h index 9f1419a01054..8e9a9cda842a 100644 --- a/js/src/jit/arm/SharedICHelpers-arm.h +++ b/js/src/jit/arm/SharedICHelpers-arm.h @@ -79,7 +79,7 @@ EmitChangeICReturnAddress(MacroAssembler& masm, Register reg) } inline void -EmitTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) +EmitBaselineTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) { // We assume during this that R0 and R1 have been pushed, and that R2 is // unused. @@ -106,7 +106,13 @@ EmitTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) } inline void -EmitCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) +EmitIonTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t stackSize) +{ + MOZ_CRASH("Not implemented yet."); +} + +inline void +EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) { // Compute stub frame size. We have to add two pointers: the stub reg and // previous frame pointer pushed by EmitEnterStubFrame. @@ -118,19 +124,25 @@ EmitCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) } inline void -EmitCallVM(JitCode* target, MacroAssembler& masm) +EmitBaselineCallVM(JitCode* target, MacroAssembler& masm) { - EmitCreateStubFrameDescriptor(masm, r0); + EmitBaselineCreateStubFrameDescriptor(masm, r0); masm.push(r0); masm.call(target); } +inline void +EmitIonCallVM(JitCode* target, size_t stackSlots, MacroAssembler& masm) +{ + MOZ_CRASH("Not implemented yet."); +} + // Size of vales pushed by EmitEnterStubFrame. static const uint32_t STUB_FRAME_SIZE = 4 * sizeof(void*); static const uint32_t STUB_FRAME_SAVED_STUB_OFFSET = sizeof(void*); inline void -EmitEnterStubFrame(MacroAssembler& masm, Register scratch) +EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { MOZ_ASSERT(scratch != ICTailCallReg); @@ -159,7 +171,13 @@ EmitEnterStubFrame(MacroAssembler& masm, Register scratch) } inline void -EmitLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) +EmitIonEnterStubFrame(MacroAssembler& masm, Register scratch) +{ + MOZ_CRASH("Not implemented yet."); +} + +inline void +EmitBaselineLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) { // Ion frames do not save and restore the frame pointer. If we called into // Ion, we have to restore the stack pointer from the frame descriptor. If @@ -183,6 +201,12 @@ EmitLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) masm.pop(ScratchRegister); } +inline void +EmitIonLeaveStubFrame(MacroAssembler& masm) +{ + MOZ_CRASH("Not implemented yet."); +} + inline void EmitStowICValues(MacroAssembler& masm, int values) { @@ -262,7 +286,7 @@ EmitCallTypeUpdateIC(MacroAssembler& masm, JitCode* code, uint32_t objectOffset) masm.j(Assembler::Equal, &success); // If the IC failed, then call the update fallback function. - EmitEnterStubFrame(masm, R1.scratchReg()); + EmitBaselineEnterStubFrame(masm, R1.scratchReg()); masm.loadValue(Address(BaselineStackReg, STUB_FRAME_SIZE + objectOffset), R1); @@ -274,8 +298,8 @@ EmitCallTypeUpdateIC(MacroAssembler& masm, JitCode* code, uint32_t objectOffset) masm.loadPtr(Address(BaselineFrameReg, 0), R0.scratchReg()); masm.pushBaselineFramePtr(R0.scratchReg(), R0.scratchReg()); - EmitCallVM(code, masm); - EmitLeaveStubFrame(masm); + EmitBaselineCallVM(code, masm); + EmitBaselineLeaveStubFrame(masm); // Success at end. masm.bind(&success); diff --git a/js/src/jit/arm/Trampoline-arm.cpp b/js/src/jit/arm/Trampoline-arm.cpp index 9baeb12259b4..7eca4cdaee5e 100644 --- a/js/src/jit/arm/Trampoline-arm.cpp +++ b/js/src/jit/arm/Trampoline-arm.cpp @@ -980,7 +980,7 @@ JitRuntime::generateDebugTrapHandler(JSContext* cx) // stub frame has a nullptr ICStub pointer, since this pointer is marked // during GC. masm.movePtr(ImmPtr(nullptr), ICStubReg); - EmitEnterStubFrame(masm, scratch2); + EmitBaselineEnterStubFrame(masm, scratch2); JitCode* code = cx->runtime()->jitRuntime()->getVMWrapper(HandleDebugTrapInfo); if (!code) @@ -988,9 +988,9 @@ JitRuntime::generateDebugTrapHandler(JSContext* cx) masm.push(lr); masm.push(scratch1); - EmitCallVM(code, masm); + EmitBaselineCallVM(code, masm); - EmitLeaveStubFrame(masm); + EmitBaselineLeaveStubFrame(masm); // If the stub returns |true|, we have to perform a forced return (return // from the JS frame). If the stub returns |false|, just return from the diff --git a/js/src/jit/mips32/SharedICHelpers-mips32.h b/js/src/jit/mips32/SharedICHelpers-mips32.h index e0269ad7e3d6..68a398a67911 100644 --- a/js/src/jit/mips32/SharedICHelpers-mips32.h +++ b/js/src/jit/mips32/SharedICHelpers-mips32.h @@ -78,7 +78,7 @@ EmitChangeICReturnAddress(MacroAssembler& masm, Register reg) } inline void -EmitTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) +EmitBaselineTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) { // We assume during this that R0 and R1 have been pushed, and that R2 is // unused. @@ -107,7 +107,13 @@ EmitTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) } inline void -EmitCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) +EmitIonTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t stackSize) +{ + MOZ_CRASH("Not implemented yet."); +} + +inline void +EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) { // Compute stub frame size. We have to add two pointers: the stub reg and // previous frame pointer pushed by EmitEnterStubFrame. @@ -119,13 +125,19 @@ EmitCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) } inline void -EmitCallVM(JitCode* target, MacroAssembler& masm) +EmitBaselineCallVM(JitCode* target, MacroAssembler& masm) { - EmitCreateStubFrameDescriptor(masm, t6); + EmitBaselineCreateStubFrameDescriptor(masm, t6); masm.push(t6); masm.call(target); } +inline void +EmitIonCallVM(JitCode* target, size_t stackSlots, MacroAssembler& masm) +{ + MOZ_CRASH("Not implemented yet."); +} + struct BaselineStubFrame { uintptr_t savedFrame; uintptr_t savedStub; @@ -137,7 +149,7 @@ static const uint32_t STUB_FRAME_SIZE = sizeof(BaselineStubFrame); static const uint32_t STUB_FRAME_SAVED_STUB_OFFSET = offsetof(BaselineStubFrame, savedStub); inline void -EmitEnterStubFrame(MacroAssembler& masm, Register scratch) +mitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { MOZ_ASSERT(scratch != ICTailCallReg); @@ -170,7 +182,13 @@ EmitEnterStubFrame(MacroAssembler& masm, Register scratch) } inline void -EmitLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) +EmitIonEnterStubFrame(MacroAssembler& masm, Register scratch) +{ + MOZ_CRASH("Not implemented yet."); +} + +inline void +EmitBaselineLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) { // Ion frames do not save and restore the frame pointer. If we called // into Ion, we have to restore the stack pointer from the frame descriptor. @@ -198,6 +216,12 @@ EmitLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) masm.addPtr(Imm32(STUB_FRAME_SIZE), StackPointer); } +inline void +EmitIonLeaveStubFrame(MacroAssembler& masm) +{ + MOZ_CRASH("Not implemented yet."); +} + inline void EmitStowICValues(MacroAssembler& masm, int values) { @@ -274,7 +298,7 @@ EmitCallTypeUpdateIC(MacroAssembler& masm, JitCode* code, uint32_t objectOffset) masm.ma_b(R1.scratchReg(), Imm32(1), &success, Assembler::Equal, ShortJump); // If the IC failed, then call the update fallback function. - EmitEnterStubFrame(masm, R1.scratchReg()); + EmitBaselineEnterStubFrame(masm, R1.scratchReg()); masm.loadValue(Address(BaselineStackReg, STUB_FRAME_SIZE + objectOffset), R1); @@ -286,8 +310,8 @@ EmitCallTypeUpdateIC(MacroAssembler& masm, JitCode* code, uint32_t objectOffset) masm.loadPtr(Address(BaselineFrameReg, 0), R0.scratchReg()); masm.pushBaselineFramePtr(R0.scratchReg(), R0.scratchReg()); - EmitCallVM(code, masm); - EmitLeaveStubFrame(masm); + EmitBaselineCallVM(code, masm); + EmitBaselineLeaveStubFrame(masm); // Success at end. masm.bind(&success); diff --git a/js/src/jit/mips32/Trampoline-mips32.cpp b/js/src/jit/mips32/Trampoline-mips32.cpp index e899a2b3babf..d57865c0a08d 100644 --- a/js/src/jit/mips32/Trampoline-mips32.cpp +++ b/js/src/jit/mips32/Trampoline-mips32.cpp @@ -948,7 +948,7 @@ JitRuntime::generateDebugTrapHandler(JSContext* cx) // the stub frame has a nullptr ICStub pointer, since this pointer is // marked during GC. masm.movePtr(ImmPtr(nullptr), ICStubReg); - EmitEnterStubFrame(masm, scratch2); + EmitBaselineEnterStubFrame(masm, scratch2); JitCode* code = cx->runtime()->jitRuntime()->getVMWrapper(HandleDebugTrapInfo); if (!code) @@ -958,9 +958,9 @@ JitRuntime::generateDebugTrapHandler(JSContext* cx) masm.storePtr(ra, Address(StackPointer, sizeof(uintptr_t))); masm.storePtr(scratch1, Address(StackPointer, 0)); - EmitCallVM(code, masm); + EmitBaselineCallVM(code, masm); - EmitLeaveStubFrame(masm); + EmitBaselineLeaveStubFrame(masm); // If the stub returns |true|, we have to perform a forced return // (return from the JS frame). If the stub returns |false|, just return diff --git a/js/src/jit/none/SharedICHelpers-none.h b/js/src/jit/none/SharedICHelpers-none.h index a35d6e0196bd..1cb33aaad097 100644 --- a/js/src/jit/none/SharedICHelpers-none.h +++ b/js/src/jit/none/SharedICHelpers-none.h @@ -20,11 +20,15 @@ inline void EmitCallIC(CodeOffsetLabel*, MacroAssembler&) { MOZ_CRASH(); } inline void EmitEnterTypeMonitorIC(MacroAssembler&, size_t v = 0) { MOZ_CRASH(); } inline void EmitReturnFromIC(MacroAssembler&) { MOZ_CRASH(); } inline void EmitChangeICReturnAddress(MacroAssembler&, Register) { MOZ_CRASH(); } -inline void EmitTailCallVM(JitCode*, MacroAssembler&, uint32_t) { MOZ_CRASH(); } -inline void EmitCreateStubFrameDescriptor(MacroAssembler&, Register) { MOZ_CRASH(); } -inline void EmitCallVM(JitCode*, MacroAssembler&) { MOZ_CRASH(); } -inline void EmitEnterStubFrame(MacroAssembler&, Register) { MOZ_CRASH(); } -inline void EmitLeaveStubFrame(MacroAssembler&, bool v = false) { MOZ_CRASH(); } +inline void EmitBaselineTailCallVM(JitCode*, MacroAssembler&, uint32_t) { MOZ_CRASH(); } +inline void EmitIonTailCallVM(JitCode*, MacroAssembler&, uint32_t) { MOZ_CRASH(); } +inline void EmitBaselineCreateStubFrameDescriptor(MacroAssembler&, Register) { MOZ_CRASH(); } +inline void EmitBaselineCallVM(JitCode*, MacroAssembler&) { MOZ_CRASH(); } +inline void EmitIonCallVM(JitCode*, size_t, MacroAssembler&) { MOZ_CRASH(); } +inline void EmitBaselineEnterStubFrame(MacroAssembler&, Register) { MOZ_CRASH(); } +inline void EmitIonEnterStubFrame(MacroAssembler&, Register) { MOZ_CRASH(); } +inline void EmitBaselineLeaveStubFrame(MacroAssembler&, bool v = false) { MOZ_CRASH(); } +inline void EmitIonLeaveStubFrame(MacroAssembler&) { MOZ_CRASH(); } inline void EmitStowICValues(MacroAssembler&, int) { MOZ_CRASH(); } inline void EmitUnstowICValues(MacroAssembler&, int, bool v = false) { MOZ_CRASH(); } inline void EmitCallTypeUpdateIC(MacroAssembler&, JitCode*, uint32_t) { MOZ_CRASH(); } diff --git a/js/src/jit/x64/SharedICHelpers-x64.h b/js/src/jit/x64/SharedICHelpers-x64.h index f00d2569914d..11203017cb8c 100644 --- a/js/src/jit/x64/SharedICHelpers-x64.h +++ b/js/src/jit/x64/SharedICHelpers-x64.h @@ -70,7 +70,7 @@ EmitChangeICReturnAddress(MacroAssembler& masm, Register reg) } inline void -EmitTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) +EmitBaselineTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) { // We an assume during this that R0 and R1 have been pushed. masm.movq(BaselineFrameReg, ScratchReg); @@ -90,7 +90,13 @@ EmitTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) } inline void -EmitCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) +EmitIonTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t stackSize) +{ + MOZ_CRASH("Not implemented yet."); +} + +inline void +EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) { // Compute stub frame size. We have to add two pointers: the stub reg and previous // frame pointer pushed by EmitEnterStubFrame. @@ -102,19 +108,25 @@ EmitCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) } inline void -EmitCallVM(JitCode* target, MacroAssembler& masm) +EmitBaselineCallVM(JitCode* target, MacroAssembler& masm) { - EmitCreateStubFrameDescriptor(masm, ScratchReg); + EmitBaselineCreateStubFrameDescriptor(masm, ScratchReg); masm.push(ScratchReg); masm.call(target); } +inline void +EmitIonCallVM(JitCode* target, size_t stackSlots, MacroAssembler& masm) +{ + MOZ_CRASH("Not implemented yet."); +} + // Size of vales pushed by EmitEnterStubFrame. static const uint32_t STUB_FRAME_SIZE = 4 * sizeof(void*); static const uint32_t STUB_FRAME_SAVED_STUB_OFFSET = sizeof(void*); inline void -EmitEnterStubFrame(MacroAssembler& masm, Register) +EmitBaselineEnterStubFrame(MacroAssembler& masm, Register) { EmitRestoreTailCallReg(masm); @@ -140,7 +152,13 @@ EmitEnterStubFrame(MacroAssembler& masm, Register) } inline void -EmitLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) +EmitIonEnterStubFrame(MacroAssembler& masm, Register scratch) +{ + MOZ_CRASH("Not implemented yet."); +} + +inline void +EmitBaselineLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) { // Ion frames do not save and restore the frame pointer. If we called // into Ion, we have to restore the stack pointer from the frame descriptor. @@ -165,6 +183,12 @@ EmitLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) masm.storePtr(ICTailCallReg, Address(BaselineStackReg, 0)); } +inline void +EmitIonLeaveStubFrame(MacroAssembler& masm) +{ + MOZ_CRASH("Not implemented yet."); +} + inline void EmitStowICValues(MacroAssembler& masm, int values) { @@ -242,7 +266,7 @@ EmitCallTypeUpdateIC(MacroAssembler& masm, JitCode* code, uint32_t objectOffset) masm.j(Assembler::Equal, &success); // If the IC failed, then call the update fallback function. - EmitEnterStubFrame(masm, R1.scratchReg()); + EmitBaselineEnterStubFrame(masm, R1.scratchReg()); masm.loadValue(Address(BaselineStackReg, STUB_FRAME_SIZE + objectOffset), R1); @@ -254,8 +278,8 @@ EmitCallTypeUpdateIC(MacroAssembler& masm, JitCode* code, uint32_t objectOffset) masm.loadPtr(Address(BaselineFrameReg, 0), R0.scratchReg()); masm.pushBaselineFramePtr(R0.scratchReg(), R0.scratchReg()); - EmitCallVM(code, masm); - EmitLeaveStubFrame(masm); + EmitBaselineCallVM(code, masm); + EmitBaselineLeaveStubFrame(masm); // Success at end. masm.bind(&success); diff --git a/js/src/jit/x64/Trampoline-x64.cpp b/js/src/jit/x64/Trampoline-x64.cpp index 48afad42d99d..9a7893045016 100644 --- a/js/src/jit/x64/Trampoline-x64.cpp +++ b/js/src/jit/x64/Trampoline-x64.cpp @@ -872,7 +872,7 @@ JitRuntime::generateDebugTrapHandler(JSContext* cx) // the stub frame has a nullptr ICStub pointer, since this pointer is marked // during GC. masm.movePtr(ImmPtr(nullptr), ICStubReg); - EmitEnterStubFrame(masm, scratch3); + EmitBaselineEnterStubFrame(masm, scratch3); JitCode* code = cx->runtime()->jitRuntime()->getVMWrapper(HandleDebugTrapInfo); if (!code) @@ -880,9 +880,9 @@ JitRuntime::generateDebugTrapHandler(JSContext* cx) masm.push(scratch1); masm.push(scratch2); - EmitCallVM(code, masm); + EmitBaselineCallVM(code, masm); - EmitLeaveStubFrame(masm); + EmitBaselineLeaveStubFrame(masm); // If the stub returns |true|, we have to perform a forced return // (return from the JS frame). If the stub returns |false|, just return diff --git a/js/src/jit/x86/SharedICHelpers-x86.h b/js/src/jit/x86/SharedICHelpers-x86.h index d8d6135e92a8..1be795ad493b 100644 --- a/js/src/jit/x86/SharedICHelpers-x86.h +++ b/js/src/jit/x86/SharedICHelpers-x86.h @@ -71,7 +71,7 @@ EmitChangeICReturnAddress(MacroAssembler& masm, Register reg) } inline void -EmitTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) +EmitBaselineTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) { // We assume during this that R0 and R1 have been pushed. @@ -93,7 +93,13 @@ EmitTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) } inline void -EmitCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) +EmitIonTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t stackSize) +{ + MOZ_CRASH("Not implemented yet."); +} + +inline void +EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) { // Compute stub frame size. We have to add two pointers: the stub reg and previous // frame pointer pushed by EmitEnterStubFrame. @@ -105,19 +111,25 @@ EmitCreateStubFrameDescriptor(MacroAssembler& masm, Register reg) } inline void -EmitCallVM(JitCode* target, MacroAssembler& masm) +EmitBaselineCallVM(JitCode* target, MacroAssembler& masm) { - EmitCreateStubFrameDescriptor(masm, eax); + EmitBaselineCreateStubFrameDescriptor(masm, eax); masm.push(eax); masm.call(target); } +inline void +EmitIonCallVM(JitCode* target, size_t stackSlots, MacroAssembler& masm) +{ + MOZ_CRASH("Not implemented yet."); +} + // Size of vales pushed by EmitEnterStubFrame. static const uint32_t STUB_FRAME_SIZE = 4 * sizeof(void*); static const uint32_t STUB_FRAME_SAVED_STUB_OFFSET = sizeof(void*); inline void -EmitEnterStubFrame(MacroAssembler& masm, Register scratch) +EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { MOZ_ASSERT(scratch != ICTailCallReg); @@ -145,7 +157,13 @@ EmitEnterStubFrame(MacroAssembler& masm, Register scratch) } inline void -EmitLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) +EmitIonEnterStubFrame(MacroAssembler& masm, Register scratch) +{ + MOZ_CRASH("Not implemented yet."); +} + +inline void +EmitBaselineLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) { // Ion frames do not save and restore the frame pointer. If we called // into Ion, we have to restore the stack pointer from the frame descriptor. @@ -171,6 +189,12 @@ EmitLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) masm.storePtr(ICTailCallReg, Address(BaselineStackReg, 0)); } +inline void +EmitIonLeaveStubFrame(MacroAssembler& masm) +{ + MOZ_CRASH("Not implemented yet."); +} + inline void EmitStowICValues(MacroAssembler& masm, int values) { @@ -248,7 +272,7 @@ EmitCallTypeUpdateIC(MacroAssembler& masm, JitCode* code, uint32_t objectOffset) masm.j(Assembler::Equal, &success); // If the IC failed, then call the update fallback function. - EmitEnterStubFrame(masm, R1.scratchReg()); + EmitBaselineEnterStubFrame(masm, R1.scratchReg()); masm.loadValue(Address(BaselineStackReg, STUB_FRAME_SIZE + objectOffset), R1); @@ -260,8 +284,8 @@ EmitCallTypeUpdateIC(MacroAssembler& masm, JitCode* code, uint32_t objectOffset) masm.loadPtr(Address(BaselineFrameReg, 0), R0.scratchReg()); masm.pushBaselineFramePtr(R0.scratchReg(), R0.scratchReg()); - EmitCallVM(code, masm); - EmitLeaveStubFrame(masm); + EmitBaselineCallVM(code, masm); + EmitBaselineLeaveStubFrame(masm); // Success at end. masm.bind(&success); diff --git a/js/src/jit/x86/Trampoline-x86.cpp b/js/src/jit/x86/Trampoline-x86.cpp index 7194759ef59a..f5f87edd10c8 100644 --- a/js/src/jit/x86/Trampoline-x86.cpp +++ b/js/src/jit/x86/Trampoline-x86.cpp @@ -900,7 +900,7 @@ JitRuntime::generateDebugTrapHandler(JSContext* cx) // the stub frame has a nullptr ICStub pointer, since this pointer is // marked during GC. masm.movePtr(ImmPtr(nullptr), ICStubReg); - EmitEnterStubFrame(masm, scratch3); + EmitBaselineEnterStubFrame(masm, scratch3); JitCode* code = cx->runtime()->jitRuntime()->getVMWrapper(HandleDebugTrapInfo); if (!code) @@ -908,9 +908,9 @@ JitRuntime::generateDebugTrapHandler(JSContext* cx) masm.push(scratch1); masm.push(scratch2); - EmitCallVM(code, masm); + EmitBaselineCallVM(code, masm); - EmitLeaveStubFrame(masm); + EmitBaselineLeaveStubFrame(masm); // If the stub returns |true|, we have to perform a forced return // (return from the JS frame). If the stub returns |false|, just return