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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 5063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5074 FrameScope frame(masm, StackFrame::MANUAL); | 5074 FrameScope frame(masm, StackFrame::MANUAL); |
5075 __ PushSafepointRegisters(); | 5075 __ PushSafepointRegisters(); |
5076 __ PrepareCallCFunction(1, a0); | 5076 __ PrepareCallCFunction(1, a0); |
5077 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); | 5077 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); |
5078 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), | 5078 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), |
5079 1); | 5079 1); |
5080 __ PopSafepointRegisters(); | 5080 __ PopSafepointRegisters(); |
5081 } | 5081 } |
5082 | 5082 |
5083 Label promote_scheduled_exception; | 5083 Label promote_scheduled_exception; |
5084 Label exception_handled; | |
5085 Label delete_allocated_handles; | 5084 Label delete_allocated_handles; |
5086 Label leave_exit_frame; | 5085 Label leave_exit_frame; |
5087 Label return_value_loaded; | 5086 Label return_value_loaded; |
5088 | 5087 |
5089 // Load value from ReturnValue. | 5088 // Load value from ReturnValue. |
5090 __ ld(v0, return_value_operand); | 5089 __ ld(v0, return_value_operand); |
5091 __ bind(&return_value_loaded); | 5090 __ bind(&return_value_loaded); |
5092 | 5091 |
5093 // No more valid handles (the result handle was the last one). Restore | 5092 // No more valid handles (the result handle was the last one). Restore |
5094 // previous handle scope. | 5093 // previous handle scope. |
5095 __ sd(s0, MemOperand(s3, kNextOffset)); | 5094 __ sd(s0, MemOperand(s3, kNextOffset)); |
5096 if (__ emit_debug_code()) { | 5095 if (__ emit_debug_code()) { |
5097 __ ld(a1, MemOperand(s3, kLevelOffset)); | 5096 __ ld(a1, MemOperand(s3, kLevelOffset)); |
5098 __ Check(eq, kUnexpectedLevelAfterReturnFromApiCall, a1, Operand(s2)); | 5097 __ Check(eq, kUnexpectedLevelAfterReturnFromApiCall, a1, Operand(s2)); |
5099 } | 5098 } |
5100 __ Dsubu(s2, s2, Operand(1)); | 5099 __ Dsubu(s2, s2, Operand(1)); |
5101 __ sd(s2, MemOperand(s3, kLevelOffset)); | 5100 __ sd(s2, MemOperand(s3, kLevelOffset)); |
5102 __ ld(at, MemOperand(s3, kLimitOffset)); | 5101 __ ld(at, MemOperand(s3, kLimitOffset)); |
5103 __ Branch(&delete_allocated_handles, ne, s1, Operand(at)); | 5102 __ Branch(&delete_allocated_handles, ne, s1, Operand(at)); |
5104 | 5103 |
5105 // Check if the function scheduled an exception. | 5104 // Leave the API exit frame. |
5106 __ bind(&leave_exit_frame); | 5105 __ bind(&leave_exit_frame); |
5107 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); | |
5108 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate))); | |
5109 __ ld(a5, MemOperand(at)); | |
5110 __ Branch(&promote_scheduled_exception, ne, a4, Operand(a5)); | |
5111 __ bind(&exception_handled); | |
5112 | 5106 |
5113 bool restore_context = context_restore_operand != NULL; | 5107 bool restore_context = context_restore_operand != NULL; |
5114 if (restore_context) { | 5108 if (restore_context) { |
5115 __ ld(cp, *context_restore_operand); | 5109 __ ld(cp, *context_restore_operand); |
5116 } | 5110 } |
5117 if (stack_space_offset != kInvalidStackOffset) { | 5111 if (stack_space_offset != kInvalidStackOffset) { |
5118 DCHECK(kCArgsSlotsSize == 0); | 5112 DCHECK(kCArgsSlotsSize == 0); |
5119 __ ld(s0, MemOperand(sp, stack_space_offset)); | 5113 __ ld(s0, MemOperand(sp, stack_space_offset)); |
5120 } else { | 5114 } else { |
5121 __ li(s0, Operand(stack_space)); | 5115 __ li(s0, Operand(stack_space)); |
5122 } | 5116 } |
5123 __ LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN, | 5117 __ LeaveExitFrame(false, s0, !restore_context, NO_EMIT_RETURN, |
5124 stack_space_offset != kInvalidStackOffset); | 5118 stack_space_offset != kInvalidStackOffset); |
| 5119 |
| 5120 // Check if the function scheduled an exception. |
| 5121 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); |
| 5122 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate))); |
| 5123 __ ld(a5, MemOperand(at)); |
| 5124 __ Branch(&promote_scheduled_exception, ne, a4, Operand(a5)); |
| 5125 |
| 5126 __ Ret(); |
| 5127 |
| 5128 // Re-throw by promoting a scheduled exception. |
5125 __ bind(&promote_scheduled_exception); | 5129 __ bind(&promote_scheduled_exception); |
5126 { | 5130 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
5127 FrameScope frame(masm, StackFrame::INTERNAL); | |
5128 __ CallExternalReference( | |
5129 ExternalReference(Runtime::kPromoteScheduledException, isolate), 0); | |
5130 } | |
5131 __ jmp(&exception_handled); | |
5132 | 5131 |
5133 // HandleScope limit has changed. Delete allocated extensions. | 5132 // HandleScope limit has changed. Delete allocated extensions. |
5134 __ bind(&delete_allocated_handles); | 5133 __ bind(&delete_allocated_handles); |
5135 __ sd(s1, MemOperand(s3, kLimitOffset)); | 5134 __ sd(s1, MemOperand(s3, kLimitOffset)); |
5136 __ mov(s0, v0); | 5135 __ mov(s0, v0); |
5137 __ mov(a0, v0); | 5136 __ mov(a0, v0); |
5138 __ PrepareCallCFunction(1, s1); | 5137 __ PrepareCallCFunction(1, s1); |
5139 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); | 5138 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); |
5140 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate), | 5139 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate), |
5141 1); | 5140 1); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5309 kStackUnwindSpace, kInvalidStackOffset, | 5308 kStackUnwindSpace, kInvalidStackOffset, |
5310 MemOperand(fp, 6 * kPointerSize), NULL); | 5309 MemOperand(fp, 6 * kPointerSize), NULL); |
5311 } | 5310 } |
5312 | 5311 |
5313 | 5312 |
5314 #undef __ | 5313 #undef __ |
5315 | 5314 |
5316 } } // namespace v8::internal | 5315 } } // namespace v8::internal |
5317 | 5316 |
5318 #endif // V8_TARGET_ARCH_MIPS64 | 5317 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |