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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
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 5018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5029 FrameScope frame(masm, StackFrame::MANUAL); | 5029 FrameScope frame(masm, StackFrame::MANUAL); |
5030 __ PushSafepointRegisters(); | 5030 __ PushSafepointRegisters(); |
5031 __ PrepareCallCFunction(1, a0); | 5031 __ PrepareCallCFunction(1, a0); |
5032 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); | 5032 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); |
5033 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), | 5033 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), |
5034 1); | 5034 1); |
5035 __ PopSafepointRegisters(); | 5035 __ PopSafepointRegisters(); |
5036 } | 5036 } |
5037 | 5037 |
5038 Label promote_scheduled_exception; | 5038 Label promote_scheduled_exception; |
5039 Label exception_handled; | |
5040 Label delete_allocated_handles; | 5039 Label delete_allocated_handles; |
5041 Label leave_exit_frame; | 5040 Label leave_exit_frame; |
5042 Label return_value_loaded; | 5041 Label return_value_loaded; |
5043 | 5042 |
5044 // Load value from ReturnValue. | 5043 // Load value from ReturnValue. |
5045 __ lw(v0, return_value_operand); | 5044 __ lw(v0, return_value_operand); |
5046 __ bind(&return_value_loaded); | 5045 __ bind(&return_value_loaded); |
5047 | 5046 |
5048 // No more valid handles (the result handle was the last one). Restore | 5047 // No more valid handles (the result handle was the last one). Restore |
5049 // previous handle scope. | 5048 // previous handle scope. |
5050 __ sw(s0, MemOperand(s3, kNextOffset)); | 5049 __ sw(s0, MemOperand(s3, kNextOffset)); |
5051 if (__ emit_debug_code()) { | 5050 if (__ emit_debug_code()) { |
5052 __ lw(a1, MemOperand(s3, kLevelOffset)); | 5051 __ lw(a1, MemOperand(s3, kLevelOffset)); |
5053 __ Check(eq, kUnexpectedLevelAfterReturnFromApiCall, a1, Operand(s2)); | 5052 __ Check(eq, kUnexpectedLevelAfterReturnFromApiCall, a1, Operand(s2)); |
5054 } | 5053 } |
5055 __ Subu(s2, s2, Operand(1)); | 5054 __ Subu(s2, s2, Operand(1)); |
5056 __ sw(s2, MemOperand(s3, kLevelOffset)); | 5055 __ sw(s2, MemOperand(s3, kLevelOffset)); |
5057 __ lw(at, MemOperand(s3, kLimitOffset)); | 5056 __ lw(at, MemOperand(s3, kLimitOffset)); |
5058 __ Branch(&delete_allocated_handles, ne, s1, Operand(at)); | 5057 __ Branch(&delete_allocated_handles, ne, s1, Operand(at)); |
5059 | 5058 |
5060 // Check if the function scheduled an exception. | 5059 // Leave the API exit frame. |
5061 __ bind(&leave_exit_frame); | 5060 __ bind(&leave_exit_frame); |
5062 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); | |
5063 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate))); | |
5064 __ lw(t1, MemOperand(at)); | |
5065 __ Branch(&promote_scheduled_exception, ne, t0, Operand(t1)); | |
5066 __ bind(&exception_handled); | |
5067 | 5061 |
5068 bool restore_context = context_restore_operand != NULL; | 5062 bool restore_context = context_restore_operand != NULL; |
5069 if (restore_context) { | 5063 if (restore_context) { |
5070 __ lw(cp, *context_restore_operand); | 5064 __ lw(cp, *context_restore_operand); |
5071 } | 5065 } |
5072 if (stack_space_offset != kInvalidStackOffset) { | 5066 if (stack_space_offset != kInvalidStackOffset) { |
5073 // ExitFrame contains four MIPS argument slots after DirectCEntryStub call | 5067 // ExitFrame contains four MIPS argument slots after DirectCEntryStub call |
5074 // so this must be accounted for. | 5068 // so this must be accounted for. |
5075 __ lw(s0, MemOperand(sp, stack_space_offset + kCArgsSlotsSize)); | 5069 __ lw(s0, MemOperand(sp, stack_space_offset + kCArgsSlotsSize)); |
5076 } else { | 5070 } else { |
5077 __ li(s0, Operand(stack_space)); | 5071 __ li(s0, Operand(stack_space)); |
5078 } | 5072 } |
5079 __ LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN, | 5073 __ LeaveExitFrame(false, s0, !restore_context, NO_EMIT_RETURN, |
5080 stack_space_offset != kInvalidStackOffset); | 5074 stack_space_offset != kInvalidStackOffset); |
5081 | 5075 |
| 5076 // Check if the function scheduled an exception. |
| 5077 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); |
| 5078 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate))); |
| 5079 __ lw(t1, MemOperand(at)); |
| 5080 __ Branch(&promote_scheduled_exception, ne, t0, Operand(t1)); |
| 5081 |
| 5082 __ Ret(); |
| 5083 |
| 5084 // Re-throw by promoting a scheduled exception. |
5082 __ bind(&promote_scheduled_exception); | 5085 __ bind(&promote_scheduled_exception); |
5083 { | 5086 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
5084 FrameScope frame(masm, StackFrame::INTERNAL); | |
5085 __ CallExternalReference( | |
5086 ExternalReference(Runtime::kPromoteScheduledException, isolate), 0); | |
5087 } | |
5088 __ jmp(&exception_handled); | |
5089 | 5087 |
5090 // HandleScope limit has changed. Delete allocated extensions. | 5088 // HandleScope limit has changed. Delete allocated extensions. |
5091 __ bind(&delete_allocated_handles); | 5089 __ bind(&delete_allocated_handles); |
5092 __ sw(s1, MemOperand(s3, kLimitOffset)); | 5090 __ sw(s1, MemOperand(s3, kLimitOffset)); |
5093 __ mov(s0, v0); | 5091 __ mov(s0, v0); |
5094 __ mov(a0, v0); | 5092 __ mov(a0, v0); |
5095 __ PrepareCallCFunction(1, s1); | 5093 __ PrepareCallCFunction(1, s1); |
5096 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); | 5094 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); |
5097 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate), | 5095 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate), |
5098 1); | 5096 1); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5266 kStackUnwindSpace, kInvalidStackOffset, | 5264 kStackUnwindSpace, kInvalidStackOffset, |
5267 MemOperand(fp, 6 * kPointerSize), NULL); | 5265 MemOperand(fp, 6 * kPointerSize), NULL); |
5268 } | 5266 } |
5269 | 5267 |
5270 | 5268 |
5271 #undef __ | 5269 #undef __ |
5272 | 5270 |
5273 } } // namespace v8::internal | 5271 } } // namespace v8::internal |
5274 | 5272 |
5275 #endif // V8_TARGET_ARCH_MIPS | 5273 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |