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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(LoadConstant) \ | 83 V(LoadConstant) \ |
84 V(LoadField) \ | 84 V(LoadField) \ |
85 V(StoreField) \ | 85 V(StoreField) \ |
86 V(ExtendStorage) \ | 86 V(StoreTransition) \ |
Yang
2014/09/30 11:56:53
alpha-sort.
Igor Sheludko
2014/09/30 14:54:53
Done.
| |
87 V(StoreGlobal) \ | 87 V(StoreGlobal) \ |
88 V(StringLength) | 88 V(StringLength) |
89 | 89 |
90 // List of code stubs only used on ARM 32 bits platforms. | 90 // List of code stubs only used on ARM 32 bits platforms. |
91 #if V8_TARGET_ARCH_ARM | 91 #if V8_TARGET_ARCH_ARM |
92 #define CODE_STUB_LIST_ARM(V) \ | 92 #define CODE_STUB_LIST_ARM(V) \ |
93 V(DirectCEntry) \ | 93 V(DirectCEntry) \ |
94 V(WriteInt32ToHeapNumber) | 94 V(WriteInt32ToHeapNumber) |
95 | 95 |
96 #else | 96 #else |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
975 virtual Code::StubType GetStubType() { return Code::FAST; } | 975 virtual Code::StubType GetStubType() { return Code::FAST; } |
976 | 976 |
977 private: | 977 private: |
978 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 978 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
979 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 979 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
980 | 980 |
981 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); | 981 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); |
982 }; | 982 }; |
983 | 983 |
984 | 984 |
985 // Extend storage is called in a store inline cache when | 985 // Extend storage is called in a store inline cache when |
Yang
2014/09/30 11:56:53
not sure if comment outdated.
Igor Sheludko
2014/09/30 14:54:53
Done.
| |
986 // it is necessary to extend the properties array of a | 986 // it is necessary to extend the properties array of a |
987 // JSObject. | 987 // JSObject. |
988 class ExtendStorageStub : public HandlerStub { | 988 class StoreTransitionStub : public HandlerStub { |
989 public: | 989 public: |
990 ExtendStorageStub(Isolate* isolate, FieldIndex index, | 990 enum StoreMode { |
991 Representation representation) | 991 StoreMapOnly, |
992 StoreMapAndValue, | |
993 ExtendStorageAndStoreMapAndValue | |
994 }; | |
995 | |
996 explicit StoreTransitionStub(Isolate* isolate) : HandlerStub(isolate) { | |
997 set_sub_minor_key(StoreModeBits::encode(StoreMapOnly)); | |
998 } | |
999 | |
1000 StoreTransitionStub(Isolate* isolate, FieldIndex index, | |
1001 Representation representation, StoreMode store_mode) | |
992 : HandlerStub(isolate) { | 1002 : HandlerStub(isolate) { |
1003 DCHECK(store_mode != StoreMapOnly); | |
993 int property_index_key = index.GetFieldAccessStubKey(); | 1004 int property_index_key = index.GetFieldAccessStubKey(); |
994 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); | 1005 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); |
995 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | | 1006 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | |
996 RepresentationBits::encode(repr)); | 1007 RepresentationBits::encode(repr) | |
1008 StoreModeBits::encode(store_mode)); | |
997 } | 1009 } |
998 | 1010 |
999 FieldIndex index() const { | 1011 FieldIndex index() const { |
1012 DCHECK(store_mode() != StoreMapOnly); | |
1000 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); | 1013 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); |
1001 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 1014 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
1002 } | 1015 } |
1003 | 1016 |
1004 Representation representation() { | 1017 Representation representation() { |
1018 DCHECK(store_mode() != StoreMapOnly); | |
1005 uint8_t repr = RepresentationBits::decode(sub_minor_key()); | 1019 uint8_t repr = RepresentationBits::decode(sub_minor_key()); |
1006 return PropertyDetails::DecodeRepresentation(repr); | 1020 return PropertyDetails::DecodeRepresentation(repr); |
1007 } | 1021 } |
1008 | 1022 |
1023 StoreMode store_mode() const { | |
1024 return StoreModeBits::decode(sub_minor_key()); | |
1025 } | |
1026 | |
1009 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE; | 1027 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE; |
1010 | 1028 |
1011 protected: | 1029 protected: |
1012 virtual Code::Kind kind() const { return Code::STORE_IC; } | 1030 virtual Code::Kind kind() const { return Code::STORE_IC; } |
1013 virtual Code::StubType GetStubType() { return Code::FAST; } | 1031 virtual Code::StubType GetStubType() { return Code::FAST; } |
1014 | 1032 |
1015 private: | 1033 private: |
1016 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1034 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
1017 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1035 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
1036 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; | |
1018 | 1037 |
1019 DEFINE_HANDLER_CODE_STUB(ExtendStorage, HandlerStub); | 1038 DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); |
1020 }; | 1039 }; |
1021 | 1040 |
1022 | 1041 |
1023 class StoreGlobalStub : public HandlerStub { | 1042 class StoreGlobalStub : public HandlerStub { |
1024 public: | 1043 public: |
1025 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 1044 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
1026 : HandlerStub(isolate) { | 1045 : HandlerStub(isolate) { |
1027 set_sub_minor_key(IsConstantBits::encode(is_constant) | | 1046 set_sub_minor_key(IsConstantBits::encode(is_constant) | |
1028 CheckGlobalBits::encode(check_global)); | 1047 CheckGlobalBits::encode(check_global)); |
1029 } | 1048 } |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2452 | 2471 |
2453 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2472 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2454 #undef DEFINE_PLATFORM_CODE_STUB | 2473 #undef DEFINE_PLATFORM_CODE_STUB |
2455 #undef DEFINE_HANDLER_CODE_STUB | 2474 #undef DEFINE_HANDLER_CODE_STUB |
2456 #undef DEFINE_HYDROGEN_CODE_STUB | 2475 #undef DEFINE_HYDROGEN_CODE_STUB |
2457 #undef DEFINE_CODE_STUB | 2476 #undef DEFINE_CODE_STUB |
2458 #undef DEFINE_CODE_STUB_BASE | 2477 #undef DEFINE_CODE_STUB_BASE |
2459 } } // namespace v8::internal | 2478 } } // namespace v8::internal |
2460 | 2479 |
2461 #endif // V8_CODE_STUBS_H_ | 2480 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |