Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index e11ae1cc6ec14bd20081ecc5a8808571b846bfdb..31ffbf1e49010e8eaec1263510fe0930a6db85c2 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -2361,141 +2361,6 @@ void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { |
} |
-static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
- return ref0.address() - ref1.address(); |
-} |
- |
- |
-void MacroAssembler::CallApiFunctionAndReturn( |
- 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()); |
- const int kNextOffset = 0; |
- const int kLimitOffset = AddressOffset( |
- ExternalReference::handle_scope_limit_address(isolate()), |
- next_address); |
- const int kLevelOffset = AddressOffset( |
- ExternalReference::handle_scope_level_address(isolate()), |
- next_address); |
- |
- DCHECK(function_address.is(r1) || function_address.is(r2)); |
- |
- Label profiler_disabled; |
- Label end_profiler_check; |
- mov(r9, Operand(ExternalReference::is_profiling_address(isolate()))); |
- ldrb(r9, MemOperand(r9, 0)); |
- cmp(r9, Operand(0)); |
- b(eq, &profiler_disabled); |
- |
- // Additional parameter is the address of the actual callback. |
- mov(r3, Operand(thunk_ref)); |
- jmp(&end_profiler_check); |
- |
- bind(&profiler_disabled); |
- Move(r3, function_address); |
- bind(&end_profiler_check); |
- |
- // Allocate HandleScope in callee-save registers. |
- mov(r9, Operand(next_address)); |
- ldr(r4, MemOperand(r9, kNextOffset)); |
- ldr(r5, MemOperand(r9, kLimitOffset)); |
- ldr(r6, MemOperand(r9, kLevelOffset)); |
- add(r6, r6, Operand(1)); |
- str(r6, MemOperand(r9, kLevelOffset)); |
- |
- if (FLAG_log_timer_events) { |
- FrameScope frame(this, StackFrame::MANUAL); |
- PushSafepointRegisters(); |
- PrepareCallCFunction(1, r0); |
- mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
- CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); |
- PopSafepointRegisters(); |
- } |
- |
- // Native call returns to the DirectCEntry stub which redirects to the |
- // return address pushed on stack (could have moved after GC). |
- // DirectCEntry stub itself is generated early and never moves. |
- DirectCEntryStub stub(isolate()); |
- stub.GenerateCall(this, r3); |
- |
- if (FLAG_log_timer_events) { |
- FrameScope frame(this, StackFrame::MANUAL); |
- PushSafepointRegisters(); |
- PrepareCallCFunction(1, r0); |
- mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
- CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); |
- PopSafepointRegisters(); |
- } |
- |
- Label promote_scheduled_exception; |
- Label exception_handled; |
- Label delete_allocated_handles; |
- Label leave_exit_frame; |
- Label return_value_loaded; |
- |
- // load value from ReturnValue |
- ldr(r0, return_value_operand); |
- bind(&return_value_loaded); |
- // No more valid handles (the result handle was the last one). Restore |
- // previous handle scope. |
- str(r4, MemOperand(r9, kNextOffset)); |
- if (emit_debug_code()) { |
- ldr(r1, MemOperand(r9, kLevelOffset)); |
- cmp(r1, r6); |
- Check(eq, kUnexpectedLevelAfterReturnFromApiCall); |
- } |
- sub(r6, r6, Operand(1)); |
- str(r6, MemOperand(r9, kLevelOffset)); |
- ldr(ip, MemOperand(r9, kLimitOffset)); |
- cmp(r5, ip); |
- b(ne, &delete_allocated_handles); |
- |
- // Check if the function scheduled an exception. |
- bind(&leave_exit_frame); |
- LoadRoot(r4, Heap::kTheHoleValueRootIndex); |
- mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate()))); |
- ldr(r5, MemOperand(ip)); |
- cmp(r4, r5); |
- b(ne, &promote_scheduled_exception); |
- bind(&exception_handled); |
- |
- bool restore_context = context_restore_operand != NULL; |
- if (restore_context) { |
- ldr(cp, *context_restore_operand); |
- } |
- // LeaveExitFrame expects unwind space to be in a register. |
- 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); |
- { |
- FrameScope frame(this, StackFrame::INTERNAL); |
- CallExternalReference( |
- ExternalReference(Runtime::kPromoteScheduledException, isolate()), |
- 0); |
- } |
- jmp(&exception_handled); |
- |
- // HandleScope limit has changed. Delete allocated extensions. |
- bind(&delete_allocated_handles); |
- str(r5, MemOperand(r9, kLimitOffset)); |
- mov(r4, r0); |
- PrepareCallCFunction(1, r5); |
- mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
- CallCFunction( |
- ExternalReference::delete_handle_scope_extensions(isolate()), 1); |
- mov(r0, r4); |
- jmp(&leave_exit_frame); |
-} |
- |
- |
bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { |
return has_frame_ || !stub->SometimesSetsUpAFrame(); |
} |