Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index dc6ddf9f7e41595e10b58c033e04fdc4cd958e93..242f7493401e86cb96bf214a2dde9eb071e52268 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -415,11 +415,23 @@ Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
} |
+static int ArgumentsOffsetWithoutFrame(int index) { |
+ ASSERT(index < 0); |
+ return -(index + 1) * kPointerSize + kPCOnStackSize; |
+} |
+ |
+ |
Operand LCodeGen::ToOperand(LOperand* op) const { |
// Does not handle registers. In X64 assembler, plain registers are not |
// representable as an Operand. |
ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
- return Operand(rbp, StackSlotOffset(op->index())); |
+ if (NeedsEagerFrame()) { |
+ return Operand(rbp, StackSlotOffset(op->index())); |
+ } else { |
+ // Retrieve parameter without eager stack-frame relative to the |
+ // stack-pointer. |
+ return Operand(rsp, ArgumentsOffsetWithoutFrame(op->index())); |
+ } |
} |
@@ -3910,7 +3922,12 @@ void LCodeGen::DoCallFunction(LCallFunction* instr) { |
int arity = instr->arity(); |
CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
- CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
+ if (instr->hydrogen()->IsTailCall()) { |
+ if (NeedsEagerFrame()) __ leave(); |
+ __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
+ } else { |
+ CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
+ } |
} |