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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 V(DivideWithFeedback) \ | 95 V(DivideWithFeedback) \ |
96 V(ModulusWithFeedback) \ | 96 V(ModulusWithFeedback) \ |
97 V(Inc) \ | 97 V(Inc) \ |
98 V(InternalArrayNoArgumentConstructor) \ | 98 V(InternalArrayNoArgumentConstructor) \ |
99 V(InternalArraySingleArgumentConstructor) \ | 99 V(InternalArraySingleArgumentConstructor) \ |
100 V(Dec) \ | 100 V(Dec) \ |
101 V(ElementsTransitionAndStore) \ | 101 V(ElementsTransitionAndStore) \ |
102 V(FastCloneRegExp) \ | 102 V(FastCloneRegExp) \ |
103 V(FastCloneShallowArray) \ | 103 V(FastCloneShallowArray) \ |
104 V(FastCloneShallowObject) \ | 104 V(FastCloneShallowObject) \ |
105 V(FastNewFunctionContext) \ | |
106 V(KeyedLoadSloppyArguments) \ | 105 V(KeyedLoadSloppyArguments) \ |
107 V(KeyedStoreSloppyArguments) \ | 106 V(KeyedStoreSloppyArguments) \ |
108 V(LoadScriptContextField) \ | 107 V(LoadScriptContextField) \ |
109 V(StoreScriptContextField) \ | 108 V(StoreScriptContextField) \ |
110 V(NumberToString) \ | 109 V(NumberToString) \ |
111 V(StringAdd) \ | 110 V(StringAdd) \ |
112 V(GetProperty) \ | 111 V(GetProperty) \ |
113 V(LoadIC) \ | 112 V(LoadIC) \ |
114 V(LoadICProtoArray) \ | 113 V(LoadICProtoArray) \ |
115 V(KeyedLoadICTF) \ | 114 V(KeyedLoadICTF) \ |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 }; | 779 }; |
781 | 780 |
782 class NumberToStringStub final : public TurboFanCodeStub { | 781 class NumberToStringStub final : public TurboFanCodeStub { |
783 public: | 782 public: |
784 explicit NumberToStringStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 783 explicit NumberToStringStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
785 | 784 |
786 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); | 785 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); |
787 DEFINE_TURBOFAN_CODE_STUB(NumberToString, TurboFanCodeStub); | 786 DEFINE_TURBOFAN_CODE_STUB(NumberToString, TurboFanCodeStub); |
788 }; | 787 }; |
789 | 788 |
790 class FastNewFunctionContextStub final : public TurboFanCodeStub { | |
791 public: | |
792 static int MaximumSlots(); | |
793 | |
794 explicit FastNewFunctionContextStub(Isolate* isolate, ScopeType scope_type) | |
795 : TurboFanCodeStub(isolate) { | |
796 minor_key_ = ScopeTypeBits::encode(scope_type); | |
797 } | |
798 | |
799 static compiler::Node* Generate(CodeStubAssembler* assembler, | |
800 compiler::Node* function, | |
801 compiler::Node* slots, | |
802 compiler::Node* context, | |
803 ScopeType scope_type); | |
804 | |
805 ScopeType scope_type() const { | |
806 return static_cast<ScopeType>(ScopeTypeBits::decode(minor_key_)); | |
807 } | |
808 | |
809 private: | |
810 static const int kMaximumSlots = 0x8000; | |
811 static const int kSmallMaximumSlots = 10; | |
812 | |
813 // FastNewFunctionContextStub can only allocate closures which fit in the | |
814 // new space. | |
815 STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize + | |
816 FixedArray::kHeaderSize) < kMaxRegularHeapObjectSize); | |
817 | |
818 class ScopeTypeBits : public BitField<bool, 0, 8> {}; | |
819 | |
820 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewFunctionContext); | |
821 DEFINE_TURBOFAN_CODE_STUB(FastNewFunctionContext, TurboFanCodeStub); | |
822 }; | |
823 | |
824 class FastNewObjectStub final : public PlatformCodeStub { | 789 class FastNewObjectStub final : public PlatformCodeStub { |
825 public: | 790 public: |
826 explicit FastNewObjectStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 791 explicit FastNewObjectStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
827 | 792 |
828 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewObject); | 793 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewObject); |
829 DEFINE_PLATFORM_CODE_STUB(FastNewObject, PlatformCodeStub); | 794 DEFINE_PLATFORM_CODE_STUB(FastNewObject, PlatformCodeStub); |
830 }; | 795 }; |
831 | 796 |
832 | 797 |
833 // TODO(turbofan): This stub should be possible to write in TurboFan | 798 // TODO(turbofan): This stub should be possible to write in TurboFan |
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2473 #undef DEFINE_PLATFORM_CODE_STUB | 2438 #undef DEFINE_PLATFORM_CODE_STUB |
2474 #undef DEFINE_HANDLER_CODE_STUB | 2439 #undef DEFINE_HANDLER_CODE_STUB |
2475 #undef DEFINE_HYDROGEN_CODE_STUB | 2440 #undef DEFINE_HYDROGEN_CODE_STUB |
2476 #undef DEFINE_CODE_STUB | 2441 #undef DEFINE_CODE_STUB |
2477 #undef DEFINE_CODE_STUB_BASE | 2442 #undef DEFINE_CODE_STUB_BASE |
2478 | 2443 |
2479 } // namespace internal | 2444 } // namespace internal |
2480 } // namespace v8 | 2445 } // namespace v8 |
2481 | 2446 |
2482 #endif // V8_CODE_STUBS_H_ | 2447 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |