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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 V(NumberToString) \ | 73 V(NumberToString) \ |
74 V(RegExpConstructResult) \ | 74 V(RegExpConstructResult) \ |
75 V(StoreFastElement) \ | 75 V(StoreFastElement) \ |
76 V(StringAdd) \ | 76 V(StringAdd) \ |
77 V(ToBoolean) \ | 77 V(ToBoolean) \ |
78 V(ToNumber) \ | 78 V(ToNumber) \ |
79 V(TransitionElementsKind) \ | 79 V(TransitionElementsKind) \ |
80 V(VectorKeyedLoad) \ | 80 V(VectorKeyedLoad) \ |
81 V(VectorLoad) \ | 81 V(VectorLoad) \ |
82 /* IC Handler stubs */ \ | 82 /* IC Handler stubs */ \ |
83 V(ExtendStorage) \ | |
84 V(LoadConstant) \ | 83 V(LoadConstant) \ |
85 V(LoadField) \ | 84 V(LoadField) \ |
86 V(KeyedLoadSloppyArguments) \ | 85 V(KeyedLoadSloppyArguments) \ |
87 V(StoreField) \ | 86 V(StoreField) \ |
88 V(StoreGlobal) \ | 87 V(StoreGlobal) \ |
| 88 V(StoreTransition) \ |
89 V(StringLength) | 89 V(StringLength) |
90 | 90 |
91 // List of code stubs only used on ARM 32 bits platforms. | 91 // List of code stubs only used on ARM 32 bits platforms. |
92 #if V8_TARGET_ARCH_ARM | 92 #if V8_TARGET_ARCH_ARM |
93 #define CODE_STUB_LIST_ARM(V) \ | 93 #define CODE_STUB_LIST_ARM(V) \ |
94 V(DirectCEntry) \ | 94 V(DirectCEntry) \ |
95 V(WriteInt32ToHeapNumber) | 95 V(WriteInt32ToHeapNumber) |
96 | 96 |
97 #else | 97 #else |
98 #define CODE_STUB_LIST_ARM(V) | 98 #define CODE_STUB_LIST_ARM(V) |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 virtual Code::StubType GetStubType() { return Code::FAST; } | 992 virtual Code::StubType GetStubType() { return Code::FAST; } |
993 | 993 |
994 private: | 994 private: |
995 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 995 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
996 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 996 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
997 | 997 |
998 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); | 998 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); |
999 }; | 999 }; |
1000 | 1000 |
1001 | 1001 |
1002 // Extend storage is called in a store inline cache when | 1002 class StoreTransitionStub : public HandlerStub { |
1003 // it is necessary to extend the properties array of a | |
1004 // JSObject. | |
1005 class ExtendStorageStub : public HandlerStub { | |
1006 public: | 1003 public: |
1007 ExtendStorageStub(Isolate* isolate, FieldIndex index, | 1004 enum StoreMode { |
1008 Representation representation) | 1005 StoreMapOnly, |
| 1006 StoreMapAndValue, |
| 1007 ExtendStorageAndStoreMapAndValue |
| 1008 }; |
| 1009 |
| 1010 explicit StoreTransitionStub(Isolate* isolate) : HandlerStub(isolate) { |
| 1011 set_sub_minor_key(StoreModeBits::encode(StoreMapOnly)); |
| 1012 } |
| 1013 |
| 1014 StoreTransitionStub(Isolate* isolate, FieldIndex index, |
| 1015 Representation representation, StoreMode store_mode) |
1009 : HandlerStub(isolate) { | 1016 : HandlerStub(isolate) { |
| 1017 DCHECK(store_mode != StoreMapOnly); |
1010 int property_index_key = index.GetFieldAccessStubKey(); | 1018 int property_index_key = index.GetFieldAccessStubKey(); |
1011 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); | 1019 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); |
1012 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | | 1020 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | |
1013 RepresentationBits::encode(repr)); | 1021 RepresentationBits::encode(repr) | |
| 1022 StoreModeBits::encode(store_mode)); |
1014 } | 1023 } |
1015 | 1024 |
1016 FieldIndex index() const { | 1025 FieldIndex index() const { |
| 1026 DCHECK(store_mode() != StoreMapOnly); |
1017 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); | 1027 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); |
1018 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 1028 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
1019 } | 1029 } |
1020 | 1030 |
1021 Representation representation() { | 1031 Representation representation() { |
| 1032 DCHECK(store_mode() != StoreMapOnly); |
1022 uint8_t repr = RepresentationBits::decode(sub_minor_key()); | 1033 uint8_t repr = RepresentationBits::decode(sub_minor_key()); |
1023 return PropertyDetails::DecodeRepresentation(repr); | 1034 return PropertyDetails::DecodeRepresentation(repr); |
1024 } | 1035 } |
1025 | 1036 |
| 1037 StoreMode store_mode() const { |
| 1038 return StoreModeBits::decode(sub_minor_key()); |
| 1039 } |
| 1040 |
1026 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE; | 1041 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE; |
1027 | 1042 |
1028 protected: | 1043 protected: |
1029 virtual Code::Kind kind() const { return Code::STORE_IC; } | 1044 virtual Code::Kind kind() const { return Code::STORE_IC; } |
1030 virtual Code::StubType GetStubType() { return Code::FAST; } | 1045 virtual Code::StubType GetStubType() { return Code::FAST; } |
1031 | 1046 |
1032 private: | 1047 private: |
1033 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1048 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
1034 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1049 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
| 1050 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; |
1035 | 1051 |
1036 DEFINE_HANDLER_CODE_STUB(ExtendStorage, HandlerStub); | 1052 DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); |
1037 }; | 1053 }; |
1038 | 1054 |
1039 | 1055 |
1040 class StoreGlobalStub : public HandlerStub { | 1056 class StoreGlobalStub : public HandlerStub { |
1041 public: | 1057 public: |
1042 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 1058 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
1043 : HandlerStub(isolate) { | 1059 : HandlerStub(isolate) { |
1044 set_sub_minor_key(IsConstantBits::encode(is_constant) | | 1060 set_sub_minor_key(IsConstantBits::encode(is_constant) | |
1045 CheckGlobalBits::encode(check_global)); | 1061 CheckGlobalBits::encode(check_global)); |
1046 } | 1062 } |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2470 | 2486 |
2471 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2487 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2472 #undef DEFINE_PLATFORM_CODE_STUB | 2488 #undef DEFINE_PLATFORM_CODE_STUB |
2473 #undef DEFINE_HANDLER_CODE_STUB | 2489 #undef DEFINE_HANDLER_CODE_STUB |
2474 #undef DEFINE_HYDROGEN_CODE_STUB | 2490 #undef DEFINE_HYDROGEN_CODE_STUB |
2475 #undef DEFINE_CODE_STUB | 2491 #undef DEFINE_CODE_STUB |
2476 #undef DEFINE_CODE_STUB_BASE | 2492 #undef DEFINE_CODE_STUB_BASE |
2477 } } // namespace v8::internal | 2493 } } // namespace v8::internal |
2478 | 2494 |
2479 #endif // V8_CODE_STUBS_H_ | 2495 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |