| 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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a | 1390 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a |
| 1391 // struct from the function (which is currently the case). This means we pass | 1391 // struct from the function (which is currently the case). This means we pass |
| 1392 // the first argument in a1 instead of a0. | 1392 // the first argument in a1 instead of a0. |
| 1393 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); | 1393 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); |
| 1394 // Here, we pass the first argument in a0, because this function | 1394 // Here, we pass the first argument in a0, because this function |
| 1395 // does not return a struct. | 1395 // does not return a struct. |
| 1396 typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0); | 1396 typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0); |
| 1397 typedef v8::Handle<v8::Value> (*SimulatorRuntimeProfilingApiCall)( |
| 1398 int32_t arg0, int32_t arg1); |
| 1399 typedef void (*SimulatorRuntimeProfilingApiCallNew)(int32_t arg0, int32_t arg1); |
| 1397 | 1400 |
| 1398 // This signature supports direct call to accessor getter callback. | 1401 // This signature supports direct call to accessor getter callback. |
| 1399 // See comment at SimulatorRuntimeDirectApiCall. | 1402 // See comment at SimulatorRuntimeDirectApiCall. |
| 1400 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, | 1403 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, |
| 1401 int32_t arg1); | 1404 int32_t arg1); |
| 1402 // See comment at SimulatorRuntimeDirectApiCallNew. | 1405 // See comment at SimulatorRuntimeDirectApiCallNew. |
| 1403 typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0, | 1406 typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0, |
| 1404 int32_t arg1); | 1407 int32_t arg1); |
| 1408 typedef v8::Handle<v8::Value> (*SimulatorRuntimeProfilingGetterCall)( |
| 1409 int32_t arg0, int32_t arg1, int32_t arg2); |
| 1410 typedef void (*SimulatorRuntimeProfilingGetterCallNew)( |
| 1411 int32_t arg0, int32_t arg1, int32_t arg2); |
| 1405 | 1412 |
| 1406 // Software interrupt instructions are used by the simulator to call into the | 1413 // Software interrupt instructions are used by the simulator to call into the |
| 1407 // C-based V8 runtime. They are also used for debugging with simulator. | 1414 // C-based V8 runtime. They are also used for debugging with simulator. |
| 1408 void Simulator::SoftwareInterrupt(Instruction* instr) { | 1415 void Simulator::SoftwareInterrupt(Instruction* instr) { |
| 1409 // There are several instructions that could get us here, | 1416 // There are several instructions that could get us here, |
| 1410 // the break_ instruction, or several variants of traps. All | 1417 // the break_ instruction, or several variants of traps. All |
| 1411 // Are "SPECIAL" class opcode, and are distinuished by function. | 1418 // Are "SPECIAL" class opcode, and are distinuished by function. |
| 1412 int32_t func = instr->FunctionFieldRaw(); | 1419 int32_t func = instr->FunctionFieldRaw(); |
| 1413 uint32_t code = (func == BREAK) ? instr->Bits(25, 6) : -1; | 1420 uint32_t code = (func == BREAK) ? instr->Bits(25, 6) : -1; |
| 1414 | 1421 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 } else { | 1571 } else { |
| 1565 if (::v8::internal::FLAG_trace_sim) { | 1572 if (::v8::internal::FLAG_trace_sim) { |
| 1566 PrintF("Call to host function at %p args %08x\n", | 1573 PrintF("Call to host function at %p args %08x\n", |
| 1567 reinterpret_cast<void*>(external), arg0); | 1574 reinterpret_cast<void*>(external), arg0); |
| 1568 } | 1575 } |
| 1569 SimulatorRuntimeDirectApiCallNew target = | 1576 SimulatorRuntimeDirectApiCallNew target = |
| 1570 reinterpret_cast<SimulatorRuntimeDirectApiCallNew>(external); | 1577 reinterpret_cast<SimulatorRuntimeDirectApiCallNew>(external); |
| 1571 target(arg0); | 1578 target(arg0); |
| 1572 } | 1579 } |
| 1573 } else if ( | 1580 } else if ( |
| 1581 redirection->type() == ExternalReference::PROFILING_API_CALL || |
| 1582 redirection->type() == ExternalReference::PROFILING_API_CALL_NEW) { |
| 1583 if (redirection->type() == ExternalReference::PROFILING_API_CALL) { |
| 1584 // See comment at type definition of SimulatorRuntimeDirectApiCall |
| 1585 // for explanation of register usage. |
| 1586 if (::v8::internal::FLAG_trace_sim) { |
| 1587 PrintF("Call to host function at %p args %08x %08x\n", |
| 1588 reinterpret_cast<void*>(external), arg1, arg2); |
| 1589 } |
| 1590 SimulatorRuntimeProfilingApiCall target = |
| 1591 reinterpret_cast<SimulatorRuntimeProfilingApiCall>(external); |
| 1592 v8::Handle<v8::Value> result = target(arg1, arg2); |
| 1593 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result); |
| 1594 set_register(v0, arg0); |
| 1595 } else { |
| 1596 if (::v8::internal::FLAG_trace_sim) { |
| 1597 PrintF("Call to host function at %p args %08x %08x\n", |
| 1598 reinterpret_cast<void*>(external), arg0, arg1); |
| 1599 } |
| 1600 SimulatorRuntimeProfilingApiCallNew target = |
| 1601 reinterpret_cast<SimulatorRuntimeProfilingApiCallNew>(external); |
| 1602 target(arg0, arg1); |
| 1603 } |
| 1604 } else if ( |
| 1574 redirection->type() == ExternalReference::DIRECT_GETTER_CALL || | 1605 redirection->type() == ExternalReference::DIRECT_GETTER_CALL || |
| 1575 redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) { | 1606 redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) { |
| 1576 if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { | 1607 if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { |
| 1577 // See comment at type definition of SimulatorRuntimeDirectGetterCall | 1608 // See comment at type definition of SimulatorRuntimeDirectGetterCall |
| 1578 // for explanation of register usage. | 1609 // for explanation of register usage. |
| 1579 if (::v8::internal::FLAG_trace_sim) { | 1610 if (::v8::internal::FLAG_trace_sim) { |
| 1580 PrintF("Call to host function at %p args %08x %08x\n", | 1611 PrintF("Call to host function at %p args %08x %08x\n", |
| 1581 reinterpret_cast<void*>(external), arg1, arg2); | 1612 reinterpret_cast<void*>(external), arg1, arg2); |
| 1582 } | 1613 } |
| 1583 SimulatorRuntimeDirectGetterCall target = | 1614 SimulatorRuntimeDirectGetterCall target = |
| 1584 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external); | 1615 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external); |
| 1585 v8::Handle<v8::Value> result = target(arg1, arg2); | 1616 v8::Handle<v8::Value> result = target(arg1, arg2); |
| 1586 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result); | 1617 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result); |
| 1587 set_register(v0, arg0); | 1618 set_register(v0, arg0); |
| 1588 } else { | 1619 } else { |
| 1589 if (::v8::internal::FLAG_trace_sim) { | 1620 if (::v8::internal::FLAG_trace_sim) { |
| 1590 PrintF("Call to host function at %p args %08x %08x\n", | 1621 PrintF("Call to host function at %p args %08x %08x\n", |
| 1591 reinterpret_cast<void*>(external), arg0, arg1); | 1622 reinterpret_cast<void*>(external), arg0, arg1); |
| 1592 } | 1623 } |
| 1593 SimulatorRuntimeDirectGetterCallNew target = | 1624 SimulatorRuntimeDirectGetterCallNew target = |
| 1594 reinterpret_cast<SimulatorRuntimeDirectGetterCallNew>(external); | 1625 reinterpret_cast<SimulatorRuntimeDirectGetterCallNew>(external); |
| 1595 target(arg0, arg1); | 1626 target(arg0, arg1); |
| 1596 } | 1627 } |
| 1628 } else if ( |
| 1629 redirection->type() == ExternalReference::PROFILING_GETTER_CALL || |
| 1630 redirection->type() == ExternalReference::PROFILING_GETTER_CALL_NEW) { |
| 1631 if (redirection->type() == ExternalReference::PROFILING_GETTER_CALL) { |
| 1632 // See comment at type definition of SimulatorRuntimeProfilingGetterCall |
| 1633 // for explanation of register usage. |
| 1634 if (::v8::internal::FLAG_trace_sim) { |
| 1635 PrintF("Call to host function at %p args %08x %08x %08x\n", |
| 1636 reinterpret_cast<void*>(external), arg1, arg2, arg3); |
| 1637 } |
| 1638 SimulatorRuntimeProfilingGetterCall target = |
| 1639 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external); |
| 1640 v8::Handle<v8::Value> result = target(arg1, arg2, arg3); |
| 1641 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result); |
| 1642 set_register(v0, arg0); |
| 1643 } else { |
| 1644 if (::v8::internal::FLAG_trace_sim) { |
| 1645 PrintF("Call to host function at %p args %08x %08x %08x\n", |
| 1646 reinterpret_cast<void*>(external), arg0, arg1, arg2); |
| 1647 } |
| 1648 SimulatorRuntimeProfilingGetterCallNew target = |
| 1649 reinterpret_cast<SimulatorRuntimeProfilingGetterCallNew>(external); |
| 1650 target(arg0, arg1, arg2); |
| 1651 } |
| 1597 } else { | 1652 } else { |
| 1598 SimulatorRuntimeCall target = | 1653 SimulatorRuntimeCall target = |
| 1599 reinterpret_cast<SimulatorRuntimeCall>(external); | 1654 reinterpret_cast<SimulatorRuntimeCall>(external); |
| 1600 if (::v8::internal::FLAG_trace_sim) { | 1655 if (::v8::internal::FLAG_trace_sim) { |
| 1601 PrintF( | 1656 PrintF( |
| 1602 "Call to host function at %p " | 1657 "Call to host function at %p " |
| 1603 "args %08x, %08x, %08x, %08x, %08x, %08x\n", | 1658 "args %08x, %08x, %08x, %08x, %08x, %08x\n", |
| 1604 FUNCTION_ADDR(target), | 1659 FUNCTION_ADDR(target), |
| 1605 arg0, | 1660 arg0, |
| 1606 arg1, | 1661 arg1, |
| (...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2938 } | 2993 } |
| 2939 | 2994 |
| 2940 | 2995 |
| 2941 #undef UNSUPPORTED | 2996 #undef UNSUPPORTED |
| 2942 | 2997 |
| 2943 } } // namespace v8::internal | 2998 } } // namespace v8::internal |
| 2944 | 2999 |
| 2945 #endif // USE_SIMULATOR | 3000 #endif // USE_SIMULATOR |
| 2946 | 3001 |
| 2947 #endif // V8_TARGET_ARCH_MIPS | 3002 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |