OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 | 1381 |
1382 // These prototypes handle the four types of FP calls. | 1382 // These prototypes handle the four types of FP calls. |
1383 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); | 1383 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); |
1384 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); | 1384 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); |
1385 typedef double (*SimulatorRuntimeFPCall)(double darg0); | 1385 typedef double (*SimulatorRuntimeFPCall)(double darg0); |
1386 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); | 1386 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); |
1387 | 1387 |
1388 // This signature supports direct call in to API function native callback | 1388 // This signature supports direct call in to API function native callback |
1389 // (refer to InvocationCallback in v8.h). | 1389 // (refer to InvocationCallback in v8.h). |
1390 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); | 1390 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); |
| 1391 typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0); |
1391 | 1392 |
1392 // This signature supports direct call to accessor getter callback. | 1393 // This signature supports direct call to accessor getter callback. |
1393 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, | 1394 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, |
1394 int32_t arg1); | 1395 int32_t arg1); |
| 1396 typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0, |
| 1397 int32_t arg1); |
1395 | 1398 |
1396 // Software interrupt instructions are used by the simulator to call into the | 1399 // Software interrupt instructions are used by the simulator to call into the |
1397 // C-based V8 runtime. They are also used for debugging with simulator. | 1400 // C-based V8 runtime. They are also used for debugging with simulator. |
1398 void Simulator::SoftwareInterrupt(Instruction* instr) { | 1401 void Simulator::SoftwareInterrupt(Instruction* instr) { |
1399 // There are several instructions that could get us here, | 1402 // There are several instructions that could get us here, |
1400 // the break_ instruction, or several variants of traps. All | 1403 // the break_ instruction, or several variants of traps. All |
1401 // Are "SPECIAL" class opcode, and are distinuished by function. | 1404 // Are "SPECIAL" class opcode, and are distinuished by function. |
1402 int32_t func = instr->FunctionFieldRaw(); | 1405 int32_t func = instr->FunctionFieldRaw(); |
1403 uint32_t code = (func == BREAK) ? instr->Bits(25, 6) : -1; | 1406 uint32_t code = (func == BREAK) ? instr->Bits(25, 6) : -1; |
1404 | 1407 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 case ExternalReference::BUILTIN_FP_FP_CALL: | 1532 case ExternalReference::BUILTIN_FP_FP_CALL: |
1530 case ExternalReference::BUILTIN_FP_CALL: | 1533 case ExternalReference::BUILTIN_FP_CALL: |
1531 case ExternalReference::BUILTIN_FP_INT_CALL: | 1534 case ExternalReference::BUILTIN_FP_INT_CALL: |
1532 PrintF("Returned %f\n", dresult); | 1535 PrintF("Returned %f\n", dresult); |
1533 break; | 1536 break; |
1534 default: | 1537 default: |
1535 UNREACHABLE(); | 1538 UNREACHABLE(); |
1536 break; | 1539 break; |
1537 } | 1540 } |
1538 } | 1541 } |
1539 } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { | 1542 } else if ( |
| 1543 redirection->type() == ExternalReference::DIRECT_API_CALL || |
| 1544 redirection->type() == ExternalReference::DIRECT_API_CALL_NEW) { |
1540 // See DirectCEntryStub::GenerateCall for explanation of register usage. | 1545 // See DirectCEntryStub::GenerateCall for explanation of register usage. |
1541 SimulatorRuntimeDirectApiCall target = | |
1542 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external); | |
1543 if (::v8::internal::FLAG_trace_sim) { | 1546 if (::v8::internal::FLAG_trace_sim) { |
1544 PrintF("Call to host function at %p args %08x\n", | 1547 PrintF("Call to host function at %p args %08x\n", |
1545 FUNCTION_ADDR(target), arg1); | 1548 reinterpret_cast<void*>(external), arg1); |
1546 } | 1549 } |
1547 v8::Handle<v8::Value> result = target(arg1); | 1550 if (redirection->type() == ExternalReference::DIRECT_API_CALL) { |
1548 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result); | 1551 SimulatorRuntimeDirectApiCall target = |
1549 set_register(v0, arg0); | 1552 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external); |
1550 } else if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { | 1553 v8::Handle<v8::Value> result = target(arg1); |
| 1554 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result); |
| 1555 set_register(v0, arg0); |
| 1556 } else { |
| 1557 SimulatorRuntimeDirectApiCallNew target = |
| 1558 reinterpret_cast<SimulatorRuntimeDirectApiCallNew>(external); |
| 1559 target(arg1); |
| 1560 } |
| 1561 } else if ( |
| 1562 redirection->type() == ExternalReference::DIRECT_GETTER_CALL || |
| 1563 redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) { |
1551 // See DirectCEntryStub::GenerateCall for explanation of register usage. | 1564 // See DirectCEntryStub::GenerateCall for explanation of register usage. |
1552 SimulatorRuntimeDirectGetterCall target = | |
1553 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external); | |
1554 if (::v8::internal::FLAG_trace_sim) { | 1565 if (::v8::internal::FLAG_trace_sim) { |
1555 PrintF("Call to host function at %p args %08x %08x\n", | 1566 PrintF("Call to host function at %p args %08x %08x\n", |
1556 FUNCTION_ADDR(target), arg1, arg2); | 1567 reinterpret_cast<void*>(external), arg1, arg2); |
1557 } | 1568 } |
1558 v8::Handle<v8::Value> result = target(arg1, arg2); | 1569 if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { |
1559 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result); | 1570 SimulatorRuntimeDirectGetterCall target = |
1560 set_register(v0, arg0); | 1571 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external); |
| 1572 v8::Handle<v8::Value> result = target(arg1, arg2); |
| 1573 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result); |
| 1574 set_register(v0, arg0); |
| 1575 } else { |
| 1576 SimulatorRuntimeDirectGetterCallNew target = |
| 1577 reinterpret_cast<SimulatorRuntimeDirectGetterCallNew>(external); |
| 1578 target(arg1, arg2); |
| 1579 } |
1561 } else { | 1580 } else { |
1562 SimulatorRuntimeCall target = | 1581 SimulatorRuntimeCall target = |
1563 reinterpret_cast<SimulatorRuntimeCall>(external); | 1582 reinterpret_cast<SimulatorRuntimeCall>(external); |
1564 if (::v8::internal::FLAG_trace_sim) { | 1583 if (::v8::internal::FLAG_trace_sim) { |
1565 PrintF( | 1584 PrintF( |
1566 "Call to host function at %p " | 1585 "Call to host function at %p " |
1567 "args %08x, %08x, %08x, %08x, %08x, %08x\n", | 1586 "args %08x, %08x, %08x, %08x, %08x, %08x\n", |
1568 FUNCTION_ADDR(target), | 1587 FUNCTION_ADDR(target), |
1569 arg0, | 1588 arg0, |
1570 arg1, | 1589 arg1, |
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2902 } | 2921 } |
2903 | 2922 |
2904 | 2923 |
2905 #undef UNSUPPORTED | 2924 #undef UNSUPPORTED |
2906 | 2925 |
2907 } } // namespace v8::internal | 2926 } } // namespace v8::internal |
2908 | 2927 |
2909 #endif // USE_SIMULATOR | 2928 #endif // USE_SIMULATOR |
2910 | 2929 |
2911 #endif // V8_TARGET_ARCH_MIPS | 2930 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |