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 26 matching lines...) Expand all Loading... |
37 V(JSEntry) \ | 37 V(JSEntry) \ |
38 V(KeyedLoadICTrampoline) \ | 38 V(KeyedLoadICTrampoline) \ |
39 V(LoadICTrampoline) \ | 39 V(LoadICTrampoline) \ |
40 V(CallICTrampoline) \ | 40 V(CallICTrampoline) \ |
41 V(LoadIndexedInterceptor) \ | 41 V(LoadIndexedInterceptor) \ |
42 V(LoadIndexedString) \ | 42 V(LoadIndexedString) \ |
43 V(MathPow) \ | 43 V(MathPow) \ |
44 V(ProfileEntryHook) \ | 44 V(ProfileEntryHook) \ |
45 V(RecordWrite) \ | 45 V(RecordWrite) \ |
46 V(RegExpExec) \ | 46 V(RegExpExec) \ |
47 V(StoreArrayLiteralElement) \ | |
48 V(StoreBufferOverflow) \ | 47 V(StoreBufferOverflow) \ |
49 V(StoreElement) \ | 48 V(StoreElement) \ |
50 V(StringCompare) \ | 49 V(StringCompare) \ |
51 V(StubFailureTrampoline) \ | 50 V(StubFailureTrampoline) \ |
52 V(SubString) \ | 51 V(SubString) \ |
53 V(ToNumber) \ | 52 V(ToNumber) \ |
54 V(ToLength) \ | 53 V(ToLength) \ |
55 V(ToString) \ | 54 V(ToString) \ |
56 V(ToObject) \ | 55 V(ToObject) \ |
57 V(VectorStoreICTrampoline) \ | 56 V(VectorStoreICTrampoline) \ |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 | 1224 |
1226 static Register NameRegister() { | 1225 static Register NameRegister() { |
1227 return StoreTransitionDescriptor::NameRegister(); | 1226 return StoreTransitionDescriptor::NameRegister(); |
1228 } | 1227 } |
1229 | 1228 |
1230 static Register ValueRegister() { | 1229 static Register ValueRegister() { |
1231 return StoreTransitionDescriptor::ValueRegister(); | 1230 return StoreTransitionDescriptor::ValueRegister(); |
1232 } | 1231 } |
1233 | 1232 |
1234 static Register SlotRegister() { | 1233 static Register SlotRegister() { |
1235 DCHECK(FLAG_vector_stores); | |
1236 return VectorStoreTransitionDescriptor::SlotRegister(); | 1234 return VectorStoreTransitionDescriptor::SlotRegister(); |
1237 } | 1235 } |
1238 | 1236 |
1239 static Register VectorRegister() { | 1237 static Register VectorRegister() { |
1240 DCHECK(FLAG_vector_stores); | |
1241 return VectorStoreTransitionDescriptor::VectorRegister(); | 1238 return VectorStoreTransitionDescriptor::VectorRegister(); |
1242 } | 1239 } |
1243 | 1240 |
1244 static Register MapRegister() { | 1241 static Register MapRegister() { |
1245 if (FLAG_vector_stores) { | 1242 return VectorStoreTransitionDescriptor::MapRegister(); |
1246 return VectorStoreTransitionDescriptor::MapRegister(); | |
1247 } | |
1248 return StoreTransitionDescriptor::MapRegister(); | |
1249 } | 1243 } |
1250 | 1244 |
1251 static int ReceiverIndex() { | 1245 static int ReceiverIndex() { |
1252 return StoreTransitionDescriptor::kReceiverIndex; | 1246 return StoreTransitionDescriptor::kReceiverIndex; |
1253 } | 1247 } |
1254 | 1248 |
1255 static int NameIndex() { return StoreTransitionDescriptor::kReceiverIndex; } | 1249 static int NameIndex() { return StoreTransitionDescriptor::kReceiverIndex; } |
1256 | 1250 |
1257 static int ValueIndex() { return StoreTransitionDescriptor::kValueIndex; } | 1251 static int ValueIndex() { return StoreTransitionDescriptor::kValueIndex; } |
1258 | 1252 |
1259 static int MapIndex() { | 1253 static int MapIndex() { |
1260 DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMapIndex) == | 1254 DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMapIndex) == |
1261 static_cast<int>(StoreTransitionDescriptor::kMapIndex)); | 1255 static_cast<int>(StoreTransitionDescriptor::kMapIndex)); |
1262 return StoreTransitionDescriptor::kMapIndex; | 1256 return StoreTransitionDescriptor::kMapIndex; |
1263 } | 1257 } |
1264 | 1258 |
1265 static int VectorIndex() { | 1259 static int VectorIndex() { |
1266 DCHECK(FLAG_vector_stores); | |
1267 if (HasVirtualSlotArg()) { | 1260 if (HasVirtualSlotArg()) { |
1268 return VectorStoreTransitionDescriptor::kVirtualSlotVectorIndex; | 1261 return VectorStoreTransitionDescriptor::kVirtualSlotVectorIndex; |
1269 } | 1262 } |
1270 return VectorStoreTransitionDescriptor::kVectorIndex; | 1263 return VectorStoreTransitionDescriptor::kVectorIndex; |
1271 } | 1264 } |
1272 | 1265 |
1273 // Some platforms don't have a slot arg. | 1266 // Some platforms don't have a slot arg. |
1274 static bool HasVirtualSlotArg() { | 1267 static bool HasVirtualSlotArg() { |
1275 if (!FLAG_vector_stores) return false; | |
1276 return SlotRegister().is(no_reg); | 1268 return SlotRegister().is(no_reg); |
1277 } | 1269 } |
1278 }; | 1270 }; |
1279 | 1271 |
1280 | 1272 |
1281 class StoreTransitionStub : public HandlerStub { | 1273 class StoreTransitionStub : public HandlerStub { |
1282 public: | 1274 public: |
1283 enum StoreMode { | 1275 enum StoreMode { |
1284 StoreMapOnly, | 1276 StoreMapOnly, |
1285 StoreMapAndValue, | 1277 StoreMapAndValue, |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 | 2551 |
2560 ElementsKind elements_kind() const { | 2552 ElementsKind elements_kind() const { |
2561 return ElementsKindBits::decode(sub_minor_key()); | 2553 return ElementsKindBits::decode(sub_minor_key()); |
2562 } | 2554 } |
2563 | 2555 |
2564 KeyedAccessStoreMode store_mode() const { | 2556 KeyedAccessStoreMode store_mode() const { |
2565 return CommonStoreModeBits::decode(sub_minor_key()); | 2557 return CommonStoreModeBits::decode(sub_minor_key()); |
2566 } | 2558 } |
2567 | 2559 |
2568 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | 2560 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
2569 if (FLAG_vector_stores) { | 2561 return VectorStoreICDescriptor(isolate()); |
2570 return VectorStoreICDescriptor(isolate()); | |
2571 } | |
2572 return StoreDescriptor(isolate()); | |
2573 } | 2562 } |
2574 | 2563 |
2575 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 2564 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
2576 | 2565 |
2577 private: | 2566 private: |
2578 class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; | 2567 class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; |
2579 class IsJSArrayBits : public BitField<bool, 11, 1> {}; | 2568 class IsJSArrayBits : public BitField<bool, 11, 1> {}; |
2580 | 2569 |
2581 DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub); | 2570 DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub); |
2582 }; | 2571 }; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2813 class StoreElementStub : public PlatformCodeStub { | 2802 class StoreElementStub : public PlatformCodeStub { |
2814 public: | 2803 public: |
2815 StoreElementStub(Isolate* isolate, ElementsKind elements_kind, | 2804 StoreElementStub(Isolate* isolate, ElementsKind elements_kind, |
2816 KeyedAccessStoreMode mode) | 2805 KeyedAccessStoreMode mode) |
2817 : PlatformCodeStub(isolate) { | 2806 : PlatformCodeStub(isolate) { |
2818 minor_key_ = ElementsKindBits::encode(elements_kind) | | 2807 minor_key_ = ElementsKindBits::encode(elements_kind) | |
2819 CommonStoreModeBits::encode(mode); | 2808 CommonStoreModeBits::encode(mode); |
2820 } | 2809 } |
2821 | 2810 |
2822 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | 2811 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
2823 if (FLAG_vector_stores) { | 2812 return VectorStoreICDescriptor(isolate()); |
2824 return VectorStoreICDescriptor(isolate()); | |
2825 } | |
2826 return StoreDescriptor(isolate()); | |
2827 } | 2813 } |
2828 | 2814 |
2829 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 2815 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
2830 | 2816 |
2831 private: | 2817 private: |
2832 ElementsKind elements_kind() const { | 2818 ElementsKind elements_kind() const { |
2833 return ElementsKindBits::decode(minor_key_); | 2819 return ElementsKindBits::decode(minor_key_); |
2834 } | 2820 } |
2835 | 2821 |
2836 class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; | 2822 class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2954 | 2940 |
2955 private: | 2941 private: |
2956 class FromBits : public BitField<ElementsKind, 3, 8> {}; | 2942 class FromBits : public BitField<ElementsKind, 3, 8> {}; |
2957 class ToBits : public BitField<ElementsKind, 11, 8> {}; | 2943 class ToBits : public BitField<ElementsKind, 11, 8> {}; |
2958 class IsJSArrayBits : public BitField<bool, 19, 1> {}; | 2944 class IsJSArrayBits : public BitField<bool, 19, 1> {}; |
2959 | 2945 |
2960 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); | 2946 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); |
2961 }; | 2947 }; |
2962 | 2948 |
2963 | 2949 |
2964 class StoreArrayLiteralElementStub : public PlatformCodeStub { | |
2965 public: | |
2966 explicit StoreArrayLiteralElementStub(Isolate* isolate) | |
2967 : PlatformCodeStub(isolate) { } | |
2968 | |
2969 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreArrayLiteralElement); | |
2970 DEFINE_PLATFORM_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub); | |
2971 }; | |
2972 | |
2973 | |
2974 class StubFailureTrampolineStub : public PlatformCodeStub { | 2950 class StubFailureTrampolineStub : public PlatformCodeStub { |
2975 public: | 2951 public: |
2976 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) | 2952 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) |
2977 : PlatformCodeStub(isolate) { | 2953 : PlatformCodeStub(isolate) { |
2978 minor_key_ = FunctionModeField::encode(function_mode); | 2954 minor_key_ = FunctionModeField::encode(function_mode); |
2979 } | 2955 } |
2980 | 2956 |
2981 static void GenerateAheadOfTime(Isolate* isolate); | 2957 static void GenerateAheadOfTime(Isolate* isolate); |
2982 | 2958 |
2983 private: | 2959 private: |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3094 #undef DEFINE_HYDROGEN_CODE_STUB | 3070 #undef DEFINE_HYDROGEN_CODE_STUB |
3095 #undef DEFINE_CODE_STUB | 3071 #undef DEFINE_CODE_STUB |
3096 #undef DEFINE_CODE_STUB_BASE | 3072 #undef DEFINE_CODE_STUB_BASE |
3097 | 3073 |
3098 extern Representation RepresentationFromType(Type* type); | 3074 extern Representation RepresentationFromType(Type* type); |
3099 | 3075 |
3100 } // namespace internal | 3076 } // namespace internal |
3101 } // namespace v8 | 3077 } // namespace v8 |
3102 | 3078 |
3103 #endif // V8_CODE_STUBS_H_ | 3079 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |