Index: src/mips64/macro-assembler-mips64.cc |
diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc |
index 2de1c2a1a9edf33c66a4497c3b63759018a9d7e3..f011454d484d8fdcfd5f227add33dc0ed5ca3857 100644 |
--- a/src/mips64/macro-assembler-mips64.cc |
+++ b/src/mips64/macro-assembler-mips64.cc |
@@ -4367,10 +4367,8 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
void MacroAssembler::CallApiFunctionAndReturn( |
- Register function_address, |
- ExternalReference thunk_ref, |
- int stack_space, |
- MemOperand return_value_operand, |
+ Register function_address, ExternalReference thunk_ref, int stack_space, |
+ MemOperand* stack_space_operand, MemOperand return_value_operand, |
MemOperand* context_restore_operand) { |
ExternalReference next_address = |
ExternalReference::handle_scope_next_address(isolate()); |
@@ -4464,9 +4462,13 @@ void MacroAssembler::CallApiFunctionAndReturn( |
if (restore_context) { |
ld(cp, *context_restore_operand); |
} |
- li(s0, Operand(stack_space)); |
- LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN); |
- |
+ if (stack_space_operand != NULL) { |
+ lw(s0, *stack_space_operand); |
+ } else { |
+ li(s0, Operand(stack_space)); |
+ } |
+ LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN, |
+ stack_space_operand != NULL); |
bind(&promote_scheduled_exception); |
{ |
FrameScope frame(this, StackFrame::INTERNAL); |
@@ -5116,10 +5118,9 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, |
} |
-void MacroAssembler::LeaveExitFrame(bool save_doubles, |
- Register argument_count, |
- bool restore_context, |
- bool do_return) { |
+void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count, |
+ bool restore_context, bool do_return, |
+ bool argument_count_is_length) { |
// Optionally restore all double registers. |
if (save_doubles) { |
// Remember: we only need to restore every 2nd double FPU value. |
@@ -5152,8 +5153,12 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles, |
ld(ra, MemOperand(sp, ExitFrameConstants::kCallerPCOffset)); |
if (argument_count.is_valid()) { |
- dsll(t8, argument_count, kPointerSizeLog2); |
- daddu(sp, sp, t8); |
+ if (argument_count_is_length) { |
+ daddu(sp, sp, argument_count); |
+ } else { |
+ dsll(t8, argument_count, kPointerSizeLog2); |
+ daddu(sp, sp, t8); |
+ } |
} |
if (do_return) { |