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(StoreGlobal) \ | 87 V(StoreGlobal) \ |
87 V(StringLength) | 88 V(StringLength) |
88 | 89 |
89 // List of code stubs only used on ARM 32 bits platforms. | 90 // List of code stubs only used on ARM 32 bits platforms. |
90 #if V8_TARGET_ARCH_ARM | 91 #if V8_TARGET_ARCH_ARM |
91 #define CODE_STUB_LIST_ARM(V) \ | 92 #define CODE_STUB_LIST_ARM(V) \ |
92 V(DirectCEntry) \ | 93 V(DirectCEntry) \ |
93 V(WriteInt32ToHeapNumber) | 94 V(WriteInt32ToHeapNumber) |
94 | 95 |
95 #else | 96 #else |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 virtual Code::StubType GetStubType() { return Code::FAST; } | 975 virtual Code::StubType GetStubType() { return Code::FAST; } |
975 | 976 |
976 private: | 977 private: |
977 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 978 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
978 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 979 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
979 | 980 |
980 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); | 981 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); |
981 }; | 982 }; |
982 | 983 |
983 | 984 |
| 985 // Extend storage is called in a store inline cache when |
| 986 // it is necessary to extend the properties array of a |
| 987 // JSObject. |
| 988 class ExtendStorageStub : public HandlerStub { |
| 989 public: |
| 990 ExtendStorageStub(Isolate* isolate, FieldIndex index, |
| 991 Representation representation) |
| 992 : HandlerStub(isolate) { |
| 993 int property_index_key = index.GetFieldAccessStubKey(); |
| 994 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); |
| 995 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | |
| 996 RepresentationBits::encode(repr)); |
| 997 } |
| 998 |
| 999 FieldIndex index() const { |
| 1000 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); |
| 1001 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
| 1002 } |
| 1003 |
| 1004 Representation representation() { |
| 1005 uint8_t repr = RepresentationBits::decode(sub_minor_key()); |
| 1006 return PropertyDetails::DecodeRepresentation(repr); |
| 1007 } |
| 1008 |
| 1009 protected: |
| 1010 virtual Code::Kind kind() const { return Code::STORE_IC; } |
| 1011 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 1012 |
| 1013 private: |
| 1014 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 1015 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
| 1016 |
| 1017 DEFINE_HANDLER_CODE_STUB(ExtendStorage, HandlerStub); |
| 1018 }; |
| 1019 |
| 1020 |
984 class StoreGlobalStub : public HandlerStub { | 1021 class StoreGlobalStub : public HandlerStub { |
985 public: | 1022 public: |
986 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 1023 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
987 : HandlerStub(isolate) { | 1024 : HandlerStub(isolate) { |
988 set_sub_minor_key(IsConstantBits::encode(is_constant) | | 1025 set_sub_minor_key(IsConstantBits::encode(is_constant) | |
989 CheckGlobalBits::encode(check_global)); | 1026 CheckGlobalBits::encode(check_global)); |
990 } | 1027 } |
991 | 1028 |
992 static Handle<HeapObject> global_placeholder(Isolate* isolate) { | 1029 static Handle<HeapObject> global_placeholder(Isolate* isolate) { |
993 return isolate->factory()->uninitialized_value(); | 1030 return isolate->factory()->uninitialized_value(); |
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2413 | 2450 |
2414 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2451 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2415 #undef DEFINE_PLATFORM_CODE_STUB | 2452 #undef DEFINE_PLATFORM_CODE_STUB |
2416 #undef DEFINE_HANDLER_CODE_STUB | 2453 #undef DEFINE_HANDLER_CODE_STUB |
2417 #undef DEFINE_HYDROGEN_CODE_STUB | 2454 #undef DEFINE_HYDROGEN_CODE_STUB |
2418 #undef DEFINE_CODE_STUB | 2455 #undef DEFINE_CODE_STUB |
2419 #undef DEFINE_CODE_STUB_BASE | 2456 #undef DEFINE_CODE_STUB_BASE |
2420 } } // namespace v8::internal | 2457 } } // namespace v8::internal |
2421 | 2458 |
2422 #endif // V8_CODE_STUBS_H_ | 2459 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |