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 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 default: | 1763 default: |
1764 break; | 1764 break; |
1765 } | 1765 } |
1766 } | 1766 } |
1767 // This is dodgy but it works because the C entry stubs are never moved. | 1767 // This is dodgy but it works because the C entry stubs are never moved. |
1768 // See comment in codegen-arm.cc and bug 1242173. | 1768 // See comment in codegen-arm.cc and bug 1242173. |
1769 int32_t saved_lr = get_register(lr); | 1769 int32_t saved_lr = get_register(lr); |
1770 intptr_t external = | 1770 intptr_t external = |
1771 reinterpret_cast<intptr_t>(redirection->external_function()); | 1771 reinterpret_cast<intptr_t>(redirection->external_function()); |
1772 if (fp_call) { | 1772 if (fp_call) { |
1773 SimulatorRuntimeFPCall target = | |
1774 reinterpret_cast<SimulatorRuntimeFPCall>(external); | |
1775 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { | 1773 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { |
| 1774 SimulatorRuntimeFPCall target = |
| 1775 reinterpret_cast<SimulatorRuntimeFPCall>(external); |
1776 double dval0, dval1; | 1776 double dval0, dval1; |
1777 int32_t ival; | 1777 int32_t ival; |
1778 switch (redirection->type()) { | 1778 switch (redirection->type()) { |
1779 case ExternalReference::BUILTIN_FP_FP_CALL: | 1779 case ExternalReference::BUILTIN_FP_FP_CALL: |
1780 case ExternalReference::BUILTIN_COMPARE_CALL: | 1780 case ExternalReference::BUILTIN_COMPARE_CALL: |
1781 GetFpArgs(&dval0, &dval1); | 1781 GetFpArgs(&dval0, &dval1); |
1782 PrintF("Call to host function at %p with args %f, %f", | 1782 PrintF("Call to host function at %p with args %f, %f", |
1783 FUNCTION_ADDR(target), dval0, dval1); | 1783 FUNCTION_ADDR(target), dval0, dval1); |
1784 break; | 1784 break; |
1785 case ExternalReference::BUILTIN_FP_CALL: | 1785 case ExternalReference::BUILTIN_FP_CALL: |
1786 GetFpArgs(&dval0); | 1786 GetFpArgs(&dval0); |
1787 PrintF("Call to host function at %p with arg %f", | 1787 PrintF("Call to host function at %p with arg %f", |
1788 FUNCTION_ADDR(target), dval1); | 1788 FUNCTION_ADDR(target), dval0); |
1789 break; | 1789 break; |
1790 case ExternalReference::BUILTIN_FP_INT_CALL: | 1790 case ExternalReference::BUILTIN_FP_INT_CALL: |
1791 GetFpArgs(&dval0, &ival); | 1791 GetFpArgs(&dval0, &ival); |
1792 PrintF("Call to host function at %p with args %f, %d", | 1792 PrintF("Call to host function at %p with args %f, %d", |
1793 FUNCTION_ADDR(target), dval0, ival); | 1793 FUNCTION_ADDR(target), dval0, ival); |
1794 break; | 1794 break; |
1795 default: | 1795 default: |
1796 UNREACHABLE(); | 1796 UNREACHABLE(); |
1797 break; | 1797 break; |
1798 } | 1798 } |
1799 if (!stack_aligned) { | 1799 if (!stack_aligned) { |
1800 PrintF(" with unaligned stack %08x\n", get_register(sp)); | 1800 PrintF(" with unaligned stack %08x\n", get_register(sp)); |
1801 } | 1801 } |
1802 PrintF("\n"); | 1802 PrintF("\n"); |
1803 } | 1803 } |
1804 CHECK(stack_aligned); | 1804 CHECK(stack_aligned); |
1805 double result = target(arg0, arg1, arg2, arg3); | |
1806 if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) { | 1805 if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) { |
| 1806 SimulatorRuntimeFPCall target = |
| 1807 reinterpret_cast<SimulatorRuntimeFPCall>(external); |
| 1808 double result = target(arg0, arg1, arg2, arg3); |
1807 SetFpResult(result); | 1809 SetFpResult(result); |
| 1810 } else { |
| 1811 SimulatorRuntimeCall target = |
| 1812 reinterpret_cast<SimulatorRuntimeCall>(external); |
| 1813 int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5); |
| 1814 int32_t lo_res = static_cast<int32_t>(result); |
| 1815 int32_t hi_res = static_cast<int32_t>(result >> 32); |
| 1816 if (::v8::internal::FLAG_trace_sim) { |
| 1817 PrintF("Returned %08x\n", lo_res); |
| 1818 } |
| 1819 set_register(r0, lo_res); |
| 1820 set_register(r1, hi_res); |
1808 } | 1821 } |
1809 } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { | 1822 } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { |
1810 SimulatorRuntimeDirectApiCall target = | 1823 SimulatorRuntimeDirectApiCall target = |
1811 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external); | 1824 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external); |
1812 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { | 1825 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { |
1813 PrintF("Call to host function at %p args %08x", | 1826 PrintF("Call to host function at %p args %08x", |
1814 FUNCTION_ADDR(target), arg0); | 1827 FUNCTION_ADDR(target), arg0); |
1815 if (!stack_aligned) { | 1828 if (!stack_aligned) { |
1816 PrintF(" with unaligned stack %08x\n", get_register(sp)); | 1829 PrintF(" with unaligned stack %08x\n", get_register(sp)); |
1817 } | 1830 } |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3405 uintptr_t address = *stack_slot; | 3418 uintptr_t address = *stack_slot; |
3406 set_register(sp, current_sp + sizeof(uintptr_t)); | 3419 set_register(sp, current_sp + sizeof(uintptr_t)); |
3407 return address; | 3420 return address; |
3408 } | 3421 } |
3409 | 3422 |
3410 } } // namespace v8::internal | 3423 } } // namespace v8::internal |
3411 | 3424 |
3412 #endif // USE_SIMULATOR | 3425 #endif // USE_SIMULATOR |
3413 | 3426 |
3414 #endif // V8_TARGET_ARCH_ARM | 3427 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |