From 31fb4f73142f403c455c6b750fa0219d12b2818f Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Fri, 21 Aug 2015 07:56:43 +0200 Subject: [PATCH] Bug 1169214: IonMonkey - Part 2: Add the x86 shared stub helpers, r=jandem --- js/src/jit/x86/SharedICHelpers-x86.h | 30 ++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/js/src/jit/x86/SharedICHelpers-x86.h b/js/src/jit/x86/SharedICHelpers-x86.h index 1be795ad493b..8ad8a22b315d 100644 --- a/js/src/jit/x86/SharedICHelpers-x86.h +++ b/js/src/jit/x86/SharedICHelpers-x86.h @@ -95,7 +95,15 @@ EmitBaselineTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize) inline void EmitIonTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t stackSize) { - MOZ_CRASH("Not implemented yet."); + masm.movl(Operand(esp, stackSize), eax); + masm.shrl(Imm32(FRAMESIZE_SHIFT), eax); + masm.addl(Imm32(stackSize + JitStubFrameLayout::Size() - sizeof(intptr_t)), eax); + + masm.makeFrameDescriptor(eax, JitFrame_IonJS); + masm.push(eax); + masm.push(ICTailCallReg); + + masm.jmp(target); } inline void @@ -121,7 +129,16 @@ EmitBaselineCallVM(JitCode* target, MacroAssembler& masm) inline void EmitIonCallVM(JitCode* target, size_t stackSlots, MacroAssembler& masm) { - MOZ_CRASH("Not implemented yet."); + uint32_t descriptor = MakeFrameDescriptor(masm.framePushed(), JitFrame_IonStub); + masm.Push(Imm32(descriptor)); + masm.call(target); + + // Remove rest of the frame left on the stack. We remove the return address + // which is implicitly poped when returning. + size_t framePop = sizeof(ExitFrameLayout) - sizeof(void*); + + // Pop arguments from framePushed. + masm.implicitPop(stackSlots * sizeof(void*) + framePop); } // Size of vales pushed by EmitEnterStubFrame. @@ -159,7 +176,11 @@ EmitBaselineEnterStubFrame(MacroAssembler& masm, Register scratch) inline void EmitIonEnterStubFrame(MacroAssembler& masm, Register scratch) { - MOZ_CRASH("Not implemented yet."); + MOZ_ASSERT(scratch != ICTailCallReg); + + masm.pop(ICTailCallReg); + masm.push(ICTailCallReg); + masm.push(ICStubReg); } inline void @@ -192,7 +213,8 @@ EmitBaselineLeaveStubFrame(MacroAssembler& masm, bool calledIntoIon = false) inline void EmitIonLeaveStubFrame(MacroAssembler& masm) { - MOZ_CRASH("Not implemented yet."); + masm.pop(ICStubReg); + masm.pop(ICTailCallReg); } inline void