| 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 29 matching lines...) Expand all Loading... |
| 40 V(DoubleToI) \ | 40 V(DoubleToI) \ |
| 41 V(FunctionPrototype) \ | 41 V(FunctionPrototype) \ |
| 42 V(InternalArrayConstructor) \ | 42 V(InternalArrayConstructor) \ |
| 43 V(JSEntry) \ | 43 V(JSEntry) \ |
| 44 V(LoadIndexedString) \ | 44 V(LoadIndexedString) \ |
| 45 V(MathPow) \ | 45 V(MathPow) \ |
| 46 V(ProfileEntryHook) \ | 46 V(ProfileEntryHook) \ |
| 47 V(RecordWrite) \ | 47 V(RecordWrite) \ |
| 48 V(RegExpExec) \ | 48 V(RegExpExec) \ |
| 49 V(StoreBufferOverflow) \ | 49 V(StoreBufferOverflow) \ |
| 50 V(StoreElement) \ | 50 V(StoreSlowElement) \ |
| 51 V(SubString) \ | 51 V(SubString) \ |
| 52 V(FastNewRestParameter) \ | 52 V(FastNewRestParameter) \ |
| 53 V(FastNewSloppyArguments) \ | 53 V(FastNewSloppyArguments) \ |
| 54 V(FastNewStrictArguments) \ | 54 V(FastNewStrictArguments) \ |
| 55 V(NameDictionaryLookup) \ | 55 V(NameDictionaryLookup) \ |
| 56 /* This can be removed once there are no */ \ | 56 /* This can be removed once there are no */ \ |
| 57 /* more deopting Hydrogen stubs. */ \ | 57 /* more deopting Hydrogen stubs. */ \ |
| 58 V(StubFailureTrampoline) \ | 58 V(StubFailureTrampoline) \ |
| 59 /* These are only called from FCG */ \ | 59 /* These are only called from FCG */ \ |
| 60 /* They can be removed when only the TF */ \ | 60 /* They can be removed when only the TF */ \ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 V(KeyedLoadSloppyArguments) \ | 98 V(KeyedLoadSloppyArguments) \ |
| 99 V(KeyedStoreSloppyArguments) \ | 99 V(KeyedStoreSloppyArguments) \ |
| 100 V(LoadScriptContextField) \ | 100 V(LoadScriptContextField) \ |
| 101 V(StoreScriptContextField) \ | 101 V(StoreScriptContextField) \ |
| 102 V(NumberToString) \ | 102 V(NumberToString) \ |
| 103 V(StringAdd) \ | 103 V(StringAdd) \ |
| 104 V(GetProperty) \ | 104 V(GetProperty) \ |
| 105 V(StoreFastElement) \ | 105 V(StoreFastElement) \ |
| 106 V(StoreGlobal) \ | 106 V(StoreGlobal) \ |
| 107 V(StoreInterceptor) \ | 107 V(StoreInterceptor) \ |
| 108 V(LoadApiGetter) \ | |
| 109 V(LoadIndexedInterceptor) \ | 108 V(LoadIndexedInterceptor) \ |
| 110 V(GrowArrayElements) | 109 V(GrowArrayElements) |
| 111 | 110 |
| 112 // List of code stubs only used on ARM 32 bits platforms. | 111 // List of code stubs only used on ARM 32 bits platforms. |
| 113 #if V8_TARGET_ARCH_ARM | 112 #if V8_TARGET_ARCH_ARM |
| 114 #define CODE_STUB_LIST_ARM(V) V(DirectCEntry) | 113 #define CODE_STUB_LIST_ARM(V) V(DirectCEntry) |
| 115 | 114 |
| 116 #else | 115 #else |
| 117 #define CODE_STUB_LIST_ARM(V) | 116 #define CODE_STUB_LIST_ARM(V) |
| 118 #endif | 117 #endif |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 } | 997 } |
| 999 | 998 |
| 1000 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 999 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 1001 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } | 1000 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } |
| 1002 | 1001 |
| 1003 protected: | 1002 protected: |
| 1004 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); | 1003 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
| 1005 DEFINE_TURBOFAN_CODE_STUB(KeyedStoreSloppyArguments, TurboFanCodeStub); | 1004 DEFINE_TURBOFAN_CODE_STUB(KeyedStoreSloppyArguments, TurboFanCodeStub); |
| 1006 }; | 1005 }; |
| 1007 | 1006 |
| 1008 class LoadApiGetterStub : public TurboFanCodeStub { | |
| 1009 public: | |
| 1010 LoadApiGetterStub(Isolate* isolate, bool receiver_is_holder, int index) | |
| 1011 : TurboFanCodeStub(isolate) { | |
| 1012 // If that's not true, we need to ensure that the receiver is actually a | |
| 1013 // JSReceiver. http://crbug.com/609134 | |
| 1014 DCHECK(receiver_is_holder); | |
| 1015 minor_key_ = IndexBits::encode(index) | | |
| 1016 ReceiverIsHolderBits::encode(receiver_is_holder); | |
| 1017 } | |
| 1018 | |
| 1019 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | |
| 1020 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } | |
| 1021 | |
| 1022 int index() const { return IndexBits::decode(minor_key_); } | |
| 1023 bool receiver_is_holder() const { | |
| 1024 return ReceiverIsHolderBits::decode(minor_key_); | |
| 1025 } | |
| 1026 | |
| 1027 private: | |
| 1028 class ReceiverIsHolderBits : public BitField<bool, 0, 1> {}; | |
| 1029 class IndexBits : public BitField<int, 1, kDescriptorIndexBitCount> {}; | |
| 1030 | |
| 1031 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | |
| 1032 DEFINE_TURBOFAN_CODE_STUB(LoadApiGetter, TurboFanCodeStub); | |
| 1033 }; | |
| 1034 | |
| 1035 class StoreGlobalStub : public TurboFanCodeStub { | 1007 class StoreGlobalStub : public TurboFanCodeStub { |
| 1036 public: | 1008 public: |
| 1037 StoreGlobalStub(Isolate* isolate, PropertyCellType type, | 1009 StoreGlobalStub(Isolate* isolate, PropertyCellType type, |
| 1038 Maybe<PropertyCellConstantType> constant_type, | 1010 Maybe<PropertyCellConstantType> constant_type, |
| 1039 bool check_global) | 1011 bool check_global) |
| 1040 : TurboFanCodeStub(isolate) { | 1012 : TurboFanCodeStub(isolate) { |
| 1041 PropertyCellConstantType encoded_constant_type = | 1013 PropertyCellConstantType encoded_constant_type = |
| 1042 constant_type.FromMaybe(PropertyCellConstantType::kSmi); | 1014 constant_type.FromMaybe(PropertyCellConstantType::kSmi); |
| 1043 minor_key_ = CellTypeBits::encode(type) | | 1015 minor_key_ = CellTypeBits::encode(type) | |
| 1044 ConstantTypeBits::encode(encoded_constant_type) | | 1016 ConstantTypeBits::encode(encoded_constant_type) | |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 : PlatformCodeStub(isolate) {} | 1893 : PlatformCodeStub(isolate) {} |
| 1922 | 1894 |
| 1923 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | 1895 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
| 1924 return ArrayNArgumentsConstructorDescriptor(isolate()); | 1896 return ArrayNArgumentsConstructorDescriptor(isolate()); |
| 1925 } | 1897 } |
| 1926 | 1898 |
| 1927 private: | 1899 private: |
| 1928 DEFINE_PLATFORM_CODE_STUB(ArrayNArgumentsConstructor, PlatformCodeStub); | 1900 DEFINE_PLATFORM_CODE_STUB(ArrayNArgumentsConstructor, PlatformCodeStub); |
| 1929 }; | 1901 }; |
| 1930 | 1902 |
| 1931 class StoreElementStub : public PlatformCodeStub { | 1903 class StoreSlowElementStub : public TurboFanCodeStub { |
| 1932 public: | 1904 public: |
| 1933 StoreElementStub(Isolate* isolate, ElementsKind elements_kind, | 1905 StoreSlowElementStub(Isolate* isolate, KeyedAccessStoreMode mode) |
| 1934 KeyedAccessStoreMode mode) | 1906 : TurboFanCodeStub(isolate) { |
| 1935 : PlatformCodeStub(isolate) { | 1907 minor_key_ = CommonStoreModeBits::encode(mode); |
| 1936 // TODO(jkummerow): Rename this stub to StoreSlowElementStub, | |
| 1937 // drop elements_kind parameter. | |
| 1938 DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind); | |
| 1939 minor_key_ = ElementsKindBits::encode(elements_kind) | | |
| 1940 CommonStoreModeBits::encode(mode); | |
| 1941 } | 1908 } |
| 1942 | 1909 |
| 1943 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 1910 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 1944 ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; } | 1911 ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; } |
| 1945 | 1912 |
| 1946 private: | 1913 private: |
| 1947 ElementsKind elements_kind() const { | |
| 1948 return ElementsKindBits::decode(minor_key_); | |
| 1949 } | |
| 1950 | |
| 1951 class ElementsKindBits | |
| 1952 : public BitField<ElementsKind, CommonStoreModeBits::kNext, 8> {}; | |
| 1953 | |
| 1954 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); | 1914 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
| 1955 DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub); | 1915 DEFINE_TURBOFAN_CODE_STUB(StoreSlowElement, TurboFanCodeStub); |
| 1956 }; | 1916 }; |
| 1957 | 1917 |
| 1958 class ToBooleanICStub : public HydrogenCodeStub { | 1918 class ToBooleanICStub : public HydrogenCodeStub { |
| 1959 public: | 1919 public: |
| 1960 ToBooleanICStub(Isolate* isolate, ExtraICState state) | 1920 ToBooleanICStub(Isolate* isolate, ExtraICState state) |
| 1961 : HydrogenCodeStub(isolate) { | 1921 : HydrogenCodeStub(isolate) { |
| 1962 set_sub_minor_key(HintsBits::encode(static_cast<uint16_t>(state))); | 1922 set_sub_minor_key(HintsBits::encode(static_cast<uint16_t>(state))); |
| 1963 } | 1923 } |
| 1964 | 1924 |
| 1965 bool UpdateStatus(Handle<Object> object); | 1925 bool UpdateStatus(Handle<Object> object); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 #undef DEFINE_PLATFORM_CODE_STUB | 2070 #undef DEFINE_PLATFORM_CODE_STUB |
| 2111 #undef DEFINE_HANDLER_CODE_STUB | 2071 #undef DEFINE_HANDLER_CODE_STUB |
| 2112 #undef DEFINE_HYDROGEN_CODE_STUB | 2072 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2113 #undef DEFINE_CODE_STUB | 2073 #undef DEFINE_CODE_STUB |
| 2114 #undef DEFINE_CODE_STUB_BASE | 2074 #undef DEFINE_CODE_STUB_BASE |
| 2115 | 2075 |
| 2116 } // namespace internal | 2076 } // namespace internal |
| 2117 } // namespace v8 | 2077 } // namespace v8 |
| 2118 | 2078 |
| 2119 #endif // V8_CODE_STUBS_H_ | 2079 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |