Bug 1201810, IonMonkey - Part 0: Improve code of EmitIonTailCallVM, r=jandem

This commit is contained in:
Hannes Verschore 2015-09-10 14:02:22 +02:00
parent 57b5b58c47
commit dc63c8e3a7
2 changed files with 13 additions and 3 deletions

View File

@ -94,9 +94,14 @@ EmitBaselineTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize)
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);

View File

@ -95,14 +95,19 @@ EmitBaselineTailCallVM(JitCode* target, MacroAssembler& masm, uint32_t argSize)
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);
}