OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 4795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4806 FrameScope frame(masm, StackFrame::MANUAL); | 4806 FrameScope frame(masm, StackFrame::MANUAL); |
4807 __ PushSafepointRegisters(); | 4807 __ PushSafepointRegisters(); |
4808 __ PrepareCallCFunction(1, r0); | 4808 __ PrepareCallCFunction(1, r0); |
4809 __ mov(r0, Operand(ExternalReference::isolate_address(isolate))); | 4809 __ mov(r0, Operand(ExternalReference::isolate_address(isolate))); |
4810 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), | 4810 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), |
4811 1); | 4811 1); |
4812 __ PopSafepointRegisters(); | 4812 __ PopSafepointRegisters(); |
4813 } | 4813 } |
4814 | 4814 |
4815 Label promote_scheduled_exception; | 4815 Label promote_scheduled_exception; |
4816 Label exception_handled; | |
4817 Label delete_allocated_handles; | 4816 Label delete_allocated_handles; |
4818 Label leave_exit_frame; | 4817 Label leave_exit_frame; |
4819 Label return_value_loaded; | 4818 Label return_value_loaded; |
4820 | 4819 |
4821 // load value from ReturnValue | 4820 // load value from ReturnValue |
4822 __ ldr(r0, return_value_operand); | 4821 __ ldr(r0, return_value_operand); |
4823 __ bind(&return_value_loaded); | 4822 __ bind(&return_value_loaded); |
4824 // No more valid handles (the result handle was the last one). Restore | 4823 // No more valid handles (the result handle was the last one). Restore |
4825 // previous handle scope. | 4824 // previous handle scope. |
4826 __ str(r4, MemOperand(r9, kNextOffset)); | 4825 __ str(r4, MemOperand(r9, kNextOffset)); |
4827 if (__ emit_debug_code()) { | 4826 if (__ emit_debug_code()) { |
4828 __ ldr(r1, MemOperand(r9, kLevelOffset)); | 4827 __ ldr(r1, MemOperand(r9, kLevelOffset)); |
4829 __ cmp(r1, r6); | 4828 __ cmp(r1, r6); |
4830 __ Check(eq, kUnexpectedLevelAfterReturnFromApiCall); | 4829 __ Check(eq, kUnexpectedLevelAfterReturnFromApiCall); |
4831 } | 4830 } |
4832 __ sub(r6, r6, Operand(1)); | 4831 __ sub(r6, r6, Operand(1)); |
4833 __ str(r6, MemOperand(r9, kLevelOffset)); | 4832 __ str(r6, MemOperand(r9, kLevelOffset)); |
4834 __ ldr(ip, MemOperand(r9, kLimitOffset)); | 4833 __ ldr(ip, MemOperand(r9, kLimitOffset)); |
4835 __ cmp(r5, ip); | 4834 __ cmp(r5, ip); |
4836 __ b(ne, &delete_allocated_handles); | 4835 __ b(ne, &delete_allocated_handles); |
4837 | 4836 |
4838 // Check if the function scheduled an exception. | 4837 // Leave the API exit frame. |
4839 __ bind(&leave_exit_frame); | 4838 __ bind(&leave_exit_frame); |
4840 __ LoadRoot(r4, Heap::kTheHoleValueRootIndex); | |
4841 __ mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate))); | |
4842 __ ldr(r5, MemOperand(ip)); | |
4843 __ cmp(r4, r5); | |
4844 __ b(ne, &promote_scheduled_exception); | |
4845 __ bind(&exception_handled); | |
4846 | |
4847 bool restore_context = context_restore_operand != NULL; | 4839 bool restore_context = context_restore_operand != NULL; |
4848 if (restore_context) { | 4840 if (restore_context) { |
4849 __ ldr(cp, *context_restore_operand); | 4841 __ ldr(cp, *context_restore_operand); |
4850 } | 4842 } |
4851 // LeaveExitFrame expects unwind space to be in a register. | 4843 // LeaveExitFrame expects unwind space to be in a register. |
4852 if (stack_space_operand != NULL) { | 4844 if (stack_space_operand != NULL) { |
4853 __ ldr(r4, *stack_space_operand); | 4845 __ ldr(r4, *stack_space_operand); |
4854 } else { | 4846 } else { |
4855 __ mov(r4, Operand(stack_space)); | 4847 __ mov(r4, Operand(stack_space)); |
4856 } | 4848 } |
4857 __ LeaveExitFrame(false, r4, !restore_context, stack_space_operand != NULL); | 4849 __ LeaveExitFrame(false, r4, !restore_context, stack_space_operand != NULL); |
| 4850 |
| 4851 // Check if the function scheduled an exception. |
| 4852 __ LoadRoot(r4, Heap::kTheHoleValueRootIndex); |
| 4853 __ mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate))); |
| 4854 __ ldr(r5, MemOperand(ip)); |
| 4855 __ cmp(r4, r5); |
| 4856 __ b(ne, &promote_scheduled_exception); |
| 4857 |
4858 __ mov(pc, lr); | 4858 __ mov(pc, lr); |
4859 | 4859 |
| 4860 // Re-throw by promoting a scheduled exception. |
4860 __ bind(&promote_scheduled_exception); | 4861 __ bind(&promote_scheduled_exception); |
4861 { | 4862 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
4862 FrameScope frame(masm, StackFrame::INTERNAL); | |
4863 __ CallExternalReference( | |
4864 ExternalReference(Runtime::kPromoteScheduledException, isolate), 0); | |
4865 } | |
4866 __ jmp(&exception_handled); | |
4867 | 4863 |
4868 // HandleScope limit has changed. Delete allocated extensions. | 4864 // HandleScope limit has changed. Delete allocated extensions. |
4869 __ bind(&delete_allocated_handles); | 4865 __ bind(&delete_allocated_handles); |
4870 __ str(r5, MemOperand(r9, kLimitOffset)); | 4866 __ str(r5, MemOperand(r9, kLimitOffset)); |
4871 __ mov(r4, r0); | 4867 __ mov(r4, r0); |
4872 __ PrepareCallCFunction(1, r5); | 4868 __ PrepareCallCFunction(1, r5); |
4873 __ mov(r0, Operand(ExternalReference::isolate_address(isolate))); | 4869 __ mov(r0, Operand(ExternalReference::isolate_address(isolate))); |
4874 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate), | 4870 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate), |
4875 1); | 4871 1); |
4876 __ mov(r0, r4); | 4872 __ mov(r0, r4); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5054 kStackUnwindSpace, NULL, | 5050 kStackUnwindSpace, NULL, |
5055 MemOperand(fp, 6 * kPointerSize), NULL); | 5051 MemOperand(fp, 6 * kPointerSize), NULL); |
5056 } | 5052 } |
5057 | 5053 |
5058 | 5054 |
5059 #undef __ | 5055 #undef __ |
5060 | 5056 |
5061 } } // namespace v8::internal | 5057 } } // namespace v8::internal |
5062 | 5058 |
5063 #endif // V8_TARGET_ARCH_ARM | 5059 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |