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/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 V(FastCloneShallowArray) \ | 64 V(FastCloneShallowArray) \ |
65 V(FastFunctionBind) \ | 65 V(FastFunctionBind) \ |
66 V(FastNewClosure) \ | 66 V(FastNewClosure) \ |
67 V(FastNewContext) \ | 67 V(FastNewContext) \ |
68 V(FastNewObject) \ | 68 V(FastNewObject) \ |
69 V(FastNewRestParameter) \ | 69 V(FastNewRestParameter) \ |
70 V(FastNewSloppyArguments) \ | 70 V(FastNewSloppyArguments) \ |
71 V(FastNewStrictArguments) \ | 71 V(FastNewStrictArguments) \ |
72 V(GrowArrayElements) \ | 72 V(GrowArrayElements) \ |
73 V(KeyedLoadGeneric) \ | 73 V(KeyedLoadGeneric) \ |
74 V(LoadGlobalViaContext) \ | |
75 V(LoadScriptContextField) \ | 74 V(LoadScriptContextField) \ |
76 V(LoadDictionaryElement) \ | 75 V(LoadDictionaryElement) \ |
77 V(NameDictionaryLookup) \ | 76 V(NameDictionaryLookup) \ |
78 V(NumberToString) \ | 77 V(NumberToString) \ |
79 V(Typeof) \ | 78 V(Typeof) \ |
80 V(RegExpConstructResult) \ | 79 V(RegExpConstructResult) \ |
81 V(StoreFastElement) \ | 80 V(StoreFastElement) \ |
82 V(StoreGlobalViaContext) \ | 81 V(StoreGlobalViaContext) \ |
83 V(StoreScriptContextField) \ | 82 V(StoreScriptContextField) \ |
84 V(StringAdd) \ | 83 V(StringAdd) \ |
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 private: | 1729 private: |
1731 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; | 1730 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; |
1732 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; | 1731 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; |
1733 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; | 1732 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; |
1734 class CheckGlobalBits : public BitField<bool, 12, 1> {}; | 1733 class CheckGlobalBits : public BitField<bool, 12, 1> {}; |
1735 | 1734 |
1736 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); | 1735 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); |
1737 }; | 1736 }; |
1738 | 1737 |
1739 | 1738 |
1740 class LoadGlobalViaContextStub final : public PlatformCodeStub { | |
1741 public: | |
1742 static const int kMaximumDepth = 15; | |
1743 | |
1744 LoadGlobalViaContextStub(Isolate* isolate, int depth) | |
1745 : PlatformCodeStub(isolate) { | |
1746 minor_key_ = DepthBits::encode(depth); | |
1747 } | |
1748 | |
1749 int depth() const { return DepthBits::decode(minor_key_); } | |
1750 | |
1751 private: | |
1752 class DepthBits : public BitField<int, 0, 4> {}; | |
1753 STATIC_ASSERT(DepthBits::kMax == kMaximumDepth); | |
1754 | |
1755 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalViaContext); | |
1756 DEFINE_PLATFORM_CODE_STUB(LoadGlobalViaContext, PlatformCodeStub); | |
1757 }; | |
1758 | |
1759 | |
1760 class StoreGlobalViaContextStub final : public PlatformCodeStub { | 1739 class StoreGlobalViaContextStub final : public PlatformCodeStub { |
1761 public: | 1740 public: |
1762 static const int kMaximumDepth = 15; | 1741 static const int kMaximumDepth = 15; |
1763 | 1742 |
1764 StoreGlobalViaContextStub(Isolate* isolate, int depth, | 1743 StoreGlobalViaContextStub(Isolate* isolate, int depth, |
1765 LanguageMode language_mode) | 1744 LanguageMode language_mode) |
1766 : PlatformCodeStub(isolate) { | 1745 : PlatformCodeStub(isolate) { |
1767 minor_key_ = | 1746 minor_key_ = |
1768 DepthBits::encode(depth) | LanguageModeBits::encode(language_mode); | 1747 DepthBits::encode(depth) | LanguageModeBits::encode(language_mode); |
1769 } | 1748 } |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2379 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 2358 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
2380 DEFINE_CODE_STUB(LoadICTrampolineTF, TurboFanCodeStub); | 2359 DEFINE_CODE_STUB(LoadICTrampolineTF, TurboFanCodeStub); |
2381 }; | 2360 }; |
2382 | 2361 |
2383 class LoadGlobalICTrampolineStub : public LoadICTrampolineTFStub { | 2362 class LoadGlobalICTrampolineStub : public LoadICTrampolineTFStub { |
2384 public: | 2363 public: |
2385 explicit LoadGlobalICTrampolineStub(Isolate* isolate, | 2364 explicit LoadGlobalICTrampolineStub(Isolate* isolate, |
2386 const LoadICState& state) | 2365 const LoadICState& state) |
2387 : LoadICTrampolineTFStub(isolate, state) {} | 2366 : LoadICTrampolineTFStub(isolate, state) {} |
2388 | 2367 |
| 2368 void GenerateAssembly(CodeStubAssembler* assembler) const override; |
| 2369 |
2389 Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; } | 2370 Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; } |
2390 | 2371 |
| 2372 // DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobal); |
| 2373 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
| 2374 if (!FLAG_new_load_global_ic) { |
| 2375 return LoadICTrampolineTFStub::GetCallInterfaceDescriptor(); |
| 2376 } |
| 2377 return LoadGlobalDescriptor(isolate()); |
| 2378 } |
2391 DEFINE_CODE_STUB(LoadGlobalICTrampoline, LoadICTrampolineTFStub); | 2379 DEFINE_CODE_STUB(LoadGlobalICTrampoline, LoadICTrampolineTFStub); |
2392 }; | 2380 }; |
2393 | 2381 |
2394 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { | 2382 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { |
2395 public: | 2383 public: |
2396 explicit KeyedLoadICTrampolineStub(Isolate* isolate, const LoadICState& state) | 2384 explicit KeyedLoadICTrampolineStub(Isolate* isolate, const LoadICState& state) |
2397 : LoadICTrampolineStub(isolate, state) {} | 2385 : LoadICTrampolineStub(isolate, state) {} |
2398 | 2386 |
2399 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } | 2387 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } |
2400 | 2388 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 | 2488 |
2501 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 2489 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2502 DEFINE_CODE_STUB(LoadICTF, TurboFanCodeStub); | 2490 DEFINE_CODE_STUB(LoadICTF, TurboFanCodeStub); |
2503 }; | 2491 }; |
2504 | 2492 |
2505 class LoadGlobalICStub : public LoadICTFStub { | 2493 class LoadGlobalICStub : public LoadICTFStub { |
2506 public: | 2494 public: |
2507 explicit LoadGlobalICStub(Isolate* isolate, const LoadICState& state) | 2495 explicit LoadGlobalICStub(Isolate* isolate, const LoadICState& state) |
2508 : LoadICTFStub(isolate, state) {} | 2496 : LoadICTFStub(isolate, state) {} |
2509 | 2497 |
| 2498 void GenerateAssembly(CodeStubAssembler* assembler) const override; |
| 2499 |
2510 Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; } | 2500 Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; } |
2511 | 2501 |
2512 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 2502 // DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalWithVector); |
| 2503 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
| 2504 if (!FLAG_new_load_global_ic) { |
| 2505 return LoadICTFStub::GetCallInterfaceDescriptor(); |
| 2506 } |
| 2507 return LoadGlobalWithVectorDescriptor(isolate()); |
| 2508 } |
2513 DEFINE_CODE_STUB(LoadGlobalIC, LoadICTFStub); | 2509 DEFINE_CODE_STUB(LoadGlobalIC, LoadICTFStub); |
2514 }; | 2510 }; |
2515 | 2511 |
2516 class KeyedLoadICStub : public PlatformCodeStub { | 2512 class KeyedLoadICStub : public PlatformCodeStub { |
2517 public: | 2513 public: |
2518 explicit KeyedLoadICStub(Isolate* isolate, const LoadICState& state) | 2514 explicit KeyedLoadICStub(Isolate* isolate, const LoadICState& state) |
2519 : PlatformCodeStub(isolate) { | 2515 : PlatformCodeStub(isolate) { |
2520 minor_key_ = state.GetExtraICState(); | 2516 minor_key_ = state.GetExtraICState(); |
2521 } | 2517 } |
2522 | 2518 |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3160 #undef DEFINE_HYDROGEN_CODE_STUB | 3156 #undef DEFINE_HYDROGEN_CODE_STUB |
3161 #undef DEFINE_CODE_STUB | 3157 #undef DEFINE_CODE_STUB |
3162 #undef DEFINE_CODE_STUB_BASE | 3158 #undef DEFINE_CODE_STUB_BASE |
3163 | 3159 |
3164 extern Representation RepresentationFromType(Type* type); | 3160 extern Representation RepresentationFromType(Type* type); |
3165 | 3161 |
3166 } // namespace internal | 3162 } // namespace internal |
3167 } // namespace v8 | 3163 } // namespace v8 |
3168 | 3164 |
3169 #endif // V8_CODE_STUBS_H_ | 3165 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |