Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index 4ff379138bd47013b09e19a0188f052078718b32..fa8cf18fe1365e4fcfeec7b87351020f1912a844 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -691,16 +691,13 @@ void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) { |
} |
-void MacroAssembler::CallApiFunctionAndReturn( |
- Address function_address, |
- Address thunk_address, |
- Register thunk_last_arg, |
- int stack_space, |
- Operand return_value_operand, |
- Operand* context_restore_operand) { |
+void MacroAssembler::CallApiFunctionAndReturn(Address function_address, |
+ Address thunk_address, |
+ Register thunk_last_arg, |
+ int stack_space, |
+ int return_value_offset) { |
Label prologue; |
Label promote_scheduled_exception; |
- Label exception_handled; |
Label delete_allocated_handles; |
Label leave_exit_frame; |
Label write_back; |
@@ -771,7 +768,7 @@ void MacroAssembler::CallApiFunctionAndReturn( |
} |
// Load the value from ReturnValue |
- movq(rax, return_value_operand); |
+ movq(rax, Operand(rbp, return_value_offset * kPointerSize)); |
bind(&prologue); |
// No more valid handles (the result handle was the last one). Restore |
@@ -786,7 +783,6 @@ void MacroAssembler::CallApiFunctionAndReturn( |
movq(rsi, scheduled_exception_address); |
Cmp(Operand(rsi, 0), factory->the_hole_value()); |
j(not_equal, &promote_scheduled_exception); |
- bind(&exception_handled); |
#if ENABLE_EXTRA_CHECKS |
// Check if the function returned a valid JavaScript value. |
@@ -823,16 +819,11 @@ void MacroAssembler::CallApiFunctionAndReturn( |
bind(&ok); |
#endif |
- bool restore_context = context_restore_operand != NULL; |
- if (restore_context) { |
- movq(rsi, *context_restore_operand); |
- } |
- LeaveApiExitFrame(!restore_context); |
+ LeaveApiExitFrame(); |
ret(stack_space * kPointerSize); |
bind(&promote_scheduled_exception); |
- CallRuntime(Runtime::kPromoteScheduledException, 0); |
- jmp(&exception_handled); |
+ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
// HandleScope limit has changed. Delete allocated extensions. |
bind(&delete_allocated_handles); |
@@ -3704,25 +3695,23 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles) { |
PushReturnAddressFrom(rcx); |
- LeaveExitFrameEpilogue(true); |
+ LeaveExitFrameEpilogue(); |
} |
-void MacroAssembler::LeaveApiExitFrame(bool restore_context) { |
+void MacroAssembler::LeaveApiExitFrame() { |
movq(rsp, rbp); |
pop(rbp); |
- LeaveExitFrameEpilogue(restore_context); |
+ LeaveExitFrameEpilogue(); |
} |
-void MacroAssembler::LeaveExitFrameEpilogue(bool restore_context) { |
+void MacroAssembler::LeaveExitFrameEpilogue() { |
// Restore current context from top and clear it in debug mode. |
ExternalReference context_address(Isolate::kContextAddress, isolate()); |
Operand context_operand = ExternalOperand(context_address); |
- if (restore_context) { |
- movq(rsi, context_operand); |
- } |
+ movq(rsi, context_operand); |
#ifdef DEBUG |
movq(context_operand, Immediate(0)); |
#endif |