From 91be8654ddd043ddf094f9934c8557bd8cfd462a Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 28 Jun 2013 11:28:00 -0700 Subject: [PATCH] Bug 888122 - Call MacroAssembler::PushRegsInMask instead of pushing each register manually on x86. r=dvander --- js/src/ion/x86/Trampoline-x86.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/js/src/ion/x86/Trampoline-x86.cpp b/js/src/ion/x86/Trampoline-x86.cpp index b0e5f2748ff5..1e621de11dd8 100644 --- a/js/src/ion/x86/Trampoline-x86.cpp +++ b/js/src/ion/x86/Trampoline-x86.cpp @@ -21,6 +21,12 @@ using namespace js; using namespace js::ion; +// All registers to save and restore. This includes the stack pointer, since we +// use the ability to reference register values on the stack by index. +static const RegisterSet AllRegs = + RegisterSet(GeneralRegisterSet(Registers::AllMask), + FloatRegisterSet(FloatRegisters::AllMask)); + enum EnterJitEbpArgumentOffset { ARG_JITCODE = 2 * sizeof(void *), ARG_ARGC = 3 * sizeof(void *), @@ -265,13 +271,8 @@ IonRuntime::generateInvalidator(JSContext *cx) masm.addl(Imm32(sizeof(uintptr_t)), esp); - masm.reserveStack(Registers::Total * sizeof(void *)); - for (uint32_t i = 0; i < Registers::Total; i++) - masm.movl(Register::FromCode(i), Operand(esp, i * sizeof(void *))); - - masm.reserveStack(FloatRegisters::Total * sizeof(double)); - for (uint32_t i = 0; i < FloatRegisters::Total; i++) - masm.movsd(FloatRegister::FromCode(i), Operand(esp, i * sizeof(double))); + // Push registers such that we can access them from [base + code]. + masm.PushRegsInMask(AllRegs); masm.movl(esp, eax); // Argument to ion::InvalidationBailout. @@ -411,14 +412,7 @@ static void GenerateBailoutThunk(JSContext *cx, MacroAssembler &masm, uint32_t frameClass) { // Push registers such that we can access them from [base + code]. - masm.reserveStack(Registers::Total * sizeof(void *)); - for (uint32_t i = 0; i < Registers::Total; i++) - masm.movl(Register::FromCode(i), Operand(esp, i * sizeof(void *))); - - // Push xmm registers, such that we can access them from [base + code]. - masm.reserveStack(FloatRegisters::Total * sizeof(double)); - for (uint32_t i = 0; i < FloatRegisters::Total; i++) - masm.movsd(FloatRegister::FromCode(i), Operand(esp, i * sizeof(double))); + masm.PushRegsInMask(AllRegs); // Push the bailout table number. masm.push(Imm32(frameClass));