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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 int32_t arg2, | 1524 int32_t arg2, |
1525 int32_t arg3, | 1525 int32_t arg3, |
1526 int32_t arg4); | 1526 int32_t arg4); |
1527 typedef double (*SimulatorRuntimeFPCall)(int32_t arg0, | 1527 typedef double (*SimulatorRuntimeFPCall)(int32_t arg0, |
1528 int32_t arg1, | 1528 int32_t arg1, |
1529 int32_t arg2, | 1529 int32_t arg2, |
1530 int32_t arg3); | 1530 int32_t arg3); |
1531 | 1531 |
1532 // This signature supports direct call in to API function native callback | 1532 // This signature supports direct call in to API function native callback |
1533 // (refer to InvocationCallback in v8.h). | 1533 // (refer to InvocationCallback in v8.h). |
1534 typedef v8::Handle<v8::Value> (*SimulatorRuntimeApiCall)(int32_t arg0); | 1534 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); |
| 1535 |
| 1536 // This signature supports direct call to accessor getter callback. |
| 1537 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, |
| 1538 int32_t arg1); |
1535 | 1539 |
1536 // Software interrupt instructions are used by the simulator to call into the | 1540 // Software interrupt instructions are used by the simulator to call into the |
1537 // C-based V8 runtime. | 1541 // C-based V8 runtime. |
1538 void Simulator::SoftwareInterrupt(Instruction* instr) { | 1542 void Simulator::SoftwareInterrupt(Instruction* instr) { |
1539 int svc = instr->SvcValue(); | 1543 int svc = instr->SvcValue(); |
1540 switch (svc) { | 1544 switch (svc) { |
1541 case kCallRtRedirected: { | 1545 case kCallRtRedirected: { |
1542 // Check if stack is aligned. Error if not aligned is reported below to | 1546 // Check if stack is aligned. Error if not aligned is reported below to |
1543 // include information on the function called. | 1547 // include information on the function called. |
1544 bool stack_aligned = | 1548 bool stack_aligned = |
(...skipping 20 matching lines...) Expand all Loading... |
1565 PrintF("Call to host function at %p with args %f, %f", | 1569 PrintF("Call to host function at %p with args %f, %f", |
1566 FUNCTION_ADDR(target), x, y); | 1570 FUNCTION_ADDR(target), x, y); |
1567 if (!stack_aligned) { | 1571 if (!stack_aligned) { |
1568 PrintF(" with unaligned stack %08x\n", get_register(sp)); | 1572 PrintF(" with unaligned stack %08x\n", get_register(sp)); |
1569 } | 1573 } |
1570 PrintF("\n"); | 1574 PrintF("\n"); |
1571 } | 1575 } |
1572 CHECK(stack_aligned); | 1576 CHECK(stack_aligned); |
1573 double result = target(arg0, arg1, arg2, arg3); | 1577 double result = target(arg0, arg1, arg2, arg3); |
1574 SetFpResult(result); | 1578 SetFpResult(result); |
1575 } else if (redirection->type() == ExternalReference::DIRECT_CALL) { | 1579 } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { |
1576 SimulatorRuntimeApiCall target = | 1580 SimulatorRuntimeDirectApiCall target = |
1577 reinterpret_cast<SimulatorRuntimeApiCall>(external); | 1581 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external); |
1578 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { | 1582 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { |
1579 PrintF( | 1583 PrintF("Call to host function at %p args %08x", |
1580 "Call to host function at %p args %08x", | 1584 FUNCTION_ADDR(target), arg0); |
1581 FUNCTION_ADDR(target), | |
1582 arg0); | |
1583 if (!stack_aligned) { | 1585 if (!stack_aligned) { |
1584 PrintF(" with unaligned stack %08x\n", get_register(sp)); | 1586 PrintF(" with unaligned stack %08x\n", get_register(sp)); |
1585 } | 1587 } |
1586 PrintF("\n"); | 1588 PrintF("\n"); |
1587 } | 1589 } |
1588 CHECK(stack_aligned); | 1590 CHECK(stack_aligned); |
1589 v8::Handle<v8::Value> result = target(arg0); | 1591 v8::Handle<v8::Value> result = target(arg0); |
1590 if (::v8::internal::FLAG_trace_sim) { | 1592 if (::v8::internal::FLAG_trace_sim) { |
1591 PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); | 1593 PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); |
1592 } | 1594 } |
1593 set_register(r0, (int32_t) *result); | 1595 set_register(r0, (int32_t) *result); |
| 1596 } else if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { |
| 1597 SimulatorRuntimeDirectGetterCall target = |
| 1598 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external); |
| 1599 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { |
| 1600 PrintF("Call to host function at %p args %08x %08x", |
| 1601 FUNCTION_ADDR(target), arg0, arg1); |
| 1602 if (!stack_aligned) { |
| 1603 PrintF(" with unaligned stack %08x\n", get_register(sp)); |
| 1604 } |
| 1605 PrintF("\n"); |
| 1606 } |
| 1607 CHECK(stack_aligned); |
| 1608 v8::Handle<v8::Value> result = target(arg0, arg1); |
| 1609 if (::v8::internal::FLAG_trace_sim) { |
| 1610 PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); |
| 1611 } |
| 1612 set_register(r0, (int32_t) *result); |
1594 } else { | 1613 } else { |
1595 // builtin call. | 1614 // builtin call. |
1596 ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); | 1615 ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); |
1597 SimulatorRuntimeCall target = | 1616 SimulatorRuntimeCall target = |
1598 reinterpret_cast<SimulatorRuntimeCall>(external); | 1617 reinterpret_cast<SimulatorRuntimeCall>(external); |
1599 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { | 1618 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { |
1600 PrintF( | 1619 PrintF( |
1601 "Call to host function at %p args %08x, %08x, %08x, %08x, %0xc", | 1620 "Call to host function at %p args %08x, %08x, %08x, %08x, %0xc", |
1602 FUNCTION_ADDR(target), | 1621 FUNCTION_ADDR(target), |
1603 arg0, | 1622 arg0, |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3123 uintptr_t address = *stack_slot; | 3142 uintptr_t address = *stack_slot; |
3124 set_register(sp, current_sp + sizeof(uintptr_t)); | 3143 set_register(sp, current_sp + sizeof(uintptr_t)); |
3125 return address; | 3144 return address; |
3126 } | 3145 } |
3127 | 3146 |
3128 } } // namespace v8::internal | 3147 } } // namespace v8::internal |
3129 | 3148 |
3130 #endif // USE_SIMULATOR | 3149 #endif // USE_SIMULATOR |
3131 | 3150 |
3132 #endif // V8_TARGET_ARCH_ARM | 3151 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |