From 3132097598c33c4b68152e494d8f0d5e5e3ac9ab Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Tue, 28 Jun 2022 06:44:38 +0000 Subject: [PATCH] Bug 1776666 part 1 - Remove BaselineStackReg alias. r=iain `BaselineFrameReg` was removed a few weeks ago. Differential Revision: https://phabricator.services.mozilla.com/D150371 --- js/src/jit/BaselineIC.cpp | 9 ++------- js/src/jit/arm/SharedICHelpers-arm-inl.h | 6 +++--- js/src/jit/arm/SharedICRegisters-arm.h | 2 -- js/src/jit/arm64/SharedICRegisters-arm64.h | 3 --- js/src/jit/loong64/SharedICHelpers-loong64-inl.h | 6 +++--- js/src/jit/loong64/SharedICRegisters-loong64.h | 2 -- .../mips-shared/SharedICHelpers-mips-shared-inl.h | 6 +++--- js/src/jit/mips-shared/SharedICHelpers-mips-shared.h | 2 +- js/src/jit/mips32/SharedICRegisters-mips32.h | 2 -- js/src/jit/mips64/SharedICRegisters-mips64.h | 2 -- js/src/jit/none/SharedICRegisters-none.h | 2 -- js/src/jit/x64/SharedICHelpers-x64-inl.h | 12 ++++++------ js/src/jit/x64/SharedICHelpers-x64.h | 2 +- js/src/jit/x64/SharedICRegisters-x64.h | 2 -- js/src/jit/x86/SharedICHelpers-x86-inl.h | 12 ++++++------ js/src/jit/x86/SharedICHelpers-x86.h | 2 +- js/src/jit/x86/SharedICRegisters-x86.h | 2 -- 17 files changed, 26 insertions(+), 48 deletions(-) diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 97557ec0b812..770b0ecec842 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -112,19 +112,15 @@ AllocatableGeneralRegisterSet BaselineICAvailableGeneralRegs(size_t numInputs) { AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All()); MOZ_ASSERT(!regs.has(FramePointer)); #if defined(JS_CODEGEN_ARM) - MOZ_ASSERT(!regs.has(BaselineStackReg)); MOZ_ASSERT(!regs.has(ICTailCallReg)); regs.take(BaselineSecondScratchReg); #elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) - MOZ_ASSERT(!regs.has(BaselineStackReg)); MOZ_ASSERT(!regs.has(ICTailCallReg)); MOZ_ASSERT(!regs.has(BaselineSecondScratchReg)); #elif defined(JS_CODEGEN_ARM64) MOZ_ASSERT(!regs.has(PseudoStackPointer)); MOZ_ASSERT(!regs.has(RealStackPointer)); MOZ_ASSERT(!regs.has(ICTailCallReg)); -#else - MOZ_ASSERT(!regs.has(BaselineStackReg)); #endif regs.take(ICStubReg); @@ -1708,9 +1704,8 @@ bool FallbackICCodeCompiler::emitCall(bool isSpread, bool isConstructing) { // Push a stub frame so that we can perform a non-tail call. enterStubFrame(masm, R1.scratchReg()); - // Use FramePointer instead of BaselineStackReg, because - // FramePointer and BaselineStackReg hold the same value just after - // calling enterStubFrame. + // Use FramePointer instead of StackPointer because it's not affected by + // the stack pushes below. // newTarget uint32_t valueOffset = 0; diff --git a/js/src/jit/arm/SharedICHelpers-arm-inl.h b/js/src/jit/arm/SharedICHelpers-arm-inl.h index 13f36218548b..8c1098fad652 100644 --- a/js/src/jit/arm/SharedICHelpers-arm-inl.h +++ b/js/src/jit/arm/SharedICHelpers-arm-inl.h @@ -24,7 +24,7 @@ inline void EmitBaselineTailCallVM(TrampolinePtr target, MacroAssembler& masm, // Store frame size without VMFunction arguments for debug assertions. masm.movePtr(FramePointer, r0); - masm.ma_sub(BaselineStackReg, r0); + masm.ma_sub(StackPointer, r0); masm.sub32(Imm32(argSize), r0); Address frameSizeAddr(FramePointer, BaselineFrame::reverseOffsetOfDebugFrameSize()); @@ -52,7 +52,7 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { #ifdef DEBUG // Compute frame size. masm.mov(FramePointer, scratch); - masm.ma_sub(BaselineStackReg, scratch); + masm.ma_sub(StackPointer, scratch); Address frameSizeAddr(FramePointer, BaselineFrame::reverseOffsetOfDebugFrameSize()); @@ -68,7 +68,7 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { // Save old frame pointer, stack pointer and stub reg. masm.Push(FramePointer); - masm.mov(BaselineStackReg, FramePointer); + masm.mov(StackPointer, FramePointer); masm.Push(ICStubReg); diff --git a/js/src/jit/arm/SharedICRegisters-arm.h b/js/src/jit/arm/SharedICRegisters-arm.h index 9fe8844c1ee5..16aabbf0b3bb 100644 --- a/js/src/jit/arm/SharedICRegisters-arm.h +++ b/js/src/jit/arm/SharedICRegisters-arm.h @@ -16,10 +16,8 @@ namespace jit { // r15 = program-counter // r14 = link-register - // r13 = stack-pointer // r11 = frame-pointer -static constexpr Register BaselineStackReg = sp; // ValueOperands R0, R1, and R2. // R0 == JSReturnReg, and R2 uses registers not preserved across calls. R1 value diff --git a/js/src/jit/arm64/SharedICRegisters-arm64.h b/js/src/jit/arm64/SharedICRegisters-arm64.h index 7ac813adde5d..1aa49d651c61 100644 --- a/js/src/jit/arm64/SharedICRegisters-arm64.h +++ b/js/src/jit/arm64/SharedICRegisters-arm64.h @@ -14,9 +14,6 @@ namespace js { namespace jit { -// BaselineStackReg is intentionally undefined on ARM64. -// Refer to the comment next to the definition of RealStackPointer. - // ValueOperands R0, R1, and R2. // R0 == JSReturnReg, and R2 uses registers not preserved across calls. // R1 value should be preserved across calls. diff --git a/js/src/jit/loong64/SharedICHelpers-loong64-inl.h b/js/src/jit/loong64/SharedICHelpers-loong64-inl.h index 9c4b60a2399e..bc0eb0e4fc24 100644 --- a/js/src/jit/loong64/SharedICHelpers-loong64-inl.h +++ b/js/src/jit/loong64/SharedICHelpers-loong64-inl.h @@ -22,7 +22,7 @@ inline void EmitBaselineTailCallVM(TrampolinePtr target, MacroAssembler& masm, // Compute frame size. masm.movePtr(FramePointer, scratch); - masm.subPtr(BaselineStackReg, scratch); + masm.subPtr(StackPointer, scratch); // Store frame size without VMFunction arguments for debug assertions. masm.subPtr(Imm32(argSize), scratch); @@ -57,7 +57,7 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { #ifdef DEBUG // Compute frame size. masm.movePtr(FramePointer, scratch); - masm.subPtr(BaselineStackReg, scratch); + masm.subPtr(StackPointer, scratch); Address frameSizeAddr(FramePointer, BaselineFrame::reverseOffsetOfDebugFrameSize()); @@ -73,7 +73,7 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { // Save old frame pointer, stack pointer and stub reg. masm.Push(FramePointer); - masm.movePtr(BaselineStackReg, FramePointer); + masm.movePtr(StackPointer, FramePointer); masm.Push(ICStubReg); // Stack should remain aligned. diff --git a/js/src/jit/loong64/SharedICRegisters-loong64.h b/js/src/jit/loong64/SharedICRegisters-loong64.h index 2689686f866d..d51336c1d295 100644 --- a/js/src/jit/loong64/SharedICRegisters-loong64.h +++ b/js/src/jit/loong64/SharedICRegisters-loong64.h @@ -14,8 +14,6 @@ namespace js { namespace jit { -static constexpr Register BaselineStackReg = sp; - // ValueOperands R0, R1, and R2. // R0 == JSReturnReg, and R2 uses registers not preserved across calls. R1 value // should be preserved across calls. diff --git a/js/src/jit/mips-shared/SharedICHelpers-mips-shared-inl.h b/js/src/jit/mips-shared/SharedICHelpers-mips-shared-inl.h index 3d2d90757c2b..e37adbc9f4ee 100644 --- a/js/src/jit/mips-shared/SharedICHelpers-mips-shared-inl.h +++ b/js/src/jit/mips-shared/SharedICHelpers-mips-shared-inl.h @@ -23,7 +23,7 @@ inline void EmitBaselineTailCallVM(TrampolinePtr target, MacroAssembler& masm, // Store frame size without VMFunction arguments for debug assertions. masm.movePtr(FramePointer, scratch); masm.addPtr(Imm32(BaselineFrame::FramePointerOffset), scratch); - masm.subPtr(BaselineStackReg, scratch); + masm.subPtr(StackPointer, scratch); masm.subPtr(Imm32(argSize), scratch); Address frameSizeAddr(FramePointer, BaselineFrame::reverseOffsetOfDebugFrameSize()); @@ -56,7 +56,7 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { // Compute frame size. masm.movePtr(FramePointer, scratch); masm.addPtr(Imm32(BaselineFrame::FramePointerOffset), scratch); - masm.subPtr(BaselineStackReg, scratch); + masm.subPtr(StackPointer, scratch); Address frameSizeAddr(FramePointer, BaselineFrame::reverseOffsetOfDebugFrameSize()); @@ -78,7 +78,7 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { Address(StackPointer, offsetof(BaselineStubFrame, savedStub))); masm.storePtr(FramePointer, Address(StackPointer, offsetof(BaselineStubFrame, savedFrame))); - masm.movePtr(BaselineStackReg, FramePointer); + masm.movePtr(StackPointer, FramePointer); // Stack should remain aligned. masm.assertStackAlignment(sizeof(Value), 0); diff --git a/js/src/jit/mips-shared/SharedICHelpers-mips-shared.h b/js/src/jit/mips-shared/SharedICHelpers-mips-shared.h index b043eb237940..20fa8d156e84 100644 --- a/js/src/jit/mips-shared/SharedICHelpers-mips-shared.h +++ b/js/src/jit/mips-shared/SharedICHelpers-mips-shared.h @@ -48,7 +48,7 @@ inline void EmitCallIC(MacroAssembler& masm, CodeOffset* callOffset) { inline void EmitReturnFromIC(MacroAssembler& masm) { masm.branch(ra); } inline void EmitBaselineLeaveStubFrame(MacroAssembler& masm) { - masm.movePtr(FramePointer, BaselineStackReg); + masm.movePtr(FramePointer, StackPointer); masm.loadPtr(Address(StackPointer, offsetof(BaselineStubFrame, savedFrame)), FramePointer); diff --git a/js/src/jit/mips32/SharedICRegisters-mips32.h b/js/src/jit/mips32/SharedICRegisters-mips32.h index 06274255112d..a1017c939973 100644 --- a/js/src/jit/mips32/SharedICRegisters-mips32.h +++ b/js/src/jit/mips32/SharedICRegisters-mips32.h @@ -14,8 +14,6 @@ namespace js { namespace jit { -static constexpr Register BaselineStackReg = sp; - static constexpr ValueOperand R0(a3, a2); static constexpr ValueOperand R1(s7, s6); static constexpr ValueOperand R2(t7, t6); diff --git a/js/src/jit/mips64/SharedICRegisters-mips64.h b/js/src/jit/mips64/SharedICRegisters-mips64.h index a33d3e7c391b..99b263ca1e50 100644 --- a/js/src/jit/mips64/SharedICRegisters-mips64.h +++ b/js/src/jit/mips64/SharedICRegisters-mips64.h @@ -14,8 +14,6 @@ namespace js { namespace jit { -static constexpr Register BaselineStackReg = sp; - // ValueOperands R0, R1, and R2. // R0 == JSReturnReg, and R2 uses registers not preserved across calls. R1 value // should be preserved across calls. diff --git a/js/src/jit/none/SharedICRegisters-none.h b/js/src/jit/none/SharedICRegisters-none.h index 66e0a63b14bb..170e5058a9c7 100644 --- a/js/src/jit/none/SharedICRegisters-none.h +++ b/js/src/jit/none/SharedICRegisters-none.h @@ -14,8 +14,6 @@ namespace js { namespace jit { -static constexpr Register BaselineStackReg{Registers::invalid_reg}; - static constexpr ValueOperand R0 = JSReturnOperand; static constexpr ValueOperand R1 = JSReturnOperand; static constexpr ValueOperand R2 = JSReturnOperand; diff --git a/js/src/jit/x64/SharedICHelpers-x64-inl.h b/js/src/jit/x64/SharedICHelpers-x64-inl.h index 1e448979979e..d298ad3c9124 100644 --- a/js/src/jit/x64/SharedICHelpers-x64-inl.h +++ b/js/src/jit/x64/SharedICHelpers-x64-inl.h @@ -23,7 +23,7 @@ inline void EmitBaselineTailCallVM(TrampolinePtr target, MacroAssembler& masm, // We can assume during this that R0 and R1 have been pushed. // Store frame size without VMFunction arguments for debug assertions. masm.movq(FramePointer, scratch); - masm.subq(BaselineStackReg, scratch); + masm.subq(StackPointer, scratch); masm.subq(Imm32(argSize), scratch); Address frameSizeAddr(FramePointer, BaselineFrame::reverseOffsetOfDebugFrameSize()); @@ -47,12 +47,12 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register) { // this is: // // FramePointer - // - BaselineStackReg + // - StackPointer // - sizeof(return address) ScratchRegisterScope scratch(masm); masm.movq(FramePointer, scratch); - masm.subq(BaselineStackReg, scratch); + masm.subq(StackPointer, scratch); masm.subq(Imm32(sizeof(void*)), scratch); // Return address. Address frameSizeAddr(FramePointer, @@ -64,15 +64,15 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register) { // if needed. // Push the return address that's currently on top of the stack. - masm.Push(Operand(BaselineStackReg, 0)); + masm.Push(Operand(StackPointer, 0)); // Replace the original return address with the frame descriptor. masm.storePtr(ImmWord(MakeFrameDescriptor(FrameType::BaselineJS)), - Address(BaselineStackReg, sizeof(uintptr_t))); + Address(StackPointer, sizeof(uintptr_t))); // Save old frame pointer, stack pointer and stub reg. masm.Push(FramePointer); - masm.mov(BaselineStackReg, FramePointer); + masm.mov(StackPointer, FramePointer); masm.Push(ICStubReg); } diff --git a/js/src/jit/x64/SharedICHelpers-x64.h b/js/src/jit/x64/SharedICHelpers-x64.h index 8a2fc4082e4c..8233db5735e1 100644 --- a/js/src/jit/x64/SharedICHelpers-x64.h +++ b/js/src/jit/x64/SharedICHelpers-x64.h @@ -47,7 +47,7 @@ inline void EmitBaselineLeaveStubFrame(MacroAssembler& masm) { // descriptor. Use a pop instruction to overwrite the frame descriptor // with the return address. Note that pop increments the stack pointer // before computing the address. - masm.Pop(Operand(BaselineStackReg, 0)); + masm.Pop(Operand(StackPointer, 0)); } template diff --git a/js/src/jit/x64/SharedICRegisters-x64.h b/js/src/jit/x64/SharedICRegisters-x64.h index 9b7d0f12da62..8e52e5f3c9a3 100644 --- a/js/src/jit/x64/SharedICRegisters-x64.h +++ b/js/src/jit/x64/SharedICRegisters-x64.h @@ -14,8 +14,6 @@ namespace js { namespace jit { -static constexpr Register BaselineStackReg = rsp; - static constexpr ValueOperand R0(rcx); static constexpr ValueOperand R1(rbx); static constexpr ValueOperand R2(rax); diff --git a/js/src/jit/x86/SharedICHelpers-x86-inl.h b/js/src/jit/x86/SharedICHelpers-x86-inl.h index d85738a1d169..23db80d7bd10 100644 --- a/js/src/jit/x86/SharedICHelpers-x86-inl.h +++ b/js/src/jit/x86/SharedICHelpers-x86-inl.h @@ -21,7 +21,7 @@ inline void EmitBaselineTailCallVM(TrampolinePtr target, MacroAssembler& masm, // We assume during this that R0 and R1 have been pushed. // Store frame size without VMFunction arguments for debug assertions. masm.movl(FramePointer, eax); - masm.subl(BaselineStackReg, eax); + masm.subl(StackPointer, eax); masm.subl(Imm32(argSize), eax); Address frameSizeAddr(FramePointer, BaselineFrame::reverseOffsetOfDebugFrameSize()); @@ -45,11 +45,11 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { // this is: // // FramePointer - // - BaselineStackReg + // - StackPointer // - sizeof(return address) masm.movl(FramePointer, scratch); - masm.subl(BaselineStackReg, scratch); + masm.subl(StackPointer, scratch); masm.subl(Imm32(sizeof(void*)), scratch); // Return address. Address frameSizeAddr(FramePointer, @@ -61,15 +61,15 @@ inline void EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) { // if needed. // Push the return address that's currently on top of the stack. - masm.Push(Operand(BaselineStackReg, 0)); + masm.Push(Operand(StackPointer, 0)); // Replace the original return address with the frame descriptor. masm.storePtr(ImmWord(MakeFrameDescriptor(FrameType::BaselineJS)), - Address(BaselineStackReg, sizeof(uintptr_t))); + Address(StackPointer, sizeof(uintptr_t))); // Save old frame pointer, stack pointer and stub reg. masm.Push(FramePointer); - masm.mov(BaselineStackReg, FramePointer); + masm.mov(StackPointer, FramePointer); masm.Push(ICStubReg); } diff --git a/js/src/jit/x86/SharedICHelpers-x86.h b/js/src/jit/x86/SharedICHelpers-x86.h index edf3b9c107a5..07d2ae8a6fe6 100644 --- a/js/src/jit/x86/SharedICHelpers-x86.h +++ b/js/src/jit/x86/SharedICHelpers-x86.h @@ -47,7 +47,7 @@ inline void EmitBaselineLeaveStubFrame(MacroAssembler& masm) { // descriptor. Use a pop instruction to overwrite the frame descriptor // with the return address. Note that pop increments the stack pointer // before computing the address. - masm.Pop(Operand(BaselineStackReg, 0)); + masm.Pop(Operand(StackPointer, 0)); } template diff --git a/js/src/jit/x86/SharedICRegisters-x86.h b/js/src/jit/x86/SharedICRegisters-x86.h index 42d6e364912d..44edb5288fe1 100644 --- a/js/src/jit/x86/SharedICRegisters-x86.h +++ b/js/src/jit/x86/SharedICRegisters-x86.h @@ -14,8 +14,6 @@ namespace js { namespace jit { -static constexpr Register BaselineStackReg = esp; - // ValueOperands R0, R1, and R2 static constexpr ValueOperand R0(ecx, edx); static constexpr ValueOperand R1(eax, ebx);