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 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2794 // Ensure data fits within available bits. | 2794 // Ensure data fits within available bits. |
2795 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); | 2795 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
2796 | 2796 |
2797 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2797 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2798 class AllocationSiteOverrideModeBits: public | 2798 class AllocationSiteOverrideModeBits: public |
2799 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT | 2799 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT |
2800 | 2800 |
2801 DEFINE_CODE_STUB_BASE(ArrayConstructorStubBase, HydrogenCodeStub); | 2801 DEFINE_CODE_STUB_BASE(ArrayConstructorStubBase, HydrogenCodeStub); |
2802 }; | 2802 }; |
2803 | 2803 |
2804 | 2804 class ArrayNoArgumentConstructorStub : public TurboFanCodeStub { |
2805 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | |
2806 public: | 2805 public: |
2807 ArrayNoArgumentConstructorStub( | 2806 ArrayNoArgumentConstructorStub( |
2808 Isolate* isolate, | 2807 Isolate* isolate, ElementsKind kind, |
2809 ElementsKind kind, | |
2810 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2808 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2811 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2809 : TurboFanCodeStub(isolate) { |
| 2810 // It only makes sense to override local allocation site behavior |
| 2811 // if there is a difference between the global allocation site policy |
| 2812 // for an ElementsKind and the desired usage of the stub. |
| 2813 DCHECK(override_mode != DISABLE_ALLOCATION_SITES || |
| 2814 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE); |
| 2815 set_sub_minor_key(ElementsKindBits::encode(kind) | |
| 2816 AllocationSiteOverrideModeBits::encode(override_mode)); |
| 2817 } |
| 2818 |
| 2819 void set_sub_minor_key(uint32_t key) { minor_key_ = key; } |
| 2820 |
| 2821 uint32_t sub_minor_key() const { return minor_key_; } |
| 2822 |
| 2823 ElementsKind elements_kind() const { |
| 2824 return ElementsKindBits::decode(sub_minor_key()); |
| 2825 } |
| 2826 |
| 2827 AllocationSiteOverrideMode override_mode() const { |
| 2828 return AllocationSiteOverrideModeBits::decode(sub_minor_key()); |
2812 } | 2829 } |
2813 | 2830 |
2814 private: | 2831 private: |
2815 void PrintName(std::ostream& os) const override { // NOLINT | 2832 void PrintName(std::ostream& os) const override { // NOLINT |
2816 BasePrintName(os, "ArrayNoArgumentConstructorStub"); | 2833 os << "ArrayNoArgumentConstructorStub"; |
2817 } | 2834 } |
2818 | 2835 |
2819 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructorConstantArgCount); | 2836 // Ensure data fits within available bits. |
2820 DEFINE_HYDROGEN_CODE_STUB(ArrayNoArgumentConstructor, | 2837 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
2821 ArrayConstructorStubBase); | 2838 |
| 2839 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; |
| 2840 class AllocationSiteOverrideModeBits |
| 2841 : public BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT |
| 2842 |
| 2843 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayNoArgumentConstructor); |
| 2844 DEFINE_TURBOFAN_CODE_STUB(ArrayNoArgumentConstructor, TurboFanCodeStub); |
2822 }; | 2845 }; |
2823 | 2846 |
2824 | |
2825 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2847 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
2826 public: | 2848 public: |
2827 ArraySingleArgumentConstructorStub( | 2849 ArraySingleArgumentConstructorStub( |
2828 Isolate* isolate, | 2850 Isolate* isolate, |
2829 ElementsKind kind, | 2851 ElementsKind kind, |
2830 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2852 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2831 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2853 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2832 } | 2854 } |
2833 | 2855 |
2834 private: | 2856 private: |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3184 #undef DEFINE_HYDROGEN_CODE_STUB | 3206 #undef DEFINE_HYDROGEN_CODE_STUB |
3185 #undef DEFINE_CODE_STUB | 3207 #undef DEFINE_CODE_STUB |
3186 #undef DEFINE_CODE_STUB_BASE | 3208 #undef DEFINE_CODE_STUB_BASE |
3187 | 3209 |
3188 extern Representation RepresentationFromType(Type* type); | 3210 extern Representation RepresentationFromType(Type* type); |
3189 | 3211 |
3190 } // namespace internal | 3212 } // namespace internal |
3191 } // namespace v8 | 3213 } // namespace v8 |
3192 | 3214 |
3193 #endif // V8_CODE_STUBS_H_ | 3215 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |