| 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 // Retrieve the handler context, SP and FP. | 1173 // Retrieve the handler context, SP and FP. |
| 1174 __ li(cp, Operand(pending_handler_context_address)); | 1174 __ li(cp, Operand(pending_handler_context_address)); |
| 1175 __ lw(cp, MemOperand(cp)); | 1175 __ lw(cp, MemOperand(cp)); |
| 1176 __ li(sp, Operand(pending_handler_sp_address)); | 1176 __ li(sp, Operand(pending_handler_sp_address)); |
| 1177 __ lw(sp, MemOperand(sp)); | 1177 __ lw(sp, MemOperand(sp)); |
| 1178 __ li(fp, Operand(pending_handler_fp_address)); | 1178 __ li(fp, Operand(pending_handler_fp_address)); |
| 1179 __ lw(fp, MemOperand(fp)); | 1179 __ lw(fp, MemOperand(fp)); |
| 1180 | 1180 |
| 1181 // If the handler is a JS frame, restore the context to the frame. | 1181 // If the handler is a JS frame, restore the context to the frame. Note that |
| 1182 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp | 1182 // the context will be set to (cp == 0) for non-JS frames. |
| 1183 // or cp. | |
| 1184 Label zero; | 1183 Label zero; |
| 1185 __ Branch(&zero, eq, cp, Operand(zero_reg)); | 1184 __ Branch(&zero, eq, cp, Operand(zero_reg)); |
| 1186 __ sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1185 __ sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1187 __ bind(&zero); | 1186 __ bind(&zero); |
| 1188 | 1187 |
| 1189 // Compute the handler entry address and jump to it. | 1188 // Compute the handler entry address and jump to it. |
| 1190 __ li(a1, Operand(pending_handler_code_address)); | 1189 __ li(a1, Operand(pending_handler_code_address)); |
| 1191 __ lw(a1, MemOperand(a1)); | 1190 __ lw(a1, MemOperand(a1)); |
| 1192 __ li(a2, Operand(pending_handler_offset_address)); | 1191 __ li(a2, Operand(pending_handler_offset_address)); |
| 1193 __ lw(a2, MemOperand(a2)); | 1192 __ lw(a2, MemOperand(a2)); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 __ bind(&cont); | 1272 __ bind(&cont); |
| 1274 __ push(t0); | 1273 __ push(t0); |
| 1275 | 1274 |
| 1276 // Jump to a faked try block that does the invoke, with a faked catch | 1275 // Jump to a faked try block that does the invoke, with a faked catch |
| 1277 // block that sets the pending exception. | 1276 // block that sets the pending exception. |
| 1278 __ jmp(&invoke); | 1277 __ jmp(&invoke); |
| 1279 __ bind(&handler_entry); | 1278 __ bind(&handler_entry); |
| 1280 handler_offset_ = handler_entry.pos(); | 1279 handler_offset_ = handler_entry.pos(); |
| 1281 // Caught exception: Store result (exception) in the pending exception | 1280 // Caught exception: Store result (exception) in the pending exception |
| 1282 // field in the JSEnv and return a failure sentinel. Coming in here the | 1281 // field in the JSEnv and return a failure sentinel. Coming in here the |
| 1283 // fp will be invalid because the PushTryHandler below sets it to 0 to | 1282 // fp will be invalid because the PushStackHandler below sets it to 0 to |
| 1284 // signal the existence of the JSEntry frame. | 1283 // signal the existence of the JSEntry frame. |
| 1285 __ li(t0, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1284 __ li(t0, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
| 1286 isolate))); | 1285 isolate))); |
| 1287 __ sw(v0, MemOperand(t0)); // We come back from 'invoke'. result is in v0. | 1286 __ sw(v0, MemOperand(t0)); // We come back from 'invoke'. result is in v0. |
| 1288 __ LoadRoot(v0, Heap::kExceptionRootIndex); | 1287 __ LoadRoot(v0, Heap::kExceptionRootIndex); |
| 1289 __ b(&exit); // b exposes branch delay slot. | 1288 __ b(&exit); // b exposes branch delay slot. |
| 1290 __ nop(); // Branch delay slot nop. | 1289 __ nop(); // Branch delay slot nop. |
| 1291 | 1290 |
| 1292 // Invoke: Link this frame into the handler chain. There's only one | 1291 // Invoke: Link this frame into the handler chain. |
| 1293 // handler block in this code object, so its index is 0. | |
| 1294 __ bind(&invoke); | 1292 __ bind(&invoke); |
| 1295 __ PushTryHandler(StackHandler::JS_ENTRY, 0); | 1293 __ PushStackHandler(); |
| 1296 // If an exception not caught by another handler occurs, this handler | 1294 // If an exception not caught by another handler occurs, this handler |
| 1297 // returns control to the code after the bal(&invoke) above, which | 1295 // returns control to the code after the bal(&invoke) above, which |
| 1298 // restores all kCalleeSaved registers (including cp and fp) to their | 1296 // restores all kCalleeSaved registers (including cp and fp) to their |
| 1299 // saved values before returning a failure to C. | 1297 // saved values before returning a failure to C. |
| 1300 | 1298 |
| 1301 // Clear any pending exceptions. | 1299 // Clear any pending exceptions. |
| 1302 __ LoadRoot(t1, Heap::kTheHoleValueRootIndex); | 1300 __ LoadRoot(t1, Heap::kTheHoleValueRootIndex); |
| 1303 __ li(t0, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1301 __ li(t0, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
| 1304 isolate))); | 1302 isolate))); |
| 1305 __ sw(t1, MemOperand(t0)); | 1303 __ sw(t1, MemOperand(t0)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1330 ExternalReference entry(Builtins::kJSEntryTrampoline, masm->isolate()); | 1328 ExternalReference entry(Builtins::kJSEntryTrampoline, masm->isolate()); |
| 1331 __ li(t0, Operand(entry)); | 1329 __ li(t0, Operand(entry)); |
| 1332 } | 1330 } |
| 1333 __ lw(t9, MemOperand(t0)); // Deref address. | 1331 __ lw(t9, MemOperand(t0)); // Deref address. |
| 1334 | 1332 |
| 1335 // Call JSEntryTrampoline. | 1333 // Call JSEntryTrampoline. |
| 1336 __ addiu(t9, t9, Code::kHeaderSize - kHeapObjectTag); | 1334 __ addiu(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(t1); | 1343 __ pop(t1); |
| 1346 __ Branch(&non_outermost_js_2, | 1344 __ Branch(&non_outermost_js_2, |
| 1347 ne, | 1345 ne, |
| 1348 t1, | 1346 t1, |
| 1349 Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 1347 Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 1350 __ li(t1, Operand(ExternalReference(js_entry_sp))); | 1348 __ li(t1, Operand(ExternalReference(js_entry_sp))); |
| (...skipping 4149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5500 kStackUnwindSpace, kInvalidStackOffset, | 5498 kStackUnwindSpace, kInvalidStackOffset, |
| 5501 MemOperand(fp, 6 * kPointerSize), NULL); | 5499 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5502 } | 5500 } |
| 5503 | 5501 |
| 5504 | 5502 |
| 5505 #undef __ | 5503 #undef __ |
| 5506 | 5504 |
| 5507 } } // namespace v8::internal | 5505 } } // namespace v8::internal |
| 5508 | 5506 |
| 5509 #endif // V8_TARGET_ARCH_MIPS | 5507 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |