Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 50e42272a7c123ffc9853da4bbf0a2432c27e6ae..65c398dc65267c7ad5d27376c4869eff1c84098e 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -4845,13 +4845,10 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
// from handle and propagates exceptions. Restores context. stack_space |
// - space to be unwound on exit (includes the call JS arguments space and |
// the additional space allocated for the fast call). |
-static void CallApiFunctionAndReturn(MacroAssembler* masm, |
- Register function_address, |
- ExternalReference thunk_ref, |
- int stack_space, |
- MemOperand* stack_space_operand, |
- MemOperand return_value_operand, |
- MemOperand* context_restore_operand) { |
+static void CallApiFunctionAndReturn( |
+ MacroAssembler* masm, Register function_address, |
+ ExternalReference thunk_ref, int stack_space, int32_t stack_space_offset, |
+ MemOperand return_value_operand, MemOperand* context_restore_operand) { |
Isolate* isolate = masm->isolate(); |
ExternalReference next_address = |
ExternalReference::handle_scope_next_address(isolate); |
@@ -4945,13 +4942,15 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm, |
if (restore_context) { |
__ lw(cp, *context_restore_operand); |
} |
- if (stack_space_operand != NULL) { |
- __ lw(s0, *stack_space_operand); |
+ if (stack_space_offset != kInvalidStackOffset) { |
+ // ExitFrame contains four MIPS argument slots after DirectCEntryStub call |
+ // so this must be accounted for. |
+ __ lw(s0, MemOperand(sp, stack_space_offset + kCArgsSlotsSize)); |
} else { |
__ li(s0, Operand(stack_space)); |
} |
__ LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN, |
- stack_space_operand != NULL); |
+ stack_space_offset != kInvalidStackOffset); |
__ bind(&promote_scheduled_exception); |
{ |
@@ -5082,15 +5081,13 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm, |
} |
MemOperand return_value_operand(fp, return_value_offset * kPointerSize); |
int stack_space = 0; |
- MemOperand is_construct_call_operand = |
- MemOperand(sp, 4 * kPointerSize + kCArgsSlotsSize); |
- MemOperand* stack_space_operand = &is_construct_call_operand; |
+ int32_t stack_space_offset = 4 * kPointerSize; |
if (argc.is_immediate()) { |
stack_space = argc.immediate() + FCA::kArgsLength + 1; |
- stack_space_operand = NULL; |
+ stack_space_offset = kInvalidStackOffset; |
} |
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
- stack_space_operand, return_value_operand, |
+ stack_space_offset, return_value_operand, |
&context_restore_operand); |
} |
@@ -5139,7 +5136,7 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) { |
ExternalReference thunk_ref = |
ExternalReference::invoke_accessor_getter_callback(isolate()); |
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
- kStackUnwindSpace, NULL, |
+ kStackUnwindSpace, kInvalidStackOffset, |
MemOperand(fp, 6 * kPointerSize), NULL); |
} |