From 6b4710669a2fbeb2c5a3f703e7597cfd1e80c709 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 14 Jan 2016 15:25:21 +0100 Subject: JIT: move FP save/restore to platform pro-/epilogue. This is in preparation for Aarch64, which saves/restores it as part of the fp+lr pair. Change-Id: Ia924017948aa2b257bd6bb61e488454e3944abeb Reviewed-by: Julien Brianceau Reviewed-by: Lars Knoll --- src/qml/jit/qv4assembler.cpp | 2 -- src/qml/jit/qv4targetplatform_p.h | 40 +++++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp index 929726f4b7..09bfb01247 100644 --- a/src/qml/jit/qv4assembler.cpp +++ b/src/qml/jit/qv4assembler.cpp @@ -234,7 +234,6 @@ void Assembler::enterStandardStackFrame(const RegisterInformation ®ularRegist { platformEnterStandardStackFrame(this); - push(StackFrameRegister); move(StackPointerRegister, StackFrameRegister); const int frameSize = _stackLayout->calculateStackFrameSize(); @@ -282,7 +281,6 @@ void Assembler::leaveStandardStackFrame(const RegisterInformation ®ularRegist addPtr(TrustedImm32(frameSize), StackPointerRegister); #endif - pop(StackFrameRegister); platformLeaveStandardStackFrame(this); } diff --git a/src/qml/jit/qv4targetplatform_p.h b/src/qml/jit/qv4targetplatform_p.h index 1e62b23fe4..3c93aa12b0 100644 --- a/src/qml/jit/qv4targetplatform_p.h +++ b/src/qml/jit/qv4targetplatform_p.h @@ -116,8 +116,8 @@ public: static const int StackAlignment = 16; static const int StackShadowSpace = 0; static const int StackSpaceAllocatedUponFunctionEntry = RegisterSize; // Return address is pushed onto stack by the CPU. - static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) { Q_UNUSED(as); } - static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) { Q_UNUSED(as); } + static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) { as->push(StackFrameRegister); } + static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) { as->pop(StackFrameRegister); } #if OS(WINDOWS) || OS(QNX) || \ ((OS(LINUX) || OS(FREEBSD)) && (defined(__PIC__) || defined(__PIE__))) @@ -203,8 +203,8 @@ public: static const int StackAlignment = 16; static const int StackShadowSpace = 0; static const int StackSpaceAllocatedUponFunctionEntry = RegisterSize; // Return address is pushed onto stack by the CPU. - static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) { Q_UNUSED(as); } - static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) { Q_UNUSED(as); } + static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) { as->push(StackFrameRegister); } + static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) { as->pop(StackFrameRegister); } #endif // Linux/MacOS on x86_64 #if CPU(X86_64) && OS(WINDOWS) @@ -260,8 +260,8 @@ public: static const int StackAlignment = 16; static const int StackShadowSpace = 32; static const int StackSpaceAllocatedUponFunctionEntry = RegisterSize; // Return address is pushed onto stack by the CPU. - static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) { Q_UNUSED(as); } - static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) { Q_UNUSED(as); } + static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) { as->push(StackFrameRegister); } + static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) { as->pop(StackFrameRegister); } #endif // Windows on x86_64 #if CPU(ARM) @@ -353,8 +353,18 @@ public: static const int StackAlignment = 8; // Per AAPCS static const int StackShadowSpace = 0; static const int StackSpaceAllocatedUponFunctionEntry = 1 * RegisterSize; // Registers saved in platformEnterStandardStackFrame below. - static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) { as->push(JSC::ARMRegisters::lr); } - static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) { as->pop(JSC::ARMRegisters::lr); } + + static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) + { + as->push(JSC::ARMRegisters::lr); + as->push(StackFrameRegister); + } + + static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) + { + as->pop(StackFrameRegister); + as->pop(JSC::ARMRegisters::lr); + } #endif // Linux on ARM (32 bit) #if defined(Q_PROCESSOR_MIPS_32) && defined(Q_OS_LINUX) @@ -418,8 +428,18 @@ public: static const int StackAlignment = 8; static const int StackShadowSpace = 4 * RegisterSize; // Stack space for 4 argument registers. static const int StackSpaceAllocatedUponFunctionEntry = 1 * RegisterSize; // Registers saved in platformEnterStandardStackFrame below. - static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) { as->push(JSC::MIPSRegisters::ra); } - static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) { as->pop(JSC::MIPSRegisters::ra); } + + static void platformEnterStandardStackFrame(JSC::MacroAssembler *as) + { + as->push(JSC::MIPSRegisters::ra); + as->push(StackFrameRegister); + } + + static void platformLeaveStandardStackFrame(JSC::MacroAssembler *as) + { + as->pop(StackFrameRegister); + as->pop(JSC::MIPSRegisters::ra); + } #endif // Linux on MIPS (32 bit) public: // utility functions -- cgit v1.2.3