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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 | 1133 |
1134 protected: | 1134 protected: |
1135 Code::Kind kind() const override { return Code::KEYED_LOAD_IC; } | 1135 Code::Kind kind() const override { return Code::KEYED_LOAD_IC; } |
1136 Code::StubType GetStubType() const override { return Code::FAST; } | 1136 Code::StubType GetStubType() const override { return Code::FAST; } |
1137 | 1137 |
1138 private: | 1138 private: |
1139 DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub); | 1139 DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub); |
1140 }; | 1140 }; |
1141 | 1141 |
1142 | 1142 |
| 1143 class CommonStoreModeBits : public BitField<KeyedAccessStoreMode, 0, 3> {}; |
| 1144 |
1143 class KeyedStoreSloppyArgumentsStub : public HandlerStub { | 1145 class KeyedStoreSloppyArgumentsStub : public HandlerStub { |
1144 public: | 1146 public: |
1145 explicit KeyedStoreSloppyArgumentsStub(Isolate* isolate) | 1147 explicit KeyedStoreSloppyArgumentsStub(Isolate* isolate, |
1146 : HandlerStub(isolate) {} | 1148 KeyedAccessStoreMode mode) |
| 1149 : HandlerStub(isolate) { |
| 1150 set_sub_minor_key(CommonStoreModeBits::encode(mode)); |
| 1151 } |
1147 | 1152 |
1148 protected: | 1153 protected: |
1149 Code::Kind kind() const override { return Code::KEYED_STORE_IC; } | 1154 Code::Kind kind() const override { return Code::KEYED_STORE_IC; } |
1150 Code::StubType GetStubType() const override { return Code::FAST; } | 1155 Code::StubType GetStubType() const override { return Code::FAST; } |
1151 | 1156 |
1152 private: | 1157 private: |
1153 DEFINE_HANDLER_CODE_STUB(KeyedStoreSloppyArguments, HandlerStub); | 1158 DEFINE_HANDLER_CODE_STUB(KeyedStoreSloppyArguments, HandlerStub); |
1154 }; | 1159 }; |
1155 | 1160 |
1156 | 1161 |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 | 2593 |
2589 DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub); | 2594 DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub); |
2590 }; | 2595 }; |
2591 | 2596 |
2592 | 2597 |
2593 class StoreFastElementStub : public HydrogenCodeStub { | 2598 class StoreFastElementStub : public HydrogenCodeStub { |
2594 public: | 2599 public: |
2595 StoreFastElementStub(Isolate* isolate, bool is_js_array, | 2600 StoreFastElementStub(Isolate* isolate, bool is_js_array, |
2596 ElementsKind elements_kind, KeyedAccessStoreMode mode) | 2601 ElementsKind elements_kind, KeyedAccessStoreMode mode) |
2597 : HydrogenCodeStub(isolate) { | 2602 : HydrogenCodeStub(isolate) { |
2598 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 2603 set_sub_minor_key(CommonStoreModeBits::encode(mode) | |
2599 IsJSArrayBits::encode(is_js_array) | | 2604 ElementsKindBits::encode(elements_kind) | |
2600 StoreModeBits::encode(mode)); | 2605 IsJSArrayBits::encode(is_js_array)); |
2601 } | 2606 } |
2602 | 2607 |
2603 static void GenerateAheadOfTime(Isolate* isolate); | 2608 static void GenerateAheadOfTime(Isolate* isolate); |
2604 | 2609 |
2605 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2610 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
2606 | 2611 |
2607 ElementsKind elements_kind() const { | 2612 ElementsKind elements_kind() const { |
2608 return ElementsKindBits::decode(sub_minor_key()); | 2613 return ElementsKindBits::decode(sub_minor_key()); |
2609 } | 2614 } |
2610 | 2615 |
2611 KeyedAccessStoreMode store_mode() const { | 2616 KeyedAccessStoreMode store_mode() const { |
2612 return StoreModeBits::decode(sub_minor_key()); | 2617 return CommonStoreModeBits::decode(sub_minor_key()); |
2613 } | 2618 } |
2614 | 2619 |
2615 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | 2620 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
2616 if (FLAG_vector_stores) { | 2621 if (FLAG_vector_stores) { |
2617 return VectorStoreICDescriptor(isolate()); | 2622 return VectorStoreICDescriptor(isolate()); |
2618 } | 2623 } |
2619 return StoreDescriptor(isolate()); | 2624 return StoreDescriptor(isolate()); |
2620 } | 2625 } |
2621 | 2626 |
| 2627 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 2628 |
2622 private: | 2629 private: |
2623 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2630 class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; |
2624 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2631 class IsJSArrayBits : public BitField<bool, 11, 1> {}; |
2625 class IsJSArrayBits: public BitField<bool, 12, 1> {}; | |
2626 | 2632 |
2627 DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub); | 2633 DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub); |
2628 }; | 2634 }; |
2629 | 2635 |
2630 | 2636 |
2631 class TransitionElementsKindStub : public HydrogenCodeStub { | 2637 class TransitionElementsKindStub : public HydrogenCodeStub { |
2632 public: | 2638 public: |
2633 TransitionElementsKindStub(Isolate* isolate, | 2639 TransitionElementsKindStub(Isolate* isolate, |
2634 ElementsKind from_kind, | 2640 ElementsKind from_kind, |
2635 ElementsKind to_kind, | 2641 ElementsKind to_kind, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2829 : InternalArrayConstructorStubBase(isolate, kind) { } | 2835 : InternalArrayConstructorStubBase(isolate, kind) { } |
2830 | 2836 |
2831 DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor); | 2837 DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor); |
2832 DEFINE_HYDROGEN_CODE_STUB(InternalArrayNArgumentsConstructor, | 2838 DEFINE_HYDROGEN_CODE_STUB(InternalArrayNArgumentsConstructor, |
2833 InternalArrayConstructorStubBase); | 2839 InternalArrayConstructorStubBase); |
2834 }; | 2840 }; |
2835 | 2841 |
2836 | 2842 |
2837 class StoreElementStub : public PlatformCodeStub { | 2843 class StoreElementStub : public PlatformCodeStub { |
2838 public: | 2844 public: |
2839 StoreElementStub(Isolate* isolate, ElementsKind elements_kind) | 2845 StoreElementStub(Isolate* isolate, ElementsKind elements_kind, |
| 2846 KeyedAccessStoreMode mode) |
2840 : PlatformCodeStub(isolate) { | 2847 : PlatformCodeStub(isolate) { |
2841 minor_key_ = ElementsKindBits::encode(elements_kind); | 2848 minor_key_ = ElementsKindBits::encode(elements_kind) | |
| 2849 CommonStoreModeBits::encode(mode); |
2842 } | 2850 } |
2843 | 2851 |
2844 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | 2852 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
2845 if (FLAG_vector_stores) { | 2853 if (FLAG_vector_stores) { |
2846 return VectorStoreICDescriptor(isolate()); | 2854 return VectorStoreICDescriptor(isolate()); |
2847 } | 2855 } |
2848 return StoreDescriptor(isolate()); | 2856 return StoreDescriptor(isolate()); |
2849 } | 2857 } |
2850 | 2858 |
| 2859 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 2860 |
2851 private: | 2861 private: |
2852 ElementsKind elements_kind() const { | 2862 ElementsKind elements_kind() const { |
2853 return ElementsKindBits::decode(minor_key_); | 2863 return ElementsKindBits::decode(minor_key_); |
2854 } | 2864 } |
2855 | 2865 |
2856 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; | 2866 class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; |
2857 | 2867 |
2858 DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub); | 2868 DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub); |
2859 }; | 2869 }; |
2860 | 2870 |
2861 | 2871 |
2862 class ToBooleanStub: public HydrogenCodeStub { | 2872 class ToBooleanStub: public HydrogenCodeStub { |
2863 public: | 2873 public: |
2864 enum Type { | 2874 enum Type { |
2865 UNDEFINED, | 2875 UNDEFINED, |
2866 BOOLEAN, | 2876 BOOLEAN, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2950 | 2960 |
2951 std::ostream& operator<<(std::ostream& os, const ToBooleanStub::Types& t); | 2961 std::ostream& operator<<(std::ostream& os, const ToBooleanStub::Types& t); |
2952 | 2962 |
2953 | 2963 |
2954 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { | 2964 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { |
2955 public: | 2965 public: |
2956 ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind, | 2966 ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind, |
2957 ElementsKind to_kind, bool is_jsarray, | 2967 ElementsKind to_kind, bool is_jsarray, |
2958 KeyedAccessStoreMode store_mode) | 2968 KeyedAccessStoreMode store_mode) |
2959 : HydrogenCodeStub(isolate) { | 2969 : HydrogenCodeStub(isolate) { |
2960 set_sub_minor_key(FromBits::encode(from_kind) | ToBits::encode(to_kind) | | 2970 set_sub_minor_key(CommonStoreModeBits::encode(store_mode) | |
2961 IsJSArrayBits::encode(is_jsarray) | | 2971 FromBits::encode(from_kind) | ToBits::encode(to_kind) | |
2962 StoreModeBits::encode(store_mode)); | 2972 IsJSArrayBits::encode(is_jsarray)); |
2963 } | 2973 } |
2964 | 2974 |
2965 ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); } | 2975 ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); } |
2966 ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); } | 2976 ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); } |
2967 bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2977 bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); } |
2968 KeyedAccessStoreMode store_mode() const { | 2978 KeyedAccessStoreMode store_mode() const { |
2969 return StoreModeBits::decode(sub_minor_key()); | 2979 return CommonStoreModeBits::decode(sub_minor_key()); |
2970 } | 2980 } |
2971 | 2981 |
2972 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override; | 2982 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override; |
| 2983 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
2973 | 2984 |
2974 private: | 2985 private: |
2975 class FromBits : public BitField<ElementsKind, 0, 8> {}; | 2986 class FromBits : public BitField<ElementsKind, 3, 8> {}; |
2976 class ToBits : public BitField<ElementsKind, 8, 8> {}; | 2987 class ToBits : public BitField<ElementsKind, 11, 8> {}; |
2977 class IsJSArrayBits : public BitField<bool, 16, 1> {}; | 2988 class IsJSArrayBits : public BitField<bool, 19, 1> {}; |
2978 class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {}; | |
2979 | 2989 |
2980 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); | 2990 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); |
2981 }; | 2991 }; |
2982 | 2992 |
2983 | 2993 |
2984 class StoreArrayLiteralElementStub : public PlatformCodeStub { | 2994 class StoreArrayLiteralElementStub : public PlatformCodeStub { |
2985 public: | 2995 public: |
2986 explicit StoreArrayLiteralElementStub(Isolate* isolate) | 2996 explicit StoreArrayLiteralElementStub(Isolate* isolate) |
2987 : PlatformCodeStub(isolate) { } | 2997 : PlatformCodeStub(isolate) { } |
2988 | 2998 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3094 #undef DEFINE_PLATFORM_CODE_STUB | 3104 #undef DEFINE_PLATFORM_CODE_STUB |
3095 #undef DEFINE_HANDLER_CODE_STUB | 3105 #undef DEFINE_HANDLER_CODE_STUB |
3096 #undef DEFINE_HYDROGEN_CODE_STUB | 3106 #undef DEFINE_HYDROGEN_CODE_STUB |
3097 #undef DEFINE_CODE_STUB | 3107 #undef DEFINE_CODE_STUB |
3098 #undef DEFINE_CODE_STUB_BASE | 3108 #undef DEFINE_CODE_STUB_BASE |
3099 | 3109 |
3100 extern Representation RepresentationFromType(Type* type); | 3110 extern Representation RepresentationFromType(Type* type); |
3101 } } // namespace v8::internal | 3111 } } // namespace v8::internal |
3102 | 3112 |
3103 #endif // V8_CODE_STUBS_H_ | 3113 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |