OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 class FunctionPrototypeStub : public PlatformCodeStub { | 850 class FunctionPrototypeStub : public PlatformCodeStub { |
851 public: | 851 public: |
852 explicit FunctionPrototypeStub(Isolate* isolate) | 852 explicit FunctionPrototypeStub(Isolate* isolate) |
853 : PlatformCodeStub(isolate) {} | 853 : PlatformCodeStub(isolate) {} |
854 | 854 |
855 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 855 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
856 | 856 |
857 // TODO(mvstanton): only the receiver register is accessed. When this is | 857 // TODO(mvstanton): only the receiver register is accessed. When this is |
858 // translated to a hydrogen code stub, a new CallInterfaceDescriptor | 858 // translated to a hydrogen code stub, a new CallInterfaceDescriptor |
859 // should be created that just uses that register for more efficient code. | 859 // should be created that just uses that register for more efficient code. |
860 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 860 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 861 if (FLAG_vector_ics) { |
| 862 return VectorLoadICDescriptor(isolate()); |
| 863 } |
| 864 return LoadDescriptor(isolate()); |
| 865 } |
| 866 |
861 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); | 867 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); |
862 }; | 868 }; |
863 | 869 |
864 | 870 |
865 // TODO(mvstanton): Translate to hydrogen code stub. | 871 // TODO(mvstanton): Translate to hydrogen code stub. |
866 class LoadIndexedInterceptorStub : public PlatformCodeStub { | 872 class LoadIndexedInterceptorStub : public PlatformCodeStub { |
867 public: | 873 public: |
868 explicit LoadIndexedInterceptorStub(Isolate* isolate) | 874 explicit LoadIndexedInterceptorStub(Isolate* isolate) |
869 : PlatformCodeStub(isolate) {} | 875 : PlatformCodeStub(isolate) {} |
870 | 876 |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 | 1818 |
1813 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 1819 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
1814 }; | 1820 }; |
1815 | 1821 |
1816 | 1822 |
1817 class LoadDictionaryElementStub : public HydrogenCodeStub { | 1823 class LoadDictionaryElementStub : public HydrogenCodeStub { |
1818 public: | 1824 public: |
1819 explicit LoadDictionaryElementStub(Isolate* isolate) | 1825 explicit LoadDictionaryElementStub(Isolate* isolate) |
1820 : HydrogenCodeStub(isolate) {} | 1826 : HydrogenCodeStub(isolate) {} |
1821 | 1827 |
1822 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1828 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 1829 if (FLAG_vector_ics) { |
| 1830 return VectorLoadICDescriptor(isolate()); |
| 1831 } |
| 1832 return LoadDescriptor(isolate()); |
| 1833 } |
| 1834 |
1823 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); | 1835 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); |
1824 }; | 1836 }; |
1825 | 1837 |
1826 | 1838 |
1827 class KeyedLoadGenericStub : public HydrogenCodeStub { | 1839 class KeyedLoadGenericStub : public HydrogenCodeStub { |
1828 public: | 1840 public: |
1829 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 1841 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
1830 | 1842 |
1831 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } | 1843 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } |
1832 virtual InlineCacheState GetICState() const { return GENERIC; } | 1844 virtual InlineCacheState GetICState() const { return GENERIC; } |
1833 | 1845 |
| 1846 // Since KeyedLoadGeneric stub doesn't miss (simply calls runtime), it |
| 1847 // doesn't need to use the VectorLoadICDescriptor for the case when |
| 1848 // flag --vector-ics is true. |
1834 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1849 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
| 1850 |
1835 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); | 1851 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); |
1836 }; | 1852 }; |
1837 | 1853 |
1838 | 1854 |
1839 class LoadICTrampolineStub : public PlatformCodeStub { | 1855 class LoadICTrampolineStub : public PlatformCodeStub { |
1840 public: | 1856 public: |
1841 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) | 1857 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) |
1842 : PlatformCodeStub(isolate) { | 1858 : PlatformCodeStub(isolate) { |
1843 minor_key_ = state.GetExtraICState(); | 1859 minor_key_ = state.GetExtraICState(); |
1844 } | 1860 } |
1845 | 1861 |
1846 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1862 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
1847 | 1863 |
1848 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1864 virtual InlineCacheState GetICState() const FINAL OVERRIDE { return DEFAULT; } |
1849 return GENERIC; | |
1850 } | |
1851 | 1865 |
1852 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1866 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1853 return static_cast<ExtraICState>(minor_key_); | 1867 return static_cast<ExtraICState>(minor_key_); |
1854 } | 1868 } |
1855 | 1869 |
1856 private: | 1870 private: |
1857 LoadICState state() const { | 1871 LoadICState state() const { |
1858 return LoadICState(static_cast<ExtraICState>(minor_key_)); | 1872 return LoadICState(static_cast<ExtraICState>(minor_key_)); |
1859 } | 1873 } |
1860 | 1874 |
(...skipping 25 matching lines...) Expand all Loading... |
1886 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1900 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
1887 | 1901 |
1888 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1902 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
1889 return MEGAMORPHIC; | 1903 return MEGAMORPHIC; |
1890 } | 1904 } |
1891 | 1905 |
1892 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1906 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1893 return static_cast<ExtraICState>(sub_minor_key()); | 1907 return static_cast<ExtraICState>(sub_minor_key()); |
1894 } | 1908 } |
1895 | 1909 |
1896 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1910 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 1911 if (FLAG_vector_ics) { |
| 1912 return VectorLoadICDescriptor(isolate()); |
| 1913 } |
| 1914 return LoadDescriptor(isolate()); |
| 1915 } |
| 1916 |
1897 DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub); | 1917 DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub); |
1898 }; | 1918 }; |
1899 | 1919 |
1900 | 1920 |
1901 class VectorLoadStub : public HydrogenCodeStub { | 1921 class VectorLoadStub : public HydrogenCodeStub { |
1902 public: | 1922 public: |
1903 explicit VectorLoadStub(Isolate* isolate, const LoadICState& state) | 1923 explicit VectorLoadStub(Isolate* isolate, const LoadICState& state) |
1904 : HydrogenCodeStub(isolate) { | 1924 : HydrogenCodeStub(isolate) { |
1905 set_sub_minor_key(state.GetExtraICState()); | 1925 set_sub_minor_key(state.GetExtraICState()); |
1906 } | 1926 } |
1907 | 1927 |
1908 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1928 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
1909 | 1929 |
1910 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1930 virtual InlineCacheState GetICState() const FINAL OVERRIDE { return DEFAULT; } |
1911 return GENERIC; | |
1912 } | |
1913 | 1931 |
1914 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1932 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1915 return static_cast<ExtraICState>(sub_minor_key()); | 1933 return static_cast<ExtraICState>(sub_minor_key()); |
1916 } | 1934 } |
1917 | 1935 |
1918 private: | 1936 private: |
1919 LoadICState state() const { return LoadICState(GetExtraICState()); } | 1937 LoadICState state() const { return LoadICState(GetExtraICState()); } |
1920 | 1938 |
1921 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); | 1939 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); |
1922 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub); | 1940 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2014 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
1997 | 2015 |
1998 ElementsKind elements_kind() const { | 2016 ElementsKind elements_kind() const { |
1999 return ElementsKindBits::decode(sub_minor_key()); | 2017 return ElementsKindBits::decode(sub_minor_key()); |
2000 } | 2018 } |
2001 | 2019 |
2002 private: | 2020 private: |
2003 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2021 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2004 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 2022 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
2005 | 2023 |
2006 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 2024 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 2025 if (FLAG_vector_ics) { |
| 2026 return VectorLoadICDescriptor(isolate()); |
| 2027 } |
| 2028 return LoadDescriptor(isolate()); |
| 2029 } |
| 2030 |
2007 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub); | 2031 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub); |
2008 }; | 2032 }; |
2009 | 2033 |
2010 | 2034 |
2011 class StoreFastElementStub : public HydrogenCodeStub { | 2035 class StoreFastElementStub : public HydrogenCodeStub { |
2012 public: | 2036 public: |
2013 StoreFastElementStub(Isolate* isolate, bool is_js_array, | 2037 StoreFastElementStub(Isolate* isolate, bool is_js_array, |
2014 ElementsKind elements_kind, KeyedAccessStoreMode mode) | 2038 ElementsKind elements_kind, KeyedAccessStoreMode mode) |
2015 : HydrogenCodeStub(isolate) { | 2039 : HydrogenCodeStub(isolate) { |
2016 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 2040 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2486 | 2510 |
2487 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2511 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2488 #undef DEFINE_PLATFORM_CODE_STUB | 2512 #undef DEFINE_PLATFORM_CODE_STUB |
2489 #undef DEFINE_HANDLER_CODE_STUB | 2513 #undef DEFINE_HANDLER_CODE_STUB |
2490 #undef DEFINE_HYDROGEN_CODE_STUB | 2514 #undef DEFINE_HYDROGEN_CODE_STUB |
2491 #undef DEFINE_CODE_STUB | 2515 #undef DEFINE_CODE_STUB |
2492 #undef DEFINE_CODE_STUB_BASE | 2516 #undef DEFINE_CODE_STUB_BASE |
2493 } } // namespace v8::internal | 2517 } } // namespace v8::internal |
2494 | 2518 |
2495 #endif // V8_CODE_STUBS_H_ | 2519 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |