Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index 0aa886bac724a3236d86382c0f7f04558c355f1d..bbb3c0a9e5f27954da67d442a08e7fc81b517e12 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -1118,9 +1118,9 @@ int MacroAssembler::ActivationFrameAlignment() { |
} |
-void MacroAssembler::LeaveExitFrame(bool save_doubles, |
- Register argument_count, |
- bool restore_context) { |
+void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count, |
+ bool restore_context, |
+ bool argument_count_is_length) { |
ConstantPoolUnavailableScope constant_pool_unavailable(this); |
// Optionally restore all double registers. |
@@ -1154,7 +1154,11 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles, |
mov(sp, Operand(fp)); |
ldm(ia_w, sp, fp.bit() | lr.bit()); |
if (argument_count.is_valid()) { |
- add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
+ if (argument_count_is_length) { |
+ add(sp, sp, argument_count); |
+ } else { |
+ add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
+ } |
} |
} |
@@ -2363,10 +2367,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()); |
@@ -2464,8 +2466,12 @@ void MacroAssembler::CallApiFunctionAndReturn( |
ldr(cp, *context_restore_operand); |
} |
// LeaveExitFrame expects unwind space to be in a register. |
- mov(r4, Operand(stack_space)); |
- LeaveExitFrame(false, r4, !restore_context); |
+ if (stack_space_operand != NULL) { |
+ ldr(r4, *stack_space_operand); |
+ } else { |
+ mov(r4, Operand(stack_space)); |
+ } |
+ LeaveExitFrame(false, r4, !restore_context, stack_space_operand != NULL); |
mov(pc, lr); |
bind(&promote_scheduled_exception); |