Change CallFrameRegister to architected frame pointer register
https://bugs.webkit.org/show_bug.cgi?id=123956
Reviewed by Geoffrey Garen.
Changed X86 and ARM variants as well as MIPS to use their respective architected
frame pointer registers. The freed up callFrameRegisteris are made available to
the DFG register allocator. Modified the FTL OSR exit compiler to use a temporary
register as a stand in for the destination callFrameRegister since the FTL frame
pointer register is needed to extract values from the FTL stack.
Reviewed by Geoffrey Garen.
* assembler/ARMAssembler.h:
* assembler/ARMv7Assembler.h:
* assembler/MacroAssemblerMIPS.h:
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileStub):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::addressFor):
* jit/GPRInfo.h:
(JSC::GPRInfo::toRegister):
(JSC::GPRInfo::toIndex):
* jit/JITOperations.cpp:
* jit/JSInterfaceJIT.h:
* jit/ThunkGenerators.cpp:
(JSC::callToJavaScript):
* offlineasm/arm.rb:
* offlineasm/arm64.rb:
* offlineasm/mips.rb:
* offlineasm/x86.rb:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp b/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
index 4952a41..e012707 100644
--- a/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
+++ b/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
@@ -55,6 +55,9 @@
RELEASE_ASSERT(record->patchpointID == exit.m_stackmapID);
+ // This code requires framePointerRegister is the same as callFrameRegister
+ static_assert(MacroAssembler::framePointerRegister == GPRInfo::callFrameRegister, "MacroAssembler::framePointerRegister and GPRInfo::callFrameRegister must be the same");
+
CCallHelpers jit(vm, codeBlock);
// We need scratch space to save all registers and to build up the JSStack.
@@ -76,7 +79,8 @@
// call frame.
// Get the call frame and tag thingies.
- record->locations[0].restoreInto(jit, jitCode->stackmaps, registerScratch, GPRInfo::callFrameRegister);
+ // Restore the exiting function's callFrame value into a regT4
+ record->locations[0].restoreInto(jit, jitCode->stackmaps, registerScratch, GPRInfo::regT4);
jit.move(MacroAssembler::TrustedImm64(TagTypeNumber), GPRInfo::tagTypeNumberRegister);
jit.move(MacroAssembler::TrustedImm64(TagMask), GPRInfo::tagMaskRegister);
@@ -126,7 +130,7 @@
case ExitValueInJSStackAsInt32:
case ExitValueInJSStackAsInt52:
case ExitValueInJSStackAsDouble:
- jit.load64(AssemblyHelpers::addressFor(value.virtualRegister()), GPRInfo::regT0);
+ jit.load64(AssemblyHelpers::addressFor(value.virtualRegister(), GPRInfo::regT4), GPRInfo::regT0);
break;
default:
@@ -146,14 +150,19 @@
jit.load64(scratch + index, GPRInfo::regT0);
reboxAccordingToFormat(
value.valueFormat(), jit, GPRInfo::regT0, GPRInfo::regT1, GPRInfo::regT2);
- jit.store64(GPRInfo::regT0, AssemblyHelpers::addressFor(operand));
+ jit.store64(GPRInfo::regT0, AssemblyHelpers::addressFor(static_cast<VirtualRegister>(operand), GPRInfo::regT4));
}
+ // Save the current framePointer into regT3 for the epilogue.
+ // Put regT4 into callFrameRegister
+ jit.move(MacroAssembler::framePointerRegister, GPRInfo::regT3);
+ jit.move(GPRInfo::regT4, GPRInfo::callFrameRegister);
+
handleExitCounts(jit, exit);
reifyInlinedCallFrames(jit, exit);
- jit.move(MacroAssembler::framePointerRegister, MacroAssembler::stackPointerRegister);
- jit.pop(MacroAssembler::framePointerRegister);
+ jit.move(GPRInfo::regT3, MacroAssembler::stackPointerRegister);
+ jit.pop(GPRInfo::regT3); // ignore prior framePointer
jit.pop(GPRInfo::nonArgGPR0); // ignore the result.
if (exit.m_lastSetOperand.isValid()) {