From 1b6a2066e6c0b1ea76784e0b0e6014ec33c716f0 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 28 Jun 2013 11:27:20 -0700 Subject: [PATCH] Bug 888122 - Call MacroAssembler::PushRegsInMask instead of pushing each register manually on x64. --- js/src/ion/x64/Trampoline-x64.cpp | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/js/src/ion/x64/Trampoline-x64.cpp b/js/src/ion/x64/Trampoline-x64.cpp index 9f673491c55f..c72f6cf6c30b 100644 --- a/js/src/ion/x64/Trampoline-x64.cpp +++ b/js/src/ion/x64/Trampoline-x64.cpp @@ -20,6 +20,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)); + /* This method generates a trampoline on x64 for a c++ function with * the following signature: * JSBool blah(void *code, int argc, Value *argv, JSObject *scopeChain, @@ -282,15 +288,7 @@ IonRuntime::generateInvalidator(JSContext *cx) masm.addq(Imm32(sizeof(uintptr_t)), rsp); // Push registers such that we can access them from [base + code]. - for (uint32_t i = Registers::Total; i > 0; ) { - i--; - masm.Push(Register::FromCode(i)); - } - - // 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(rsp, i * sizeof(double))); + masm.PushRegsInMask(AllRegs); masm.movq(rsp, rax); // Argument to ion::InvalidationBailout. @@ -416,15 +414,7 @@ static void GenerateBailoutThunk(JSContext *cx, MacroAssembler &masm, uint32_t frameClass) { // Push registers such that we can access them from [base + code]. - for (uint32_t i = Registers::Total; i > 0; ) { - i--; - masm.Push(Register::FromCode(i)); - } - - // 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(rsp, i * sizeof(double))); + masm.PushRegsInMask(AllRegs); // Get the stack pointer into a register, pre-alignment. masm.movq(rsp, r8);