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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 V(LoadDictionaryElement) \ | 78 V(LoadDictionaryElement) \ |
79 V(NameDictionaryLookup) \ | 79 V(NameDictionaryLookup) \ |
80 V(NumberToString) \ | 80 V(NumberToString) \ |
81 V(Typeof) \ | 81 V(Typeof) \ |
82 V(RegExpConstructResult) \ | 82 V(RegExpConstructResult) \ |
83 V(StoreFastElement) \ | 83 V(StoreFastElement) \ |
84 V(StoreScriptContextField) \ | 84 V(StoreScriptContextField) \ |
85 V(StringAdd) \ | 85 V(StringAdd) \ |
86 V(ToBoolean) \ | 86 V(ToBoolean) \ |
87 V(TransitionElementsKind) \ | 87 V(TransitionElementsKind) \ |
88 V(VectorRawKeyedLoad) \ | 88 V(KeyedLoadIC) \ |
89 V(VectorRawLoad) \ | 89 V(LoadIC) \ |
90 /* TurboFanCodeStubs */ \ | 90 /* TurboFanCodeStubs */ \ |
91 V(StringLengthTF) \ | 91 V(StringLengthTF) \ |
92 V(MathFloor) \ | 92 V(MathFloor) \ |
93 /* IC Handler stubs */ \ | 93 /* IC Handler stubs */ \ |
94 V(ArrayBufferViewLoadField) \ | 94 V(ArrayBufferViewLoadField) \ |
95 V(LoadConstant) \ | 95 V(LoadConstant) \ |
96 V(LoadFastElement) \ | 96 V(LoadFastElement) \ |
97 V(LoadField) \ | 97 V(LoadField) \ |
98 V(KeyedLoadSloppyArguments) \ | 98 V(KeyedLoadSloppyArguments) \ |
99 V(StoreField) \ | 99 V(StoreField) \ |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 }; | 620 }; |
621 | 621 |
622 | 622 |
623 class MathFloorStub : public TurboFanCodeStub { | 623 class MathFloorStub : public TurboFanCodeStub { |
624 DEFINE_TURBOFAN_CODE_STUB(MathFloor, TurboFanCodeStub, | 624 DEFINE_TURBOFAN_CODE_STUB(MathFloor, TurboFanCodeStub, |
625 MathRoundVariantDescriptor, 1); | 625 MathRoundVariantDescriptor, 1); |
626 }; | 626 }; |
627 | 627 |
628 | 628 |
629 class StringLengthTFStub : public TurboFanCodeStub { | 629 class StringLengthTFStub : public TurboFanCodeStub { |
630 DEFINE_TURBOFAN_CODE_STUB(StringLengthTF, TurboFanCodeStub, LoadDescriptor, | 630 DEFINE_TURBOFAN_CODE_STUB(StringLengthTF, TurboFanCodeStub, |
631 0); | 631 LoadWithVectorDescriptor, 0); |
632 | 632 |
633 public: | 633 public: |
634 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 634 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
635 InlineCacheState GetICState() const override { return MONOMORPHIC; } | 635 InlineCacheState GetICState() const override { return MONOMORPHIC; } |
636 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } | 636 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } |
637 }; | 637 }; |
638 | 638 |
639 | 639 |
640 class NumberToStringStub final : public HydrogenCodeStub { | 640 class NumberToStringStub final : public HydrogenCodeStub { |
641 public: | 641 public: |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 public: | 979 public: |
980 explicit FunctionPrototypeStub(Isolate* isolate) | 980 explicit FunctionPrototypeStub(Isolate* isolate) |
981 : PlatformCodeStub(isolate) {} | 981 : PlatformCodeStub(isolate) {} |
982 | 982 |
983 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 983 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
984 | 984 |
985 // TODO(mvstanton): only the receiver register is accessed. When this is | 985 // TODO(mvstanton): only the receiver register is accessed. When this is |
986 // translated to a hydrogen code stub, a new CallInterfaceDescriptor | 986 // translated to a hydrogen code stub, a new CallInterfaceDescriptor |
987 // should be created that just uses that register for more efficient code. | 987 // should be created that just uses that register for more efficient code. |
988 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { | 988 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { |
989 return VectorLoadICDescriptor(isolate()); | 989 return LoadWithVectorDescriptor(isolate()); |
990 } | 990 } |
991 | 991 |
992 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); | 992 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); |
993 }; | 993 }; |
994 | 994 |
995 | 995 |
996 // TODO(mvstanton): Translate to hydrogen code stub. | 996 // TODO(mvstanton): Translate to hydrogen code stub. |
997 class LoadIndexedInterceptorStub : public PlatformCodeStub { | 997 class LoadIndexedInterceptorStub : public PlatformCodeStub { |
998 public: | 998 public: |
999 explicit LoadIndexedInterceptorStub(Isolate* isolate) | 999 explicit LoadIndexedInterceptorStub(Isolate* isolate) |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 2070 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
2071 }; | 2071 }; |
2072 | 2072 |
2073 | 2073 |
2074 class LoadDictionaryElementStub : public HydrogenCodeStub { | 2074 class LoadDictionaryElementStub : public HydrogenCodeStub { |
2075 public: | 2075 public: |
2076 explicit LoadDictionaryElementStub(Isolate* isolate) | 2076 explicit LoadDictionaryElementStub(Isolate* isolate) |
2077 : HydrogenCodeStub(isolate) {} | 2077 : HydrogenCodeStub(isolate) {} |
2078 | 2078 |
2079 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { | 2079 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { |
2080 return VectorLoadICDescriptor(isolate()); | 2080 return LoadWithVectorDescriptor(isolate()); |
2081 } | 2081 } |
2082 | 2082 |
2083 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); | 2083 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); |
2084 }; | 2084 }; |
2085 | 2085 |
2086 | 2086 |
2087 class KeyedLoadGenericStub : public HydrogenCodeStub { | 2087 class KeyedLoadGenericStub : public HydrogenCodeStub { |
2088 public: | 2088 public: |
2089 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 2089 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
2090 | 2090 |
2091 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } | 2091 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } |
2092 InlineCacheState GetICState() const override { return GENERIC; } | 2092 InlineCacheState GetICState() const override { return GENERIC; } |
2093 | 2093 |
2094 // Since KeyedLoadGeneric stub doesn't miss (simply calls runtime), it | |
2095 // doesn't need to use the VectorLoadICDescriptor for the case when | |
2096 // flag --vector-ics is true. | |
2097 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 2094 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
2098 | 2095 |
2099 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); | 2096 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); |
2100 }; | 2097 }; |
2101 | 2098 |
2102 | 2099 |
2103 class LoadICTrampolineStub : public PlatformCodeStub { | 2100 class LoadICTrampolineStub : public PlatformCodeStub { |
2104 public: | 2101 public: |
2105 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) | 2102 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) |
2106 : PlatformCodeStub(isolate) { | 2103 : PlatformCodeStub(isolate) { |
2107 minor_key_ = state.GetExtraICState(); | 2104 minor_key_ = state.GetExtraICState(); |
2108 } | 2105 } |
2109 | 2106 |
2110 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2107 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2111 | 2108 |
2112 InlineCacheState GetICState() const final { return DEFAULT; } | 2109 InlineCacheState GetICState() const final { return DEFAULT; } |
2113 | 2110 |
2114 ExtraICState GetExtraICState() const final { | 2111 ExtraICState GetExtraICState() const final { |
2115 return static_cast<ExtraICState>(minor_key_); | 2112 return static_cast<ExtraICState>(minor_key_); |
2116 } | 2113 } |
2117 | 2114 |
2118 private: | 2115 private: |
2119 LoadICState state() const { | 2116 LoadICState state() const { |
2120 return LoadICState(static_cast<ExtraICState>(minor_key_)); | 2117 return LoadICState(static_cast<ExtraICState>(minor_key_)); |
2121 } | 2118 } |
2122 | 2119 |
2123 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline); | 2120 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
2124 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); | 2121 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); |
2125 }; | 2122 }; |
2126 | 2123 |
2127 | 2124 |
2128 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { | 2125 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { |
2129 public: | 2126 public: |
2130 explicit KeyedLoadICTrampolineStub(Isolate* isolate) | 2127 explicit KeyedLoadICTrampolineStub(Isolate* isolate) |
2131 : LoadICTrampolineStub(isolate, LoadICState(0)) {} | 2128 : LoadICTrampolineStub(isolate, LoadICState(0)) {} |
2132 | 2129 |
2133 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } | 2130 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } |
(...skipping 30 matching lines...) Expand all Loading... |
2164 class CallIC_ArrayTrampolineStub : public CallICTrampolineStub { | 2161 class CallIC_ArrayTrampolineStub : public CallICTrampolineStub { |
2165 public: | 2162 public: |
2166 CallIC_ArrayTrampolineStub(Isolate* isolate, const CallICState& state) | 2163 CallIC_ArrayTrampolineStub(Isolate* isolate, const CallICState& state) |
2167 : CallICTrampolineStub(isolate, state) {} | 2164 : CallICTrampolineStub(isolate, state) {} |
2168 | 2165 |
2169 private: | 2166 private: |
2170 DEFINE_PLATFORM_CODE_STUB(CallIC_ArrayTrampoline, CallICTrampolineStub); | 2167 DEFINE_PLATFORM_CODE_STUB(CallIC_ArrayTrampoline, CallICTrampolineStub); |
2171 }; | 2168 }; |
2172 | 2169 |
2173 | 2170 |
2174 class VectorRawLoadStub : public PlatformCodeStub { | 2171 class LoadICStub : public PlatformCodeStub { |
2175 public: | 2172 public: |
2176 explicit VectorRawLoadStub(Isolate* isolate, const LoadICState& state) | 2173 explicit LoadICStub(Isolate* isolate, const LoadICState& state) |
2177 : PlatformCodeStub(isolate) { | 2174 : PlatformCodeStub(isolate) { |
2178 minor_key_ = state.GetExtraICState(); | 2175 minor_key_ = state.GetExtraICState(); |
2179 } | 2176 } |
2180 | 2177 |
2181 void GenerateForTrampoline(MacroAssembler* masm); | 2178 void GenerateForTrampoline(MacroAssembler* masm); |
2182 | 2179 |
2183 virtual Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2180 virtual Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2184 | 2181 |
2185 virtual InlineCacheState GetICState() const final override { return DEFAULT; } | 2182 virtual InlineCacheState GetICState() const final override { return DEFAULT; } |
2186 | 2183 |
2187 virtual ExtraICState GetExtraICState() const final override { | 2184 virtual ExtraICState GetExtraICState() const final override { |
2188 return static_cast<ExtraICState>(minor_key_); | 2185 return static_cast<ExtraICState>(minor_key_); |
2189 } | 2186 } |
2190 | 2187 |
2191 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); | 2188 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2192 DEFINE_PLATFORM_CODE_STUB(VectorRawLoad, PlatformCodeStub); | 2189 DEFINE_PLATFORM_CODE_STUB(LoadIC, PlatformCodeStub); |
2193 | 2190 |
2194 protected: | 2191 protected: |
2195 void GenerateImpl(MacroAssembler* masm, bool in_frame); | 2192 void GenerateImpl(MacroAssembler* masm, bool in_frame); |
2196 }; | 2193 }; |
2197 | 2194 |
2198 | 2195 |
2199 class VectorRawKeyedLoadStub : public PlatformCodeStub { | 2196 class KeyedLoadICStub : public PlatformCodeStub { |
2200 public: | 2197 public: |
2201 explicit VectorRawKeyedLoadStub(Isolate* isolate) | 2198 explicit KeyedLoadICStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
2202 : PlatformCodeStub(isolate) {} | |
2203 | 2199 |
2204 void GenerateForTrampoline(MacroAssembler* masm); | 2200 void GenerateForTrampoline(MacroAssembler* masm); |
2205 | 2201 |
2206 virtual Code::Kind GetCodeKind() const override { | 2202 virtual Code::Kind GetCodeKind() const override { |
2207 return Code::KEYED_LOAD_IC; | 2203 return Code::KEYED_LOAD_IC; |
2208 } | 2204 } |
2209 | 2205 |
2210 virtual InlineCacheState GetICState() const final override { return DEFAULT; } | 2206 virtual InlineCacheState GetICState() const final override { return DEFAULT; } |
2211 | 2207 |
2212 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); | 2208 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2213 DEFINE_PLATFORM_CODE_STUB(VectorRawKeyedLoad, PlatformCodeStub); | 2209 DEFINE_PLATFORM_CODE_STUB(KeyedLoadIC, PlatformCodeStub); |
2214 | 2210 |
2215 protected: | 2211 protected: |
2216 void GenerateImpl(MacroAssembler* masm, bool in_frame); | 2212 void GenerateImpl(MacroAssembler* masm, bool in_frame); |
2217 }; | 2213 }; |
2218 | 2214 |
2219 | 2215 |
2220 class DoubleToIStub : public PlatformCodeStub { | 2216 class DoubleToIStub : public PlatformCodeStub { |
2221 public: | 2217 public: |
2222 DoubleToIStub(Isolate* isolate, Register source, Register destination, | 2218 DoubleToIStub(Isolate* isolate, Register source, Register destination, |
2223 int offset, bool is_truncating, bool skip_fastpath = false) | 2219 int offset, bool is_truncating, bool skip_fastpath = false) |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2856 | 2852 |
2857 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2853 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2858 #undef DEFINE_PLATFORM_CODE_STUB | 2854 #undef DEFINE_PLATFORM_CODE_STUB |
2859 #undef DEFINE_HANDLER_CODE_STUB | 2855 #undef DEFINE_HANDLER_CODE_STUB |
2860 #undef DEFINE_HYDROGEN_CODE_STUB | 2856 #undef DEFINE_HYDROGEN_CODE_STUB |
2861 #undef DEFINE_CODE_STUB | 2857 #undef DEFINE_CODE_STUB |
2862 #undef DEFINE_CODE_STUB_BASE | 2858 #undef DEFINE_CODE_STUB_BASE |
2863 } } // namespace v8::internal | 2859 } } // namespace v8::internal |
2864 | 2860 |
2865 #endif // V8_CODE_STUBS_H_ | 2861 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |