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