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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 V(FastNewClosure) \ | 70 V(FastNewClosure) \ |
71 V(FastNewContext) \ | 71 V(FastNewContext) \ |
72 V(GrowArrayElements) \ | 72 V(GrowArrayElements) \ |
73 V(InternalArrayNArgumentsConstructor) \ | 73 V(InternalArrayNArgumentsConstructor) \ |
74 V(InternalArrayNoArgumentConstructor) \ | 74 V(InternalArrayNoArgumentConstructor) \ |
75 V(InternalArraySingleArgumentConstructor) \ | 75 V(InternalArraySingleArgumentConstructor) \ |
76 V(KeyedLoadGeneric) \ | 76 V(KeyedLoadGeneric) \ |
77 V(LoadScriptContextField) \ | 77 V(LoadScriptContextField) \ |
78 V(LoadDictionaryElement) \ | 78 V(LoadDictionaryElement) \ |
79 V(LoadFastElement) \ | 79 V(LoadFastElement) \ |
80 V(MegamorphicLoad) \ | |
81 V(NameDictionaryLookup) \ | 80 V(NameDictionaryLookup) \ |
82 V(NumberToString) \ | 81 V(NumberToString) \ |
83 V(Typeof) \ | 82 V(Typeof) \ |
84 V(RegExpConstructResult) \ | 83 V(RegExpConstructResult) \ |
85 V(StoreFastElement) \ | 84 V(StoreFastElement) \ |
86 V(StoreScriptContextField) \ | 85 V(StoreScriptContextField) \ |
87 V(StringAdd) \ | 86 V(StringAdd) \ |
88 V(ToBoolean) \ | 87 V(ToBoolean) \ |
89 V(TransitionElementsKind) \ | 88 V(TransitionElementsKind) \ |
90 V(VectorRawKeyedLoad) \ | 89 V(VectorRawKeyedLoad) \ |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 public: | 979 public: |
981 explicit FunctionPrototypeStub(Isolate* isolate) | 980 explicit FunctionPrototypeStub(Isolate* isolate) |
982 : PlatformCodeStub(isolate) {} | 981 : PlatformCodeStub(isolate) {} |
983 | 982 |
984 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 983 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
985 | 984 |
986 // TODO(mvstanton): only the receiver register is accessed. When this is | 985 // TODO(mvstanton): only the receiver register is accessed. When this is |
987 // translated to a hydrogen code stub, a new CallInterfaceDescriptor | 986 // translated to a hydrogen code stub, a new CallInterfaceDescriptor |
988 // 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. |
989 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { | 988 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { |
990 if (FLAG_vector_ics) { | 989 return VectorLoadICDescriptor(isolate()); |
991 return VectorLoadICDescriptor(isolate()); | |
992 } | |
993 return LoadDescriptor(isolate()); | |
994 } | 990 } |
995 | 991 |
996 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); | 992 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); |
997 }; | 993 }; |
998 | 994 |
999 | 995 |
1000 // TODO(mvstanton): Translate to hydrogen code stub. | 996 // TODO(mvstanton): Translate to hydrogen code stub. |
1001 class LoadIndexedInterceptorStub : public PlatformCodeStub { | 997 class LoadIndexedInterceptorStub : public PlatformCodeStub { |
1002 public: | 998 public: |
1003 explicit LoadIndexedInterceptorStub(Isolate* isolate) | 999 explicit LoadIndexedInterceptorStub(Isolate* isolate) |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 2065 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
2070 }; | 2066 }; |
2071 | 2067 |
2072 | 2068 |
2073 class LoadDictionaryElementStub : public HydrogenCodeStub { | 2069 class LoadDictionaryElementStub : public HydrogenCodeStub { |
2074 public: | 2070 public: |
2075 explicit LoadDictionaryElementStub(Isolate* isolate) | 2071 explicit LoadDictionaryElementStub(Isolate* isolate) |
2076 : HydrogenCodeStub(isolate) {} | 2072 : HydrogenCodeStub(isolate) {} |
2077 | 2073 |
2078 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { | 2074 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { |
2079 if (FLAG_vector_ics) { | 2075 return VectorLoadICDescriptor(isolate()); |
2080 return VectorLoadICDescriptor(isolate()); | |
2081 } | |
2082 return LoadDescriptor(isolate()); | |
2083 } | 2076 } |
2084 | 2077 |
2085 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); | 2078 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); |
2086 }; | 2079 }; |
2087 | 2080 |
2088 | 2081 |
2089 class KeyedLoadGenericStub : public HydrogenCodeStub { | 2082 class KeyedLoadGenericStub : public HydrogenCodeStub { |
2090 public: | 2083 public: |
2091 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 2084 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
2092 | 2085 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2166 class CallIC_ArrayTrampolineStub : public CallICTrampolineStub { | 2159 class CallIC_ArrayTrampolineStub : public CallICTrampolineStub { |
2167 public: | 2160 public: |
2168 CallIC_ArrayTrampolineStub(Isolate* isolate, const CallICState& state) | 2161 CallIC_ArrayTrampolineStub(Isolate* isolate, const CallICState& state) |
2169 : CallICTrampolineStub(isolate, state) {} | 2162 : CallICTrampolineStub(isolate, state) {} |
2170 | 2163 |
2171 private: | 2164 private: |
2172 DEFINE_PLATFORM_CODE_STUB(CallIC_ArrayTrampoline, CallICTrampolineStub); | 2165 DEFINE_PLATFORM_CODE_STUB(CallIC_ArrayTrampoline, CallICTrampolineStub); |
2173 }; | 2166 }; |
2174 | 2167 |
2175 | 2168 |
2176 class MegamorphicLoadStub : public HydrogenCodeStub { | |
2177 public: | |
2178 MegamorphicLoadStub(Isolate* isolate, const LoadICState& state) | |
2179 : HydrogenCodeStub(isolate) { | |
2180 set_sub_minor_key(state.GetExtraICState()); | |
2181 } | |
2182 | |
2183 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | |
2184 | |
2185 InlineCacheState GetICState() const final { return MEGAMORPHIC; } | |
2186 | |
2187 ExtraICState GetExtraICState() const final { | |
2188 return static_cast<ExtraICState>(sub_minor_key()); | |
2189 } | |
2190 | |
2191 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { | |
2192 if (FLAG_vector_ics) { | |
2193 return VectorLoadICDescriptor(isolate()); | |
2194 } | |
2195 return LoadDescriptor(isolate()); | |
2196 } | |
2197 | |
2198 DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub); | |
2199 }; | |
2200 | |
2201 | |
2202 class VectorRawLoadStub : public PlatformCodeStub { | 2169 class VectorRawLoadStub : public PlatformCodeStub { |
2203 public: | 2170 public: |
2204 explicit VectorRawLoadStub(Isolate* isolate, const LoadICState& state) | 2171 explicit VectorRawLoadStub(Isolate* isolate, const LoadICState& state) |
2205 : PlatformCodeStub(isolate) { | 2172 : PlatformCodeStub(isolate) { |
2206 minor_key_ = state.GetExtraICState(); | 2173 minor_key_ = state.GetExtraICState(); |
2207 } | 2174 } |
2208 | 2175 |
2209 void GenerateForTrampoline(MacroAssembler* masm); | 2176 void GenerateForTrampoline(MacroAssembler* masm); |
2210 | 2177 |
2211 virtual Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2178 virtual Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 ElementsKind elements_kind() const { | 2339 ElementsKind elements_kind() const { |
2373 return ElementsKindBits::decode(sub_minor_key()); | 2340 return ElementsKindBits::decode(sub_minor_key()); |
2374 } | 2341 } |
2375 | 2342 |
2376 private: | 2343 private: |
2377 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2344 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2378 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 2345 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
2379 class CanConvertHoleToUndefined : public BitField<bool, 9, 1> {}; | 2346 class CanConvertHoleToUndefined : public BitField<bool, 9, 1> {}; |
2380 | 2347 |
2381 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { | 2348 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { |
2382 if (FLAG_vector_ics) { | 2349 return VectorLoadICDescriptor(isolate()); |
2383 return VectorLoadICDescriptor(isolate()); | |
2384 } | |
2385 return LoadDescriptor(isolate()); | |
2386 } | 2350 } |
2387 | 2351 |
2388 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub); | 2352 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub); |
2389 }; | 2353 }; |
2390 | 2354 |
2391 | 2355 |
2392 class StoreFastElementStub : public HydrogenCodeStub { | 2356 class StoreFastElementStub : public HydrogenCodeStub { |
2393 public: | 2357 public: |
2394 StoreFastElementStub(Isolate* isolate, bool is_js_array, | 2358 StoreFastElementStub(Isolate* isolate, bool is_js_array, |
2395 ElementsKind elements_kind, KeyedAccessStoreMode mode) | 2359 ElementsKind elements_kind, KeyedAccessStoreMode mode) |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2889 | 2853 |
2890 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2854 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2891 #undef DEFINE_PLATFORM_CODE_STUB | 2855 #undef DEFINE_PLATFORM_CODE_STUB |
2892 #undef DEFINE_HANDLER_CODE_STUB | 2856 #undef DEFINE_HANDLER_CODE_STUB |
2893 #undef DEFINE_HYDROGEN_CODE_STUB | 2857 #undef DEFINE_HYDROGEN_CODE_STUB |
2894 #undef DEFINE_CODE_STUB | 2858 #undef DEFINE_CODE_STUB |
2895 #undef DEFINE_CODE_STUB_BASE | 2859 #undef DEFINE_CODE_STUB_BASE |
2896 } } // namespace v8::internal | 2860 } } // namespace v8::internal |
2897 | 2861 |
2898 #endif // V8_CODE_STUBS_H_ | 2862 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |