Bug 1201810, IonMonkey - Part 0: Improve code of EmitIonTailCallVM, r=jandem
authorHannes Verschore <hv1989@gmail.com>
Thu, 10 Sep 2015 14:02:22 +0200
changeset 296078 01324f0b7651c258bb903becbc8484c9a7ecbd13
parent 296077 d27278fc308e5059e7f05c1c966d848963b5adfc
child 296079 8d7edac29dad30794d96fa21445ccb4d43a5c952
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1201810
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1201810, IonMonkey - Part 0: Improve code of EmitIonTailCallVM, r=jandem
js/src/jit/x64/SharedICHelpers-x64.h
js/src/jit/x86/SharedICHelpers-x86.h
--- a/js/src/jit/x64/SharedICHelpers-x64.h
+++ b/js/src/jit/x64/SharedICHelpers-x64.h
@@ -89,19 +89,24 @@ EmitBaselineTailCallVM(JitCode* target, 
     masm.push(scratch);
     masm.push(ICTailCallReg);
     masm.jmp(target);
 }
 
 inline void
 EmitIonTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t stackSize)
 {
+    // For tail calls, find the already pushed JitFrame_IonJS signifying the
+    // end of the Ion frame. Retrieve the length of the frame and repush
+    // JitFrame_IonJS with the extra stacksize, rendering the original
+    // JitFrame_IonJS obsolete.
+
     ScratchRegisterScope scratch(masm);
 
-    masm.movq(Operand(esp, stackSize), scratch);
+    masm.loadPtr(Address(esp, stackSize), scratch);
     masm.shrq(Imm32(FRAMESIZE_SHIFT), scratch);
     masm.addq(Imm32(stackSize + JitStubFrameLayout::Size() - sizeof(intptr_t)), scratch);
 
     // Push frame descriptor and perform the tail call.
     masm.makeFrameDescriptor(scratch, JitFrame_IonJS);
     masm.push(scratch);
     masm.push(ICTailCallReg);
     masm.jmp(target);
--- a/js/src/jit/x86/SharedICHelpers-x86.h
+++ b/js/src/jit/x86/SharedICHelpers-x86.h
@@ -90,24 +90,29 @@ EmitBaselineTailCallVM(JitCode* target, 
     masm.push(eax);
     masm.push(ICTailCallReg);
     masm.jmp(target);
 }
 
 inline void
 EmitIonTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t stackSize)
 {
-    masm.movl(Operand(esp, stackSize), eax);
+    // For tail calls, find the already pushed JitFrame_IonJS signifying the
+    // end of the Ion frame. Retrieve the length of the frame and repush
+    // JitFrame_IonJS with the extra stacksize, rendering the original
+    // JitFrame_IonJS obsolete.
+
+    masm.loadPtr(Address(esp, stackSize), eax);
     masm.shrl(Imm32(FRAMESIZE_SHIFT), eax);
     masm.addl(Imm32(stackSize + JitStubFrameLayout::Size() - sizeof(intptr_t)), eax);
 
+    // Push frame descriptor and perform the tail call.
     masm.makeFrameDescriptor(eax, JitFrame_IonJS);
     masm.push(eax);
     masm.push(ICTailCallReg);
-
     masm.jmp(target);
 }
 
 inline void
 EmitBaselineCreateStubFrameDescriptor(MacroAssembler& masm, Register reg)
 {
     // Compute stub frame size. We have to add two pointers: the stub reg and previous
     // frame pointer pushed by EmitEnterStubFrame.