Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 5eb15b725bfd9a15ba11afa60e1c7a018317851f..5d06c60bebf10999bfd304b70b8d495c8b239aa9 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -2558,10 +2558,16 @@ void LCodeGen::DoReturn(LReturn* instr) { |
__ movq(rsp, rbp); |
__ pop(rbp); |
} |
- if (info()->IsStub()) { |
- __ Ret(0, r10); |
+ if (instr->has_constant_parameter_count()) { |
+ __ Ret((ToInteger32(instr->constant_parameter_count()) + 1) * kPointerSize, |
+ rcx); |
} else { |
- __ Ret((GetParameterCount() + 1) * kPointerSize, rcx); |
+ Register reg = ToRegister(instr->parameter_count()); |
+ Register return_addr_reg = reg.is(rcx) ? rbx : rcx; |
+ __ pop(return_addr_reg); |
+ __ shl(reg, Immediate(kPointerSizeLog2)); |
+ __ addq(rsp, reg); |
+ __ jmp(return_addr_reg); |
} |
} |