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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
805 static compiler::Node* Generate(CodeStubAssembler* assembler, | 805 static compiler::Node* Generate(CodeStubAssembler* assembler, |
806 compiler::Node* shared_info, | 806 compiler::Node* shared_info, |
807 compiler::Node* context); | 807 compiler::Node* context); |
808 | 808 |
809 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewClosure); | 809 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewClosure); |
810 DEFINE_TURBOFAN_CODE_STUB(FastNewClosure, TurboFanCodeStub); | 810 DEFINE_TURBOFAN_CODE_STUB(FastNewClosure, TurboFanCodeStub); |
811 }; | 811 }; |
812 | 812 |
813 class FastNewFunctionContextStub final : public TurboFanCodeStub { | 813 class FastNewFunctionContextStub final : public TurboFanCodeStub { |
814 public: | 814 public: |
815 static const int kMaximumSlots = 0x8000; | 815 static int MaximumSlots(); |
816 | 816 |
817 explicit FastNewFunctionContextStub(Isolate* isolate) | 817 explicit FastNewFunctionContextStub(Isolate* isolate, ScopeType scope_type) |
818 : TurboFanCodeStub(isolate) {} | 818 : TurboFanCodeStub(isolate) { |
819 minor_key_ = ScopeTypeBits::encode(scope_type); | |
820 } | |
819 | 821 |
820 static compiler::Node* Generate(CodeStubAssembler* assembler, | 822 static compiler::Node* Generate(CodeStubAssembler* assembler, |
821 compiler::Node* function, | 823 compiler::Node* function, |
822 compiler::Node* slots, | 824 compiler::Node* slots, |
823 compiler::Node* context); | 825 compiler::Node* context, |
826 ScopeType scope_type); | |
827 | |
828 ScopeType scope_type() const { | |
829 return static_cast<ScopeType>(ScopeTypeBits::decode(minor_key_)); | |
830 } | |
824 | 831 |
825 private: | 832 private: |
833 static const int kMaximumSlots = 0x8000; | |
834 static const int kSmallMaximumSlots = 10; | |
835 | |
826 // FastNewFunctionContextStub can only allocate closures which fit in the | 836 // FastNewFunctionContextStub can only allocate closures which fit in the |
827 // new space. | 837 // new space. |
828 STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize + | 838 STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize + |
829 FixedArray::kHeaderSize) < kMaxRegularHeapObjectSize); | 839 FixedArray::kHeaderSize) < kMaxRegularHeapObjectSize); |
830 | 840 |
831 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewFunctionContext); | 841 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewFunctionContext); |
832 DEFINE_TURBOFAN_CODE_STUB(FastNewFunctionContext, TurboFanCodeStub); | 842 DEFINE_TURBOFAN_CODE_STUB(FastNewFunctionContext, TurboFanCodeStub); |
843 | |
844 class ScopeTypeBits : public BitField<bool, 0, 8> {}; | |
Michael Starzinger
2016/12/15 09:42:59
nit: Can we move this up three lines, so that the
Dan Ehrenberg
2016/12/15 23:51:50
Done.
| |
833 }; | 845 }; |
834 | 846 |
835 | |
836 class FastNewObjectStub final : public PlatformCodeStub { | 847 class FastNewObjectStub final : public PlatformCodeStub { |
837 public: | 848 public: |
838 explicit FastNewObjectStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 849 explicit FastNewObjectStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
839 | 850 |
840 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewObject); | 851 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewObject); |
841 DEFINE_PLATFORM_CODE_STUB(FastNewObject, PlatformCodeStub); | 852 DEFINE_PLATFORM_CODE_STUB(FastNewObject, PlatformCodeStub); |
842 }; | 853 }; |
843 | 854 |
844 | 855 |
845 // TODO(turbofan): This stub should be possible to write in TurboFan | 856 // TODO(turbofan): This stub should be possible to write in TurboFan |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2643 #undef DEFINE_PLATFORM_CODE_STUB | 2654 #undef DEFINE_PLATFORM_CODE_STUB |
2644 #undef DEFINE_HANDLER_CODE_STUB | 2655 #undef DEFINE_HANDLER_CODE_STUB |
2645 #undef DEFINE_HYDROGEN_CODE_STUB | 2656 #undef DEFINE_HYDROGEN_CODE_STUB |
2646 #undef DEFINE_CODE_STUB | 2657 #undef DEFINE_CODE_STUB |
2647 #undef DEFINE_CODE_STUB_BASE | 2658 #undef DEFINE_CODE_STUB_BASE |
2648 | 2659 |
2649 } // namespace internal | 2660 } // namespace internal |
2650 } // namespace v8 | 2661 } // namespace v8 |
2651 | 2662 |
2652 #endif // V8_CODE_STUBS_H_ | 2663 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |