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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 V(StringToNumber) \ | 51 V(StringToNumber) \ |
52 V(ToString) \ | 52 V(ToString) \ |
53 V(ToName) \ | 53 V(ToName) \ |
54 V(ToObject) \ | 54 V(ToObject) \ |
55 V(VectorStoreICTrampoline) \ | 55 V(VectorStoreICTrampoline) \ |
56 V(VectorKeyedStoreICTrampoline) \ | 56 V(VectorKeyedStoreICTrampoline) \ |
57 V(VectorStoreIC) \ | 57 V(VectorStoreIC) \ |
58 V(VectorKeyedStoreIC) \ | 58 V(VectorKeyedStoreIC) \ |
59 /* HydrogenCodeStubs */ \ | 59 /* HydrogenCodeStubs */ \ |
60 V(ArrayNArgumentsConstructor) \ | 60 V(ArrayNArgumentsConstructor) \ |
61 V(ArrayNoArgumentConstructor) \ | |
62 V(ArraySingleArgumentConstructor) \ | 61 V(ArraySingleArgumentConstructor) \ |
63 V(BinaryOpIC) \ | 62 V(BinaryOpIC) \ |
64 V(BinaryOpWithAllocationSite) \ | 63 V(BinaryOpWithAllocationSite) \ |
65 V(CreateAllocationSite) \ | 64 V(CreateAllocationSite) \ |
66 V(CreateWeakCell) \ | 65 V(CreateWeakCell) \ |
67 V(ElementsTransitionAndStore) \ | 66 V(ElementsTransitionAndStore) \ |
68 V(FastArrayPush) \ | 67 V(FastArrayPush) \ |
69 V(FastCloneRegExp) \ | 68 V(FastCloneRegExp) \ |
70 V(FastCloneShallowArray) \ | 69 V(FastCloneShallowArray) \ |
71 V(FastNewClosure) \ | 70 V(FastNewClosure) \ |
72 V(FastNewContext) \ | 71 V(FastNewContext) \ |
73 V(FastNewObject) \ | 72 V(FastNewObject) \ |
74 V(FastNewRestParameter) \ | 73 V(FastNewRestParameter) \ |
75 V(FastNewSloppyArguments) \ | 74 V(FastNewSloppyArguments) \ |
76 V(FastNewStrictArguments) \ | 75 V(FastNewStrictArguments) \ |
77 V(GrowArrayElements) \ | 76 V(GrowArrayElements) \ |
78 V(InternalArrayNArgumentsConstructor) \ | 77 V(InternalArrayNArgumentsConstructor) \ |
79 V(InternalArrayNoArgumentConstructor) \ | |
80 V(InternalArraySingleArgumentConstructor) \ | 78 V(InternalArraySingleArgumentConstructor) \ |
81 V(KeyedLoadGeneric) \ | 79 V(KeyedLoadGeneric) \ |
82 V(LoadGlobalViaContext) \ | 80 V(LoadGlobalViaContext) \ |
83 V(LoadScriptContextField) \ | 81 V(LoadScriptContextField) \ |
84 V(LoadDictionaryElement) \ | 82 V(LoadDictionaryElement) \ |
85 V(NameDictionaryLookup) \ | 83 V(NameDictionaryLookup) \ |
86 V(NumberToString) \ | 84 V(NumberToString) \ |
87 V(Typeof) \ | 85 V(Typeof) \ |
88 V(RegExpConstructResult) \ | 86 V(RegExpConstructResult) \ |
89 V(StoreFastElement) \ | 87 V(StoreFastElement) \ |
(...skipping 10 matching lines...) Expand all Loading... |
100 V(AllocateFloat32x4) \ | 98 V(AllocateFloat32x4) \ |
101 V(AllocateInt32x4) \ | 99 V(AllocateInt32x4) \ |
102 V(AllocateUint32x4) \ | 100 V(AllocateUint32x4) \ |
103 V(AllocateBool32x4) \ | 101 V(AllocateBool32x4) \ |
104 V(AllocateInt16x8) \ | 102 V(AllocateInt16x8) \ |
105 V(AllocateUint16x8) \ | 103 V(AllocateUint16x8) \ |
106 V(AllocateBool16x8) \ | 104 V(AllocateBool16x8) \ |
107 V(AllocateInt8x16) \ | 105 V(AllocateInt8x16) \ |
108 V(AllocateUint8x16) \ | 106 V(AllocateUint8x16) \ |
109 V(AllocateBool8x16) \ | 107 V(AllocateBool8x16) \ |
| 108 V(ArrayNoArgumentConstructor) \ |
110 V(StringLength) \ | 109 V(StringLength) \ |
111 V(Add) \ | 110 V(Add) \ |
112 V(Subtract) \ | 111 V(Subtract) \ |
113 V(Multiply) \ | 112 V(Multiply) \ |
114 V(Divide) \ | 113 V(Divide) \ |
115 V(Modulus) \ | 114 V(Modulus) \ |
116 V(ShiftRight) \ | 115 V(ShiftRight) \ |
117 V(ShiftRightLogical) \ | 116 V(ShiftRightLogical) \ |
118 V(ShiftLeft) \ | 117 V(ShiftLeft) \ |
119 V(BitwiseAnd) \ | 118 V(BitwiseAnd) \ |
120 V(BitwiseOr) \ | 119 V(BitwiseOr) \ |
121 V(BitwiseXor) \ | 120 V(BitwiseXor) \ |
122 V(Inc) \ | 121 V(Inc) \ |
| 122 V(InternalArrayNoArgumentConstructor) \ |
123 V(Dec) \ | 123 V(Dec) \ |
124 V(FastCloneShallowObject) \ | 124 V(FastCloneShallowObject) \ |
125 V(LessThan) \ | 125 V(LessThan) \ |
126 V(LessThanOrEqual) \ | 126 V(LessThanOrEqual) \ |
127 V(GreaterThan) \ | 127 V(GreaterThan) \ |
128 V(GreaterThanOrEqual) \ | 128 V(GreaterThanOrEqual) \ |
129 V(Equal) \ | 129 V(Equal) \ |
130 V(NotEqual) \ | 130 V(NotEqual) \ |
131 V(StrictEqual) \ | 131 V(StrictEqual) \ |
132 V(StrictNotEqual) \ | 132 V(StrictNotEqual) \ |
(...skipping 2661 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 class ArrayNoArgumentConstructorStub : public TurboFanCodeStub { | 2804 class CommonArrayConstructorStub : public TurboFanCodeStub { |
2805 public: | 2805 protected: |
2806 ArrayNoArgumentConstructorStub( | 2806 CommonArrayConstructorStub(Isolate* isolate, ElementsKind kind, |
2807 Isolate* isolate, ElementsKind kind, | 2807 AllocationSiteOverrideMode override_mode) |
2808 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | |
2809 : TurboFanCodeStub(isolate) { | 2808 : TurboFanCodeStub(isolate) { |
2810 // It only makes sense to override local allocation site behavior | 2809 // It only makes sense to override local allocation site behavior |
2811 // if there is a difference between the global allocation site policy | 2810 // if there is a difference between the global allocation site policy |
2812 // for an ElementsKind and the desired usage of the stub. | 2811 // for an ElementsKind and the desired usage of the stub. |
2813 DCHECK(override_mode != DISABLE_ALLOCATION_SITES || | 2812 DCHECK(override_mode != DISABLE_ALLOCATION_SITES || |
2814 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE); | 2813 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE); |
2815 set_sub_minor_key(ElementsKindBits::encode(kind) | | 2814 set_sub_minor_key(ElementsKindBits::encode(kind) | |
2816 AllocationSiteOverrideModeBits::encode(override_mode)); | 2815 AllocationSiteOverrideModeBits::encode(override_mode)); |
2817 } | 2816 } |
2818 | 2817 |
2819 void set_sub_minor_key(uint32_t key) { minor_key_ = key; } | 2818 void set_sub_minor_key(uint32_t key) { minor_key_ = key; } |
2820 | 2819 |
2821 uint32_t sub_minor_key() const { return minor_key_; } | 2820 uint32_t sub_minor_key() const { return minor_key_; } |
2822 | 2821 |
| 2822 CommonArrayConstructorStub(uint32_t key, Isolate* isolate) |
| 2823 : TurboFanCodeStub(key, isolate) {} |
| 2824 |
| 2825 public: |
2823 ElementsKind elements_kind() const { | 2826 ElementsKind elements_kind() const { |
2824 return ElementsKindBits::decode(sub_minor_key()); | 2827 return ElementsKindBits::decode(sub_minor_key()); |
2825 } | 2828 } |
2826 | 2829 |
2827 AllocationSiteOverrideMode override_mode() const { | 2830 AllocationSiteOverrideMode override_mode() const { |
2828 return AllocationSiteOverrideModeBits::decode(sub_minor_key()); | 2831 return AllocationSiteOverrideModeBits::decode(sub_minor_key()); |
2829 } | 2832 } |
2830 | 2833 |
2831 private: | 2834 private: |
| 2835 // Ensure data fits within available bits. |
| 2836 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
| 2837 |
| 2838 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; |
| 2839 class AllocationSiteOverrideModeBits |
| 2840 : public BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT |
| 2841 }; |
| 2842 |
| 2843 class ArrayNoArgumentConstructorStub : public CommonArrayConstructorStub { |
| 2844 public: |
| 2845 ArrayNoArgumentConstructorStub( |
| 2846 Isolate* isolate, ElementsKind kind, |
| 2847 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2848 : CommonArrayConstructorStub(isolate, kind, override_mode) {} |
| 2849 |
| 2850 private: |
2832 void PrintName(std::ostream& os) const override { // NOLINT | 2851 void PrintName(std::ostream& os) const override { // NOLINT |
2833 os << "ArrayNoArgumentConstructorStub"; | 2852 os << "ArrayNoArgumentConstructorStub"; |
2834 } | 2853 } |
2835 | 2854 |
2836 // Ensure data fits within available bits. | 2855 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayNoArgumentConstructor); |
2837 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); | 2856 DEFINE_TURBOFAN_CODE_STUB(ArrayNoArgumentConstructor, |
| 2857 CommonArrayConstructorStub); |
| 2858 }; |
2838 | 2859 |
2839 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; | 2860 class InternalArrayNoArgumentConstructorStub |
2840 class AllocationSiteOverrideModeBits | 2861 : public CommonArrayConstructorStub { |
2841 : public BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT | 2862 public: |
| 2863 InternalArrayNoArgumentConstructorStub(Isolate* isolate, ElementsKind kind) |
| 2864 : CommonArrayConstructorStub(isolate, kind, DONT_OVERRIDE) {} |
| 2865 |
| 2866 private: |
| 2867 void PrintName(std::ostream& os) const override { // NOLINT |
| 2868 os << "InternalArrayNoArgumentConstructorStub"; |
| 2869 } |
2842 | 2870 |
2843 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayNoArgumentConstructor); | 2871 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayNoArgumentConstructor); |
2844 DEFINE_TURBOFAN_CODE_STUB(ArrayNoArgumentConstructor, TurboFanCodeStub); | 2872 DEFINE_TURBOFAN_CODE_STUB(InternalArrayNoArgumentConstructor, |
| 2873 CommonArrayConstructorStub); |
2845 }; | 2874 }; |
2846 | 2875 |
2847 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2876 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
2848 public: | 2877 public: |
2849 ArraySingleArgumentConstructorStub( | 2878 ArraySingleArgumentConstructorStub( |
2850 Isolate* isolate, | 2879 Isolate* isolate, |
2851 ElementsKind kind, | 2880 ElementsKind kind, |
2852 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2881 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2853 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2882 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2854 } | 2883 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 return ElementsKindBits::decode(sub_minor_key()); | 2929 return ElementsKindBits::decode(sub_minor_key()); |
2901 } | 2930 } |
2902 | 2931 |
2903 private: | 2932 private: |
2904 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; | 2933 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; |
2905 | 2934 |
2906 DEFINE_CODE_STUB_BASE(InternalArrayConstructorStubBase, HydrogenCodeStub); | 2935 DEFINE_CODE_STUB_BASE(InternalArrayConstructorStubBase, HydrogenCodeStub); |
2907 }; | 2936 }; |
2908 | 2937 |
2909 | 2938 |
2910 class InternalArrayNoArgumentConstructorStub : public | |
2911 InternalArrayConstructorStubBase { | |
2912 public: | |
2913 InternalArrayNoArgumentConstructorStub(Isolate* isolate, | |
2914 ElementsKind kind) | |
2915 : InternalArrayConstructorStubBase(isolate, kind) { } | |
2916 | |
2917 DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructorConstantArgCount); | |
2918 DEFINE_HYDROGEN_CODE_STUB(InternalArrayNoArgumentConstructor, | |
2919 InternalArrayConstructorStubBase); | |
2920 }; | |
2921 | |
2922 | |
2923 class InternalArraySingleArgumentConstructorStub : public | 2939 class InternalArraySingleArgumentConstructorStub : public |
2924 InternalArrayConstructorStubBase { | 2940 InternalArrayConstructorStubBase { |
2925 public: | 2941 public: |
2926 InternalArraySingleArgumentConstructorStub(Isolate* isolate, | 2942 InternalArraySingleArgumentConstructorStub(Isolate* isolate, |
2927 ElementsKind kind) | 2943 ElementsKind kind) |
2928 : InternalArrayConstructorStubBase(isolate, kind) { } | 2944 : InternalArrayConstructorStubBase(isolate, kind) { } |
2929 | 2945 |
2930 DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor); | 2946 DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor); |
2931 DEFINE_HYDROGEN_CODE_STUB(InternalArraySingleArgumentConstructor, | 2947 DEFINE_HYDROGEN_CODE_STUB(InternalArraySingleArgumentConstructor, |
2932 InternalArrayConstructorStubBase); | 2948 InternalArrayConstructorStubBase); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3206 #undef DEFINE_HYDROGEN_CODE_STUB | 3222 #undef DEFINE_HYDROGEN_CODE_STUB |
3207 #undef DEFINE_CODE_STUB | 3223 #undef DEFINE_CODE_STUB |
3208 #undef DEFINE_CODE_STUB_BASE | 3224 #undef DEFINE_CODE_STUB_BASE |
3209 | 3225 |
3210 extern Representation RepresentationFromType(Type* type); | 3226 extern Representation RepresentationFromType(Type* type); |
3211 | 3227 |
3212 } // namespace internal | 3228 } // namespace internal |
3213 } // namespace v8 | 3229 } // namespace v8 |
3214 | 3230 |
3215 #endif // V8_CODE_STUBS_H_ | 3231 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |