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

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

Issue 16858013: Notify CPU profiler when calling native getters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 } 823 }
824 824
825 void* external_function() { return external_function_; } 825 void* external_function() { return external_function_; }
826 ExternalReference::Type type() { return type_; } 826 ExternalReference::Type type() { return type_; }
827 827
828 static Redirection* Get(void* external_function, 828 static Redirection* Get(void* external_function,
829 ExternalReference::Type type) { 829 ExternalReference::Type type) {
830 Isolate* isolate = Isolate::Current(); 830 Isolate* isolate = Isolate::Current();
831 Redirection* current = isolate->simulator_redirection(); 831 Redirection* current = isolate->simulator_redirection();
832 for (; current != NULL; current = current->next_) { 832 for (; current != NULL; current = current->next_) {
833 if (current->external_function_ == external_function) return current; 833 if (current->external_function_ == external_function) {
834 ASSERT_EQ(current->type(), type);
835 return current;
836 }
834 } 837 }
835 return new Redirection(external_function, type); 838 return new Redirection(external_function, type);
836 } 839 }
837 840
838 static Redirection* FromSwiInstruction(Instruction* swi_instruction) { 841 static Redirection* FromSwiInstruction(Instruction* swi_instruction) {
839 char* addr_of_swi = reinterpret_cast<char*>(swi_instruction); 842 char* addr_of_swi = reinterpret_cast<char*>(swi_instruction);
840 char* addr_of_redirection = 843 char* addr_of_redirection =
841 addr_of_swi - OFFSET_OF(Redirection, swi_instruction_); 844 addr_of_swi - OFFSET_OF(Redirection, swi_instruction_);
842 return reinterpret_cast<Redirection*>(addr_of_redirection); 845 return reinterpret_cast<Redirection*>(addr_of_redirection);
843 } 846 }
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 // These prototypes handle the four types of FP calls. 1625 // These prototypes handle the four types of FP calls.
1623 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); 1626 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1);
1624 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); 1627 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1);
1625 typedef double (*SimulatorRuntimeFPCall)(double darg0); 1628 typedef double (*SimulatorRuntimeFPCall)(double darg0);
1626 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); 1629 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0);
1627 1630
1628 // This signature supports direct call in to API function native callback 1631 // This signature supports direct call in to API function native callback
1629 // (refer to InvocationCallback in v8.h). 1632 // (refer to InvocationCallback in v8.h).
1630 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); 1633 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0);
1631 typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0); 1634 typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0);
1635 typedef v8::Handle<v8::Value> (*SimulatorRuntimeProfilingApiCall)(
1636 int32_t arg0, int32_t arg1);
1637 typedef void (*SimulatorRuntimeProfilingApiCallNew)(int32_t arg0, int32_t arg1);
1632 1638
1633 // This signature supports direct call to accessor getter callback. 1639 // This signature supports direct call to accessor getter callback.
1634 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, 1640 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0,
1635 int32_t arg1); 1641 int32_t arg1);
1636 typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0, 1642 typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0,
1637 int32_t arg1); 1643 int32_t arg1);
1644 typedef v8::Handle<v8::Value> (*SimulatorRuntimeProfilingGetterCall)(
1645 int32_t arg0, int32_t arg1, int32_t arg2);
1646 typedef void (*SimulatorRuntimeProfilingGetterCallNew)(
1647 int32_t arg0, int32_t arg1, int32_t arg2);
1638 1648
1639 // Software interrupt instructions are used by the simulator to call into the 1649 // Software interrupt instructions are used by the simulator to call into the
1640 // C-based V8 runtime. 1650 // C-based V8 runtime.
1641 void Simulator::SoftwareInterrupt(Instruction* instr) { 1651 void Simulator::SoftwareInterrupt(Instruction* instr) {
1642 int svc = instr->SvcValue(); 1652 int svc = instr->SvcValue();
1643 switch (svc) { 1653 switch (svc) {
1644 case kCallRtRedirected: { 1654 case kCallRtRedirected: {
1645 // Check if stack is aligned. Error if not aligned is reported below to 1655 // Check if stack is aligned. Error if not aligned is reported below to
1646 // include information on the function called. 1656 // include information on the function called.
1647 bool stack_aligned = 1657 bool stack_aligned =
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 if (::v8::internal::FLAG_trace_sim) { 1802 if (::v8::internal::FLAG_trace_sim) {
1793 PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); 1803 PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1794 } 1804 }
1795 set_register(r0, reinterpret_cast<int32_t>(*result)); 1805 set_register(r0, reinterpret_cast<int32_t>(*result));
1796 } else { 1806 } else {
1797 SimulatorRuntimeDirectApiCallNew target = 1807 SimulatorRuntimeDirectApiCallNew target =
1798 reinterpret_cast<SimulatorRuntimeDirectApiCallNew>(external); 1808 reinterpret_cast<SimulatorRuntimeDirectApiCallNew>(external);
1799 target(arg0); 1809 target(arg0);
1800 } 1810 }
1801 } else if ( 1811 } else if (
1812 redirection->type() == ExternalReference::PROFILING_API_CALL ||
1813 redirection->type() == ExternalReference::PROFILING_API_CALL_NEW) {
1814 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1815 PrintF("Call to host function at %p args %08x %08x",
1816 reinterpret_cast<void*>(external), arg0, arg1);
1817 if (!stack_aligned) {
1818 PrintF(" with unaligned stack %08x\n", get_register(sp));
1819 }
1820 PrintF("\n");
1821 }
1822 CHECK(stack_aligned);
1823 if (redirection->type() == ExternalReference::PROFILING_API_CALL) {
1824 SimulatorRuntimeProfilingApiCall target =
1825 reinterpret_cast<SimulatorRuntimeProfilingApiCall>(external);
1826 v8::Handle<v8::Value> result = target(arg0, arg1);
1827 if (::v8::internal::FLAG_trace_sim) {
1828 PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1829 }
1830 set_register(r0, reinterpret_cast<int32_t>(*result));
1831 } else {
1832 SimulatorRuntimeProfilingApiCallNew target =
1833 reinterpret_cast<SimulatorRuntimeProfilingApiCallNew>(external);
1834 target(arg0, arg1);
1835 }
1836 } else if (
1802 redirection->type() == ExternalReference::DIRECT_GETTER_CALL || 1837 redirection->type() == ExternalReference::DIRECT_GETTER_CALL ||
1803 redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) { 1838 redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) {
1804 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { 1839 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1805 PrintF("Call to host function at %p args %08x %08x", 1840 PrintF("Call to host function at %p args %08x %08x",
1806 reinterpret_cast<void*>(external), arg0, arg1); 1841 reinterpret_cast<void*>(external), arg0, arg1);
1807 if (!stack_aligned) { 1842 if (!stack_aligned) {
1808 PrintF(" with unaligned stack %08x\n", get_register(sp)); 1843 PrintF(" with unaligned stack %08x\n", get_register(sp));
1809 } 1844 }
1810 PrintF("\n"); 1845 PrintF("\n");
1811 } 1846 }
1812 CHECK(stack_aligned); 1847 CHECK(stack_aligned);
1813 if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { 1848 if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) {
1814 SimulatorRuntimeDirectGetterCall target = 1849 SimulatorRuntimeDirectGetterCall target =
1815 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external); 1850 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
1816 v8::Handle<v8::Value> result = target(arg0, arg1); 1851 v8::Handle<v8::Value> result = target(arg0, arg1);
1817 if (::v8::internal::FLAG_trace_sim) { 1852 if (::v8::internal::FLAG_trace_sim) {
1818 PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); 1853 PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1819 } 1854 }
1820 set_register(r0, reinterpret_cast<int32_t>(*result)); 1855 set_register(r0, reinterpret_cast<int32_t>(*result));
1821 } else { 1856 } else {
1822 SimulatorRuntimeDirectGetterCallNew target = 1857 SimulatorRuntimeDirectGetterCallNew target =
1823 reinterpret_cast<SimulatorRuntimeDirectGetterCallNew>(external); 1858 reinterpret_cast<SimulatorRuntimeDirectGetterCallNew>(external);
1824 target(arg0, arg1); 1859 target(arg0, arg1);
1825 } 1860 }
1861 } else if (
1862 redirection->type() == ExternalReference::PROFILING_GETTER_CALL ||
1863 redirection->type() == ExternalReference::PROFILING_GETTER_CALL_NEW) {
1864 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1865 PrintF("Call to host function at %p args %08x %08x %08x",
1866 reinterpret_cast<void*>(external), arg0, arg1, arg2);
1867 if (!stack_aligned) {
1868 PrintF(" with unaligned stack %08x\n", get_register(sp));
1869 }
1870 PrintF("\n");
1871 }
1872 CHECK(stack_aligned);
1873 if (redirection->type() == ExternalReference::PROFILING_GETTER_CALL) {
1874 SimulatorRuntimeProfilingGetterCall target =
1875 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external);
1876 v8::Handle<v8::Value> result = target(arg0, arg1, arg2);
1877 if (::v8::internal::FLAG_trace_sim) {
1878 PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
1879 }
1880 set_register(r0, reinterpret_cast<int32_t>(*result));
1881 } else {
1882 SimulatorRuntimeProfilingGetterCallNew target =
1883 reinterpret_cast<SimulatorRuntimeProfilingGetterCallNew>(
1884 external);
1885 target(arg0, arg1, arg2);
1886 }
1826 } else { 1887 } else {
1827 // builtin call. 1888 // builtin call.
1828 ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); 1889 ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL);
1829 SimulatorRuntimeCall target = 1890 SimulatorRuntimeCall target =
1830 reinterpret_cast<SimulatorRuntimeCall>(external); 1891 reinterpret_cast<SimulatorRuntimeCall>(external);
1831 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { 1892 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1832 PrintF( 1893 PrintF(
1833 "Call to host function at %p" 1894 "Call to host function at %p "
1834 "args %08x, %08x, %08x, %08x, %08x, %08x", 1895 "args %08x, %08x, %08x, %08x, %08x, %08x",
1835 FUNCTION_ADDR(target), 1896 FUNCTION_ADDR(target),
1836 arg0, 1897 arg0,
1837 arg1, 1898 arg1,
1838 arg2, 1899 arg2,
1839 arg3, 1900 arg3,
1840 arg4, 1901 arg4,
1841 arg5); 1902 arg5);
1842 if (!stack_aligned) { 1903 if (!stack_aligned) {
1843 PrintF(" with unaligned stack %08x\n", get_register(sp)); 1904 PrintF(" with unaligned stack %08x\n", get_register(sp));
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after
3516 uintptr_t address = *stack_slot; 3577 uintptr_t address = *stack_slot;
3517 set_register(sp, current_sp + sizeof(uintptr_t)); 3578 set_register(sp, current_sp + sizeof(uintptr_t));
3518 return address; 3579 return address;
3519 } 3580 }
3520 3581
3521 } } // namespace v8::internal 3582 } } // namespace v8::internal
3522 3583
3523 #endif // USE_SIMULATOR 3584 #endif // USE_SIMULATOR
3524 3585
3525 #endif // V8_TARGET_ARCH_ARM 3586 #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