OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 | 1166 |
1167 // Special handling of out of memory exceptions. | 1167 // Special handling of out of memory exceptions. |
1168 Failure* out_of_memory = Failure::OutOfMemoryException(); | 1168 Failure* out_of_memory = Failure::OutOfMemoryException(); |
1169 __ Branch(eq, throw_out_of_memory_exception, | 1169 __ Branch(eq, throw_out_of_memory_exception, |
1170 v0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | 1170 v0, Operand(reinterpret_cast<int32_t>(out_of_memory))); |
1171 | 1171 |
1172 // Retrieve the pending exception and clear the variable. | 1172 // Retrieve the pending exception and clear the variable. |
1173 __ LoadExternalReference(t0, ExternalReference::the_hole_value_location()); | 1173 __ LoadExternalReference(t0, ExternalReference::the_hole_value_location()); |
1174 __ lw(a3, MemOperand(t0)); | 1174 __ lw(a3, MemOperand(t0)); |
1175 __ LoadExternalReference(t0, | 1175 __ LoadExternalReference(t0, |
1176 ExternalReference(Top::k_pending_exception_address)); | 1176 ExternalReference(Isolate::k_pending_exception_address)); |
1177 __ lw(v0, MemOperand(t0)); | 1177 __ lw(v0, MemOperand(t0)); |
1178 __ sw(a3, MemOperand(t0)); | 1178 __ sw(a3, MemOperand(t0)); |
1179 | 1179 |
1180 // Special handling of termination exceptions which are uncatchable | 1180 // Special handling of termination exceptions which are uncatchable |
1181 // by javascript code. | 1181 // by javascript code. |
1182 __ Branch(eq, throw_termination_exception, | 1182 __ Branch(eq, throw_termination_exception, |
1183 v0, Operand(Factory::termination_exception())); | 1183 v0, Operand(Factory::termination_exception())); |
1184 | 1184 |
1185 // Handle normal exception. | 1185 // Handle normal exception. |
1186 __ b(throw_normal_exception); | 1186 __ b(throw_normal_exception); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 // args | 1263 // args |
1264 | 1264 |
1265 // Save callee saved registers on the stack. | 1265 // Save callee saved registers on the stack. |
1266 __ MultiPush((kCalleeSaved | ra.bit()) & ~sp.bit()); | 1266 __ MultiPush((kCalleeSaved | ra.bit()) & ~sp.bit()); |
1267 | 1267 |
1268 // We build an EntryFrame. | 1268 // We build an EntryFrame. |
1269 __ li(t3, Operand(-1)); // Push a bad frame pointer to fail if it is used. | 1269 __ li(t3, Operand(-1)); // Push a bad frame pointer to fail if it is used. |
1270 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 1270 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
1271 __ li(t2, Operand(Smi::FromInt(marker))); | 1271 __ li(t2, Operand(Smi::FromInt(marker))); |
1272 __ li(t1, Operand(Smi::FromInt(marker))); | 1272 __ li(t1, Operand(Smi::FromInt(marker))); |
1273 __ LoadExternalReference(t0, ExternalReference(Top::k_c_entry_fp_address)); | 1273 __ LoadExternalReference(t0, |
| 1274 ExternalReference(Isolate::k_c_entry_fp_address)); |
1274 __ lw(t0, MemOperand(t0)); | 1275 __ lw(t0, MemOperand(t0)); |
1275 __ MultiPush(t0.bit() | t1.bit() | t2.bit() | t3.bit()); | 1276 __ MultiPush(t0.bit() | t1.bit() | t2.bit() | t3.bit()); |
1276 | 1277 |
1277 // Setup frame pointer for the frame to be pushed. | 1278 // Setup frame pointer for the frame to be pushed. |
1278 __ addiu(fp, sp, -EntryFrameConstants::kCallerFPOffset); | 1279 __ addiu(fp, sp, -EntryFrameConstants::kCallerFPOffset); |
1279 | 1280 |
1280 // Load argv in s0 register. | 1281 // Load argv in s0 register. |
1281 __ lw(s0, MemOperand(sp, (kNumCalleeSaved + 1) * kPointerSize + | 1282 __ lw(s0, MemOperand(sp, (kNumCalleeSaved + 1) * kPointerSize + |
1282 StandardFrameConstants::kCArgsSlotsSize)); | 1283 StandardFrameConstants::kCArgsSlotsSize)); |
1283 | 1284 |
(...skipping 15 matching lines...) Expand all Loading... |
1299 | 1300 |
1300 // Call a faked try-block that does the invoke. | 1301 // Call a faked try-block that does the invoke. |
1301 __ bal(&invoke); | 1302 __ bal(&invoke); |
1302 __ nop(); // Branch delay slot nop. | 1303 __ nop(); // Branch delay slot nop. |
1303 | 1304 |
1304 // Caught exception: Store result (exception) in the pending | 1305 // Caught exception: Store result (exception) in the pending |
1305 // exception field in the JSEnv and return a failure sentinel. | 1306 // exception field in the JSEnv and return a failure sentinel. |
1306 // Coming in here the fp will be invalid because the PushTryHandler below | 1307 // Coming in here the fp will be invalid because the PushTryHandler below |
1307 // sets it to 0 to signal the existence of the JSEntry frame. | 1308 // sets it to 0 to signal the existence of the JSEntry frame. |
1308 __ LoadExternalReference(t0, | 1309 __ LoadExternalReference(t0, |
1309 ExternalReference(Top::k_pending_exception_address)); | 1310 ExternalReference(Isolate::k_pending_exception_address)); |
1310 __ sw(v0, MemOperand(t0)); // We come back from 'invoke'. result is in v0. | 1311 __ sw(v0, MemOperand(t0)); // We come back from 'invoke'. result is in v0. |
1311 __ li(v0, Operand(reinterpret_cast<int32_t>(Failure::Exception()))); | 1312 __ li(v0, Operand(reinterpret_cast<int32_t>(Failure::Exception()))); |
1312 __ b(&exit); | 1313 __ b(&exit); |
1313 __ nop(); // Branch delay slot nop. | 1314 __ nop(); // Branch delay slot nop. |
1314 | 1315 |
1315 // Invoke: Link this frame into the handler chain. | 1316 // Invoke: Link this frame into the handler chain. |
1316 __ bind(&invoke); | 1317 __ bind(&invoke); |
1317 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 1318 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
1318 // If an exception not caught by another handler occurs, this handler | 1319 // If an exception not caught by another handler occurs, this handler |
1319 // returns control to the code after the bal(&invoke) above, which | 1320 // returns control to the code after the bal(&invoke) above, which |
1320 // restores all kCalleeSaved registers (including cp and fp) to their | 1321 // restores all kCalleeSaved registers (including cp and fp) to their |
1321 // saved values before returning a failure to C. | 1322 // saved values before returning a failure to C. |
1322 | 1323 |
1323 // Clear any pending exceptions. | 1324 // Clear any pending exceptions. |
1324 __ LoadExternalReference(t0, ExternalReference::the_hole_value_location()); | 1325 __ LoadExternalReference(t0, ExternalReference::the_hole_value_location()); |
1325 __ lw(t1, MemOperand(t0)); | 1326 __ lw(t1, MemOperand(t0)); |
1326 __ LoadExternalReference(t0, | 1327 __ LoadExternalReference(t0, |
1327 ExternalReference(Top::k_pending_exception_address)); | 1328 ExternalReference(Isolate::k_pending_exception_address)); |
1328 __ sw(t1, MemOperand(t0)); | 1329 __ sw(t1, MemOperand(t0)); |
1329 | 1330 |
1330 // Invoke the function by calling through JS entry trampoline builtin. | 1331 // Invoke the function by calling through JS entry trampoline builtin. |
1331 // Notice that we cannot store a reference to the trampoline code directly in | 1332 // Notice that we cannot store a reference to the trampoline code directly in |
1332 // this stub, because runtime stubs are not traversed when doing GC. | 1333 // this stub, because runtime stubs are not traversed when doing GC. |
1333 | 1334 |
1334 // Registers: | 1335 // Registers: |
1335 // a0: entry_address | 1336 // a0: entry_address |
1336 // a1: function | 1337 // a1: function |
1337 // a2: reveiver_pointer | 1338 // a2: reveiver_pointer |
(...skipping 18 matching lines...) Expand all Loading... |
1356 | 1357 |
1357 // Call JSEntryTrampoline. | 1358 // Call JSEntryTrampoline. |
1358 __ addiu(t9, t9, Code::kHeaderSize - kHeapObjectTag); | 1359 __ addiu(t9, t9, Code::kHeaderSize - kHeapObjectTag); |
1359 __ CallBuiltin(t9); | 1360 __ CallBuiltin(t9); |
1360 | 1361 |
1361 // Unlink this frame from the handler chain. When reading the | 1362 // Unlink this frame from the handler chain. When reading the |
1362 // address of the next handler, there is no need to use the address | 1363 // address of the next handler, there is no need to use the address |
1363 // displacement since the current stack pointer (sp) points directly | 1364 // displacement since the current stack pointer (sp) points directly |
1364 // to the stack handler. | 1365 // to the stack handler. |
1365 __ lw(t1, MemOperand(sp, StackHandlerConstants::kNextOffset)); | 1366 __ lw(t1, MemOperand(sp, StackHandlerConstants::kNextOffset)); |
1366 __ LoadExternalReference(t0, ExternalReference(Top::k_handler_address)); | 1367 __ LoadExternalReference(t0, ExternalReference(Isolate::k_handler_address)); |
1367 __ sw(t1, MemOperand(t0)); | 1368 __ sw(t1, MemOperand(t0)); |
1368 | 1369 |
1369 // This restores sp to its position before PushTryHandler. | 1370 // This restores sp to its position before PushTryHandler. |
1370 __ addiu(sp, sp, StackHandlerConstants::kSize); | 1371 __ addiu(sp, sp, StackHandlerConstants::kSize); |
1371 | 1372 |
1372 __ bind(&exit); // v0 holds result | 1373 __ bind(&exit); // v0 holds result |
1373 // Restore the top frame descriptors from the stack. | 1374 // Restore the top frame descriptors from the stack. |
1374 __ Pop(t1); | 1375 __ Pop(t1); |
1375 __ LoadExternalReference(t0, ExternalReference(Top::k_c_entry_fp_address)); | 1376 __ LoadExternalReference(t0, |
| 1377 ExternalReference(Isolate::k_c_entry_fp_address)); |
1376 __ sw(t1, MemOperand(t0)); | 1378 __ sw(t1, MemOperand(t0)); |
1377 | 1379 |
1378 // Reset the stack to the callee saved registers. | 1380 // Reset the stack to the callee saved registers. |
1379 __ addiu(sp, sp, -EntryFrameConstants::kCallerFPOffset); | 1381 __ addiu(sp, sp, -EntryFrameConstants::kCallerFPOffset); |
1380 | 1382 |
1381 // Restore callee saved registers from the stack. | 1383 // Restore callee saved registers from the stack. |
1382 __ MultiPop((kCalleeSaved | ra.bit()) & ~sp.bit()); | 1384 __ MultiPop((kCalleeSaved | ra.bit()) & ~sp.bit()); |
1383 // Return. | 1385 // Return. |
1384 __ Jump(ra); | 1386 __ Jump(ra); |
1385 } | 1387 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); | 1425 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); |
1424 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); | 1426 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); |
1425 } | 1427 } |
1426 | 1428 |
1427 | 1429 |
1428 #undef __ | 1430 #undef __ |
1429 | 1431 |
1430 } } // namespace v8::internal | 1432 } } // namespace v8::internal |
1431 | 1433 |
1432 #endif // V8_TARGET_ARCH_MIPS | 1434 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |