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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 V(FastCloneShallowObject) \ | 45 V(FastCloneShallowObject) \ |
46 V(CreateAllocationSite) \ | 46 V(CreateAllocationSite) \ |
47 V(ToBoolean) \ | 47 V(ToBoolean) \ |
48 V(ToNumber) \ | 48 V(ToNumber) \ |
49 V(ArgumentsAccess) \ | 49 V(ArgumentsAccess) \ |
50 V(RegExpConstructResult) \ | 50 V(RegExpConstructResult) \ |
51 V(NumberToString) \ | 51 V(NumberToString) \ |
52 V(DoubleToI) \ | 52 V(DoubleToI) \ |
53 V(CEntry) \ | 53 V(CEntry) \ |
54 V(JSEntry) \ | 54 V(JSEntry) \ |
55 V(KeyedLoadElement) \ | 55 V(LoadElement) \ |
56 V(KeyedLoadGeneric) \ | 56 V(KeyedLoadGeneric) \ |
57 V(ArrayNoArgumentConstructor) \ | 57 V(ArrayNoArgumentConstructor) \ |
58 V(ArraySingleArgumentConstructor) \ | 58 V(ArraySingleArgumentConstructor) \ |
59 V(ArrayNArgumentsConstructor) \ | 59 V(ArrayNArgumentsConstructor) \ |
60 V(InternalArrayNoArgumentConstructor) \ | 60 V(InternalArrayNoArgumentConstructor) \ |
61 V(InternalArraySingleArgumentConstructor) \ | 61 V(InternalArraySingleArgumentConstructor) \ |
62 V(InternalArrayNArgumentsConstructor) \ | 62 V(InternalArrayNArgumentsConstructor) \ |
63 V(KeyedStoreElement) \ | 63 V(StoreElement) \ |
64 V(DebuggerStatement) \ | 64 V(DebuggerStatement) \ |
65 V(NameDictionaryLookup) \ | 65 V(NameDictionaryLookup) \ |
66 V(ElementsTransitionAndStore) \ | 66 V(ElementsTransitionAndStore) \ |
67 V(TransitionElementsKind) \ | 67 V(TransitionElementsKind) \ |
68 V(StoreArrayLiteralElement) \ | 68 V(StoreArrayLiteralElement) \ |
69 V(StubFailureTrampoline) \ | 69 V(StubFailureTrampoline) \ |
70 V(ArrayConstructor) \ | 70 V(ArrayConstructor) \ |
71 V(InternalArrayConstructor) \ | 71 V(InternalArrayConstructor) \ |
72 V(ProfileEntryHook) \ | 72 V(ProfileEntryHook) \ |
73 V(StoreGlobal) \ | 73 V(StoreGlobal) \ |
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 } | 1836 } |
1837 | 1837 |
1838 private: | 1838 private: |
1839 StringCharCodeAtGenerator char_code_at_generator_; | 1839 StringCharCodeAtGenerator char_code_at_generator_; |
1840 StringCharFromCodeGenerator char_from_code_generator_; | 1840 StringCharFromCodeGenerator char_from_code_generator_; |
1841 | 1841 |
1842 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 1842 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
1843 }; | 1843 }; |
1844 | 1844 |
1845 | 1845 |
1846 class KeyedLoadDictionaryElementStub : public HydrogenCodeStub { | 1846 class LoadDictionaryElementStub : public HydrogenCodeStub { |
1847 public: | 1847 public: |
1848 explicit KeyedLoadDictionaryElementStub(Isolate* isolate) | 1848 explicit LoadDictionaryElementStub(Isolate* isolate) |
1849 : HydrogenCodeStub(isolate) {} | 1849 : HydrogenCodeStub(isolate) {} |
1850 | 1850 |
1851 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1851 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1852 | 1852 |
1853 virtual void InitializeInterfaceDescriptor( | 1853 virtual void InitializeInterfaceDescriptor( |
1854 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1854 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1855 | 1855 |
1856 private: | 1856 private: |
1857 Major MajorKey() const { return KeyedLoadElement; } | 1857 Major MajorKey() const { return LoadElement; } |
1858 int NotMissMinorKey() const { return DICTIONARY_ELEMENTS; } | 1858 int NotMissMinorKey() const { return DICTIONARY_ELEMENTS; } |
1859 | 1859 |
1860 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); | 1860 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementStub); |
1861 }; | 1861 }; |
1862 | 1862 |
1863 | 1863 |
1864 class KeyedLoadDictionaryElementPlatformStub : public PlatformCodeStub { | 1864 class LoadDictionaryElementPlatformStub : public PlatformCodeStub { |
1865 public: | 1865 public: |
1866 explicit KeyedLoadDictionaryElementPlatformStub(Isolate* isolate) | 1866 explicit LoadDictionaryElementPlatformStub(Isolate* isolate) |
1867 : PlatformCodeStub(isolate) {} | 1867 : PlatformCodeStub(isolate) {} |
1868 | 1868 |
1869 void Generate(MacroAssembler* masm); | 1869 void Generate(MacroAssembler* masm); |
1870 | 1870 |
1871 private: | 1871 private: |
1872 Major MajorKey() const { return KeyedLoadElement; } | 1872 Major MajorKey() const { return LoadElement; } |
1873 int MinorKey() const { return DICTIONARY_ELEMENTS; } | 1873 int MinorKey() const { return DICTIONARY_ELEMENTS; } |
1874 | 1874 |
1875 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementPlatformStub); | 1875 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementPlatformStub); |
1876 }; | 1876 }; |
1877 | 1877 |
1878 | 1878 |
1879 class KeyedLoadGenericElementStub : public HydrogenCodeStub { | 1879 class KeyedLoadGenericStub : public HydrogenCodeStub { |
1880 public: | 1880 public: |
1881 explicit KeyedLoadGenericElementStub(Isolate *isolate) | 1881 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
1882 : HydrogenCodeStub(isolate) {} | |
1883 | 1882 |
1884 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1883 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1885 | 1884 |
1886 virtual void InitializeInterfaceDescriptor( | 1885 virtual void InitializeInterfaceDescriptor( |
1887 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1886 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1888 | 1887 |
1889 static void InstallDescriptors(Isolate* isolate); | 1888 static void InstallDescriptors(Isolate* isolate); |
1890 | 1889 |
1891 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } | 1890 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } |
1892 virtual InlineCacheState GetICState() { return GENERIC; } | 1891 virtual InlineCacheState GetICState() { return GENERIC; } |
1893 | 1892 |
1894 private: | 1893 private: |
1895 Major MajorKey() const { return KeyedLoadGeneric; } | 1894 Major MajorKey() const { return KeyedLoadGeneric; } |
1896 int NotMissMinorKey() const { return 0; } | 1895 int NotMissMinorKey() const { return 0; } |
1897 | 1896 |
1898 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericElementStub); | 1897 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericStub); |
1899 }; | 1898 }; |
1900 | 1899 |
1901 | 1900 |
1902 class DoubleToIStub : public PlatformCodeStub { | 1901 class DoubleToIStub : public PlatformCodeStub { |
1903 public: | 1902 public: |
1904 DoubleToIStub(Isolate* isolate, | 1903 DoubleToIStub(Isolate* isolate, |
1905 Register source, | 1904 Register source, |
1906 Register destination, | 1905 Register destination, |
1907 int offset, | 1906 int offset, |
1908 bool is_truncating, | 1907 bool is_truncating, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 | 1958 |
1960 Major MajorKey() const { return DoubleToI; } | 1959 Major MajorKey() const { return DoubleToI; } |
1961 int MinorKey() const { return bit_field_; } | 1960 int MinorKey() const { return bit_field_; } |
1962 | 1961 |
1963 int bit_field_; | 1962 int bit_field_; |
1964 | 1963 |
1965 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); | 1964 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); |
1966 }; | 1965 }; |
1967 | 1966 |
1968 | 1967 |
1969 class KeyedLoadFastElementStub : public HydrogenCodeStub { | 1968 class LoadFastElementStub : public HydrogenCodeStub { |
1970 public: | 1969 public: |
1971 KeyedLoadFastElementStub(Isolate* isolate, | 1970 LoadFastElementStub(Isolate* isolate, bool is_js_array, |
1972 bool is_js_array, | 1971 ElementsKind elements_kind) |
1973 ElementsKind elements_kind) | |
1974 : HydrogenCodeStub(isolate) { | 1972 : HydrogenCodeStub(isolate) { |
1975 bit_field_ = ElementsKindBits::encode(elements_kind) | | 1973 bit_field_ = ElementsKindBits::encode(elements_kind) | |
1976 IsJSArrayBits::encode(is_js_array); | 1974 IsJSArrayBits::encode(is_js_array); |
1977 } | 1975 } |
1978 | 1976 |
1979 bool is_js_array() const { | 1977 bool is_js_array() const { |
1980 return IsJSArrayBits::decode(bit_field_); | 1978 return IsJSArrayBits::decode(bit_field_); |
1981 } | 1979 } |
1982 | 1980 |
1983 ElementsKind elements_kind() const { | 1981 ElementsKind elements_kind() const { |
1984 return ElementsKindBits::decode(bit_field_); | 1982 return ElementsKindBits::decode(bit_field_); |
1985 } | 1983 } |
1986 | 1984 |
1987 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1985 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1988 | 1986 |
1989 virtual void InitializeInterfaceDescriptor( | 1987 virtual void InitializeInterfaceDescriptor( |
1990 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1988 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1991 | 1989 |
1992 private: | 1990 private: |
1993 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1991 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
1994 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 1992 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
1995 uint32_t bit_field_; | 1993 uint32_t bit_field_; |
1996 | 1994 |
1997 Major MajorKey() const { return KeyedLoadElement; } | 1995 Major MajorKey() const { return LoadElement; } |
1998 int NotMissMinorKey() const { return bit_field_; } | 1996 int NotMissMinorKey() const { return bit_field_; } |
1999 | 1997 |
2000 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); | 1998 DISALLOW_COPY_AND_ASSIGN(LoadFastElementStub); |
2001 }; | 1999 }; |
2002 | 2000 |
2003 | 2001 |
2004 class KeyedStoreFastElementStub : public HydrogenCodeStub { | 2002 class StoreFastElementStub : public HydrogenCodeStub { |
2005 public: | 2003 public: |
2006 KeyedStoreFastElementStub(Isolate* isolate, | 2004 StoreFastElementStub(Isolate* isolate, bool is_js_array, |
2007 bool is_js_array, | 2005 ElementsKind elements_kind, KeyedAccessStoreMode mode) |
2008 ElementsKind elements_kind, | |
2009 KeyedAccessStoreMode mode) | |
2010 : HydrogenCodeStub(isolate) { | 2006 : HydrogenCodeStub(isolate) { |
2011 bit_field_ = ElementsKindBits::encode(elements_kind) | | 2007 bit_field_ = ElementsKindBits::encode(elements_kind) | |
2012 IsJSArrayBits::encode(is_js_array) | | 2008 IsJSArrayBits::encode(is_js_array) | |
2013 StoreModeBits::encode(mode); | 2009 StoreModeBits::encode(mode); |
2014 } | 2010 } |
2015 | 2011 |
2016 bool is_js_array() const { | 2012 bool is_js_array() const { |
2017 return IsJSArrayBits::decode(bit_field_); | 2013 return IsJSArrayBits::decode(bit_field_); |
2018 } | 2014 } |
2019 | 2015 |
2020 ElementsKind elements_kind() const { | 2016 ElementsKind elements_kind() const { |
2021 return ElementsKindBits::decode(bit_field_); | 2017 return ElementsKindBits::decode(bit_field_); |
2022 } | 2018 } |
2023 | 2019 |
2024 KeyedAccessStoreMode store_mode() const { | 2020 KeyedAccessStoreMode store_mode() const { |
2025 return StoreModeBits::decode(bit_field_); | 2021 return StoreModeBits::decode(bit_field_); |
2026 } | 2022 } |
2027 | 2023 |
2028 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2024 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2029 | 2025 |
2030 virtual void InitializeInterfaceDescriptor( | 2026 virtual void InitializeInterfaceDescriptor( |
2031 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2027 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2032 | 2028 |
2033 private: | 2029 private: |
2034 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2030 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2035 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2031 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; |
2036 class IsJSArrayBits: public BitField<bool, 12, 1> {}; | 2032 class IsJSArrayBits: public BitField<bool, 12, 1> {}; |
2037 uint32_t bit_field_; | 2033 uint32_t bit_field_; |
2038 | 2034 |
2039 Major MajorKey() const { return KeyedStoreElement; } | 2035 Major MajorKey() const { return StoreElement; } |
2040 int NotMissMinorKey() const { return bit_field_; } | 2036 int NotMissMinorKey() const { return bit_field_; } |
2041 | 2037 |
2042 DISALLOW_COPY_AND_ASSIGN(KeyedStoreFastElementStub); | 2038 DISALLOW_COPY_AND_ASSIGN(StoreFastElementStub); |
2043 }; | 2039 }; |
2044 | 2040 |
2045 | 2041 |
2046 class TransitionElementsKindStub : public HydrogenCodeStub { | 2042 class TransitionElementsKindStub : public HydrogenCodeStub { |
2047 public: | 2043 public: |
2048 TransitionElementsKindStub(Isolate* isolate, | 2044 TransitionElementsKindStub(Isolate* isolate, |
2049 ElementsKind from_kind, | 2045 ElementsKind from_kind, |
2050 ElementsKind to_kind, | 2046 ElementsKind to_kind, |
2051 bool is_js_array) : HydrogenCodeStub(isolate) { | 2047 bool is_js_array) : HydrogenCodeStub(isolate) { |
2052 bit_field_ = FromKindBits::encode(from_kind) | | 2048 bit_field_ = FromKindBits::encode(from_kind) | |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2280 virtual void InitializeInterfaceDescriptor( | 2276 virtual void InitializeInterfaceDescriptor( |
2281 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2277 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2282 | 2278 |
2283 private: | 2279 private: |
2284 Major MajorKey() const { return InternalArrayNArgumentsConstructor; } | 2280 Major MajorKey() const { return InternalArrayNArgumentsConstructor; } |
2285 | 2281 |
2286 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); | 2282 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); |
2287 }; | 2283 }; |
2288 | 2284 |
2289 | 2285 |
2290 class KeyedStoreElementStub : public PlatformCodeStub { | 2286 class StoreElementStub : public PlatformCodeStub { |
2291 public: | 2287 public: |
2292 KeyedStoreElementStub(Isolate* isolate, | 2288 StoreElementStub(Isolate* isolate, bool is_js_array, |
2293 bool is_js_array, | 2289 ElementsKind elements_kind, KeyedAccessStoreMode store_mode) |
2294 ElementsKind elements_kind, | |
2295 KeyedAccessStoreMode store_mode) | |
2296 : PlatformCodeStub(isolate), | 2290 : PlatformCodeStub(isolate), |
2297 is_js_array_(is_js_array), | 2291 is_js_array_(is_js_array), |
2298 elements_kind_(elements_kind), | 2292 elements_kind_(elements_kind), |
2299 store_mode_(store_mode) { } | 2293 store_mode_(store_mode) {} |
2300 | 2294 |
2301 Major MajorKey() const { return KeyedStoreElement; } | 2295 Major MajorKey() const { return StoreElement; } |
2302 int MinorKey() const { | 2296 int MinorKey() const { |
2303 return ElementsKindBits::encode(elements_kind_) | | 2297 return ElementsKindBits::encode(elements_kind_) | |
2304 IsJSArrayBits::encode(is_js_array_) | | 2298 IsJSArrayBits::encode(is_js_array_) | |
2305 StoreModeBits::encode(store_mode_); | 2299 StoreModeBits::encode(store_mode_); |
2306 } | 2300 } |
2307 | 2301 |
2308 void Generate(MacroAssembler* masm); | 2302 void Generate(MacroAssembler* masm); |
2309 | 2303 |
2310 private: | 2304 private: |
2311 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2305 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2312 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2306 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; |
2313 class IsJSArrayBits: public BitField<bool, 12, 1> {}; | 2307 class IsJSArrayBits: public BitField<bool, 12, 1> {}; |
2314 | 2308 |
2315 bool is_js_array_; | 2309 bool is_js_array_; |
2316 ElementsKind elements_kind_; | 2310 ElementsKind elements_kind_; |
2317 KeyedAccessStoreMode store_mode_; | 2311 KeyedAccessStoreMode store_mode_; |
2318 | 2312 |
2319 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); | 2313 DISALLOW_COPY_AND_ASSIGN(StoreElementStub); |
2320 }; | 2314 }; |
2321 | 2315 |
2322 | 2316 |
2323 class ToBooleanStub: public HydrogenCodeStub { | 2317 class ToBooleanStub: public HydrogenCodeStub { |
2324 public: | 2318 public: |
2325 enum Type { | 2319 enum Type { |
2326 UNDEFINED, | 2320 UNDEFINED, |
2327 BOOLEAN, | 2321 BOOLEAN, |
2328 NULL_TYPE, | 2322 NULL_TYPE, |
2329 SMI, | 2323 SMI, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2529 | 2523 |
2530 | 2524 |
2531 class CallDescriptors { | 2525 class CallDescriptors { |
2532 public: | 2526 public: |
2533 static void InitializeForIsolate(Isolate* isolate); | 2527 static void InitializeForIsolate(Isolate* isolate); |
2534 }; | 2528 }; |
2535 | 2529 |
2536 } } // namespace v8::internal | 2530 } } // namespace v8::internal |
2537 | 2531 |
2538 #endif // V8_CODE_STUBS_H_ | 2532 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |