Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/arm/simulator-arm.cc

Issue 23588002: cleanup api callbacks now that handles are never returned directly (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nits Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 int32_t arg5); 1679 int32_t arg5);
1680 1680
1681 // These prototypes handle the four types of FP calls. 1681 // These prototypes handle the four types of FP calls.
1682 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); 1682 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1);
1683 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); 1683 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1);
1684 typedef double (*SimulatorRuntimeFPCall)(double darg0); 1684 typedef double (*SimulatorRuntimeFPCall)(double darg0);
1685 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); 1685 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0);
1686 1686
1687 // This signature supports direct call in to API function native callback 1687 // This signature supports direct call in to API function native callback
1688 // (refer to InvocationCallback in v8.h). 1688 // (refer to InvocationCallback in v8.h).
1689 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); 1689 typedef void (*SimulatorRuntimeDirectApiCall)(int32_t arg0);
1690 typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0); 1690 typedef void (*SimulatorRuntimeProfilingApiCall)(int32_t arg0, int32_t arg1);
1691 typedef v8::Handle<v8::Value> (*SimulatorRuntimeProfilingApiCall)(
1692 int32_t arg0, int32_t arg1);
1693 typedef void (*SimulatorRuntimeProfilingApiCallNew)(int32_t arg0, int32_t arg1);
1694 1691
1695 // This signature supports direct call to accessor getter callback. 1692 // This signature supports direct call to accessor getter callback.
1696 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, 1693 typedef void (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, int32_t arg1);
1697 int32_t arg1); 1694 typedef void (*SimulatorRuntimeProfilingGetterCall)(
1698 typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0,
1699 int32_t arg1);
1700 typedef v8::Handle<v8::Value> (*SimulatorRuntimeProfilingGetterCall)(
1701 int32_t arg0, int32_t arg1, int32_t arg2);
1702 typedef void (*SimulatorRuntimeProfilingGetterCallNew)(
1703 int32_t arg0, int32_t arg1, int32_t arg2); 1695 int32_t arg0, int32_t arg1, int32_t arg2);
1704 1696
1705 // Software interrupt instructions are used by the simulator to call into the 1697 // Software interrupt instructions are used by the simulator to call into the
1706 // C-based V8 runtime. 1698 // C-based V8 runtime.
1707 void Simulator::SoftwareInterrupt(Instruction* instr) { 1699 void Simulator::SoftwareInterrupt(Instruction* instr) {
1708 int svc = instr->SvcValue(); 1700 int svc = instr->SvcValue();
1709 switch (svc) { 1701 switch (svc) {
1710 case kCallRtRedirected: { 1702 case kCallRtRedirected: {
1711 // Check if stack is aligned. Error if not aligned is reported below to 1703 // Check if stack is aligned. Error if not aligned is reported below to
1712 // include information on the function called. 1704 // include information on the function called.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 case ExternalReference::BUILTIN_FP_FP_CALL: 1824 case ExternalReference::BUILTIN_FP_FP_CALL:
1833 case ExternalReference::BUILTIN_FP_CALL: 1825 case ExternalReference::BUILTIN_FP_CALL:
1834 case ExternalReference::BUILTIN_FP_INT_CALL: 1826 case ExternalReference::BUILTIN_FP_INT_CALL:
1835 PrintF("Returned %f\n", dresult); 1827 PrintF("Returned %f\n", dresult);
1836 break; 1828 break;
1837 default: 1829 default:
1838 UNREACHABLE(); 1830 UNREACHABLE();
1839 break; 1831 break;
1840 } 1832 }
1841 } 1833 }
1842 } else if ( 1834 } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
1843 redirection->type() == ExternalReference::DIRECT_API_CALL ||
1844 redirection->type() == ExternalReference::DIRECT_API_CALL_NEW) {
1845 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { 1835 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1846 PrintF("Call to host function at %p args %08x", 1836 PrintF("Call to host function at %p args %08x",
1847 reinterpret_cast<void*>(external), arg0); 1837 reinterpret_cast<void*>(external), arg0);
1848 if (!stack_aligned) { 1838 if (!stack_aligned) {
1849 PrintF(" with unaligned stack %08x\n", get_register(sp)); 1839 PrintF(" with unaligned stack %08x\n", get_register(sp));
1850 } 1840 }
1851 PrintF("\n"); 1841 PrintF("\n");
1852 } 1842 }
1853 CHECK(stack_aligned); 1843 CHECK(stack_aligned);
1854 if (redirection->type() == ExternalReference::DIRECT_API_CALL) { 1844 SimulatorRuntimeDirectApiCall target =
1855 SimulatorRuntimeDirectApiCall target = 1845 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external);
1856 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external); 1846 target(arg0);
1857 v8::Handle<v8::Value> result = target(arg0);
1858 if (::v8::internal::FLAG_trace_sim) {
1859 PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1860 }
1861 set_register(r0, reinterpret_cast<int32_t>(*result));
1862 } else {
1863 SimulatorRuntimeDirectApiCallNew target =
1864 reinterpret_cast<SimulatorRuntimeDirectApiCallNew>(external);
1865 target(arg0);
1866 }
1867 } else if ( 1847 } else if (
1868 redirection->type() == ExternalReference::PROFILING_API_CALL || 1848 redirection->type() == ExternalReference::PROFILING_API_CALL) {
1869 redirection->type() == ExternalReference::PROFILING_API_CALL_NEW) {
1870 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { 1849 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1871 PrintF("Call to host function at %p args %08x %08x", 1850 PrintF("Call to host function at %p args %08x %08x",
1872 reinterpret_cast<void*>(external), arg0, arg1); 1851 reinterpret_cast<void*>(external), arg0, arg1);
1873 if (!stack_aligned) { 1852 if (!stack_aligned) {
1874 PrintF(" with unaligned stack %08x\n", get_register(sp)); 1853 PrintF(" with unaligned stack %08x\n", get_register(sp));
1875 } 1854 }
1876 PrintF("\n"); 1855 PrintF("\n");
1877 } 1856 }
1878 CHECK(stack_aligned); 1857 CHECK(stack_aligned);
1879 if (redirection->type() == ExternalReference::PROFILING_API_CALL) { 1858 SimulatorRuntimeProfilingApiCall target =
1880 SimulatorRuntimeProfilingApiCall target = 1859 reinterpret_cast<SimulatorRuntimeProfilingApiCall>(external);
1881 reinterpret_cast<SimulatorRuntimeProfilingApiCall>(external); 1860 target(arg0, arg1);
1882 v8::Handle<v8::Value> result = target(arg0, arg1);
1883 if (::v8::internal::FLAG_trace_sim) {
1884 PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1885 }
1886 set_register(r0, reinterpret_cast<int32_t>(*result));
1887 } else {
1888 SimulatorRuntimeProfilingApiCallNew target =
1889 reinterpret_cast<SimulatorRuntimeProfilingApiCallNew>(external);
1890 target(arg0, arg1);
1891 }
1892 } else if ( 1861 } else if (
1893 redirection->type() == ExternalReference::DIRECT_GETTER_CALL || 1862 redirection->type() == ExternalReference::DIRECT_GETTER_CALL) {
1894 redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) {
1895 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { 1863 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1896 PrintF("Call to host function at %p args %08x %08x", 1864 PrintF("Call to host function at %p args %08x %08x",
1897 reinterpret_cast<void*>(external), arg0, arg1); 1865 reinterpret_cast<void*>(external), arg0, arg1);
1898 if (!stack_aligned) { 1866 if (!stack_aligned) {
1899 PrintF(" with unaligned stack %08x\n", get_register(sp)); 1867 PrintF(" with unaligned stack %08x\n", get_register(sp));
1900 } 1868 }
1901 PrintF("\n"); 1869 PrintF("\n");
1902 } 1870 }
1903 CHECK(stack_aligned); 1871 CHECK(stack_aligned);
1904 if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { 1872 SimulatorRuntimeDirectGetterCall target =
1905 SimulatorRuntimeDirectGetterCall target = 1873 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
1906 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external); 1874 target(arg0, arg1);
1907 v8::Handle<v8::Value> result = target(arg0, arg1);
1908 if (::v8::internal::FLAG_trace_sim) {
1909 PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1910 }
1911 set_register(r0, reinterpret_cast<int32_t>(*result));
1912 } else {
1913 SimulatorRuntimeDirectGetterCallNew target =
1914 reinterpret_cast<SimulatorRuntimeDirectGetterCallNew>(external);
1915 target(arg0, arg1);
1916 }
1917 } else if ( 1875 } else if (
1918 redirection->type() == ExternalReference::PROFILING_GETTER_CALL || 1876 redirection->type() == ExternalReference::PROFILING_GETTER_CALL) {
1919 redirection->type() == ExternalReference::PROFILING_GETTER_CALL_NEW) {
1920 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { 1877 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1921 PrintF("Call to host function at %p args %08x %08x %08x", 1878 PrintF("Call to host function at %p args %08x %08x %08x",
1922 reinterpret_cast<void*>(external), arg0, arg1, arg2); 1879 reinterpret_cast<void*>(external), arg0, arg1, arg2);
1923 if (!stack_aligned) { 1880 if (!stack_aligned) {
1924 PrintF(" with unaligned stack %08x\n", get_register(sp)); 1881 PrintF(" with unaligned stack %08x\n", get_register(sp));
1925 } 1882 }
1926 PrintF("\n"); 1883 PrintF("\n");
1927 } 1884 }
1928 CHECK(stack_aligned); 1885 CHECK(stack_aligned);
1929 if (redirection->type() == ExternalReference::PROFILING_GETTER_CALL) { 1886 SimulatorRuntimeProfilingGetterCall target =
1930 SimulatorRuntimeProfilingGetterCall target = 1887 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(
1931 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external); 1888 external);
1932 v8::Handle<v8::Value> result = target(arg0, arg1, arg2); 1889 target(arg0, arg1, arg2);
1933 if (::v8::internal::FLAG_trace_sim) {
1934 PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1935 }
1936 set_register(r0, reinterpret_cast<int32_t>(*result));
1937 } else {
1938 SimulatorRuntimeProfilingGetterCallNew target =
1939 reinterpret_cast<SimulatorRuntimeProfilingGetterCallNew>(
1940 external);
1941 target(arg0, arg1, arg2);
1942 }
1943 } else { 1890 } else {
1944 // builtin call. 1891 // builtin call.
1945 ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); 1892 ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL);
1946 SimulatorRuntimeCall target = 1893 SimulatorRuntimeCall target =
1947 reinterpret_cast<SimulatorRuntimeCall>(external); 1894 reinterpret_cast<SimulatorRuntimeCall>(external);
1948 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { 1895 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1949 PrintF( 1896 PrintF(
1950 "Call to host function at %p " 1897 "Call to host function at %p "
1951 "args %08x, %08x, %08x, %08x, %08x, %08x", 1898 "args %08x, %08x, %08x, %08x, %08x, %08x",
1952 FUNCTION_ADDR(target), 1899 FUNCTION_ADDR(target),
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after
3905 uintptr_t address = *stack_slot; 3852 uintptr_t address = *stack_slot;
3906 set_register(sp, current_sp + sizeof(uintptr_t)); 3853 set_register(sp, current_sp + sizeof(uintptr_t));
3907 return address; 3854 return address;
3908 } 3855 }
3909 3856
3910 } } // namespace v8::internal 3857 } } // namespace v8::internal
3911 3858
3912 #endif // USE_SIMULATOR 3859 #endif // USE_SIMULATOR
3913 3860
3914 #endif // V8_TARGET_ARCH_ARM 3861 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698