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 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 } | 1166 } |
1167 | 1167 |
1168 // Retrieve the handler context, SP and FP. | 1168 // Retrieve the handler context, SP and FP. |
1169 __ li(cp, Operand(pending_handler_context_address)); | 1169 __ li(cp, Operand(pending_handler_context_address)); |
1170 __ ld(cp, MemOperand(cp)); | 1170 __ ld(cp, MemOperand(cp)); |
1171 __ li(sp, Operand(pending_handler_sp_address)); | 1171 __ li(sp, Operand(pending_handler_sp_address)); |
1172 __ ld(sp, MemOperand(sp)); | 1172 __ ld(sp, MemOperand(sp)); |
1173 __ li(fp, Operand(pending_handler_fp_address)); | 1173 __ li(fp, Operand(pending_handler_fp_address)); |
1174 __ ld(fp, MemOperand(fp)); | 1174 __ ld(fp, MemOperand(fp)); |
1175 | 1175 |
1176 // If the handler is a JS frame, restore the context to the frame. | 1176 // If the handler is a JS frame, restore the context to the frame. Note that |
1177 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp | 1177 // the context will be set to (cp == 0) for non-JS frames. |
1178 // or cp. | |
1179 Label zero; | 1178 Label zero; |
1180 __ Branch(&zero, eq, cp, Operand(zero_reg)); | 1179 __ Branch(&zero, eq, cp, Operand(zero_reg)); |
1181 __ sd(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1180 __ sd(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
1182 __ bind(&zero); | 1181 __ bind(&zero); |
1183 | 1182 |
1184 // Compute the handler entry address and jump to it. | 1183 // Compute the handler entry address and jump to it. |
1185 __ li(a1, Operand(pending_handler_code_address)); | 1184 __ li(a1, Operand(pending_handler_code_address)); |
1186 __ ld(a1, MemOperand(a1)); | 1185 __ ld(a1, MemOperand(a1)); |
1187 __ li(a2, Operand(pending_handler_offset_address)); | 1186 __ li(a2, Operand(pending_handler_offset_address)); |
1188 __ ld(a2, MemOperand(a2)); | 1187 __ ld(a2, MemOperand(a2)); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 __ bind(&cont); | 1273 __ bind(&cont); |
1275 __ push(a4); | 1274 __ push(a4); |
1276 | 1275 |
1277 // Jump to a faked try block that does the invoke, with a faked catch | 1276 // Jump to a faked try block that does the invoke, with a faked catch |
1278 // block that sets the pending exception. | 1277 // block that sets the pending exception. |
1279 __ jmp(&invoke); | 1278 __ jmp(&invoke); |
1280 __ bind(&handler_entry); | 1279 __ bind(&handler_entry); |
1281 handler_offset_ = handler_entry.pos(); | 1280 handler_offset_ = handler_entry.pos(); |
1282 // Caught exception: Store result (exception) in the pending exception | 1281 // Caught exception: Store result (exception) in the pending exception |
1283 // field in the JSEnv and return a failure sentinel. Coming in here the | 1282 // field in the JSEnv and return a failure sentinel. Coming in here the |
1284 // fp will be invalid because the PushTryHandler below sets it to 0 to | 1283 // fp will be invalid because the PushStackHandler below sets it to 0 to |
1285 // signal the existence of the JSEntry frame. | 1284 // signal the existence of the JSEntry frame. |
1286 __ li(a4, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1285 __ li(a4, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
1287 isolate))); | 1286 isolate))); |
1288 __ sd(v0, MemOperand(a4)); // We come back from 'invoke'. result is in v0. | 1287 __ sd(v0, MemOperand(a4)); // We come back from 'invoke'. result is in v0. |
1289 __ LoadRoot(v0, Heap::kExceptionRootIndex); | 1288 __ LoadRoot(v0, Heap::kExceptionRootIndex); |
1290 __ b(&exit); // b exposes branch delay slot. | 1289 __ b(&exit); // b exposes branch delay slot. |
1291 __ nop(); // Branch delay slot nop. | 1290 __ nop(); // Branch delay slot nop. |
1292 | 1291 |
1293 // Invoke: Link this frame into the handler chain. There's only one | 1292 // Invoke: Link this frame into the handler chain. |
1294 // handler block in this code object, so its index is 0. | |
1295 __ bind(&invoke); | 1293 __ bind(&invoke); |
1296 __ PushTryHandler(StackHandler::JS_ENTRY, 0); | 1294 __ PushStackHandler(); |
1297 // If an exception not caught by another handler occurs, this handler | 1295 // If an exception not caught by another handler occurs, this handler |
1298 // returns control to the code after the bal(&invoke) above, which | 1296 // returns control to the code after the bal(&invoke) above, which |
1299 // restores all kCalleeSaved registers (including cp and fp) to their | 1297 // restores all kCalleeSaved registers (including cp and fp) to their |
1300 // saved values before returning a failure to C. | 1298 // saved values before returning a failure to C. |
1301 | 1299 |
1302 // Clear any pending exceptions. | 1300 // Clear any pending exceptions. |
1303 __ LoadRoot(a5, Heap::kTheHoleValueRootIndex); | 1301 __ LoadRoot(a5, Heap::kTheHoleValueRootIndex); |
1304 __ li(a4, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1302 __ li(a4, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
1305 isolate))); | 1303 isolate))); |
1306 __ sd(a5, MemOperand(a4)); | 1304 __ sd(a5, MemOperand(a4)); |
(...skipping 23 matching lines...) Expand all Loading... |
1330 } else { | 1328 } else { |
1331 ExternalReference entry(Builtins::kJSEntryTrampoline, masm->isolate()); | 1329 ExternalReference entry(Builtins::kJSEntryTrampoline, masm->isolate()); |
1332 __ li(a4, Operand(entry)); | 1330 __ li(a4, Operand(entry)); |
1333 } | 1331 } |
1334 __ ld(t9, MemOperand(a4)); // Deref address. | 1332 __ ld(t9, MemOperand(a4)); // Deref address. |
1335 // Call JSEntryTrampoline. | 1333 // Call JSEntryTrampoline. |
1336 __ daddiu(t9, t9, Code::kHeaderSize - kHeapObjectTag); | 1334 __ daddiu(t9, t9, Code::kHeaderSize - kHeapObjectTag); |
1337 __ Call(t9); | 1335 __ Call(t9); |
1338 | 1336 |
1339 // Unlink this frame from the handler chain. | 1337 // Unlink this frame from the handler chain. |
1340 __ PopTryHandler(); | 1338 __ PopStackHandler(); |
1341 | 1339 |
1342 __ bind(&exit); // v0 holds result | 1340 __ bind(&exit); // v0 holds result |
1343 // Check if the current stack frame is marked as the outermost JS frame. | 1341 // Check if the current stack frame is marked as the outermost JS frame. |
1344 Label non_outermost_js_2; | 1342 Label non_outermost_js_2; |
1345 __ pop(a5); | 1343 __ pop(a5); |
1346 __ Branch(&non_outermost_js_2, | 1344 __ Branch(&non_outermost_js_2, |
1347 ne, | 1345 ne, |
1348 a5, | 1346 a5, |
1349 Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 1347 Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
1350 __ li(a5, Operand(ExternalReference(js_entry_sp))); | 1348 __ li(a5, Operand(ExternalReference(js_entry_sp))); |
(...skipping 4194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5545 kStackUnwindSpace, kInvalidStackOffset, | 5543 kStackUnwindSpace, kInvalidStackOffset, |
5546 MemOperand(fp, 6 * kPointerSize), NULL); | 5544 MemOperand(fp, 6 * kPointerSize), NULL); |
5547 } | 5545 } |
5548 | 5546 |
5549 | 5547 |
5550 #undef __ | 5548 #undef __ |
5551 | 5549 |
5552 } } // namespace v8::internal | 5550 } } // namespace v8::internal |
5553 | 5551 |
5554 #endif // V8_TARGET_ARCH_MIPS64 | 5552 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |