OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_LOOKUP_H_ | 5 #ifndef V8_LOOKUP_H_ |
6 #define V8_LOOKUP_H_ | 6 #define V8_LOOKUP_H_ |
7 | 7 |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 has_property_ = false; | 81 has_property_ = false; |
82 state_ = NOT_FOUND; | 82 state_ = NOT_FOUND; |
83 } | 83 } |
84 | 84 |
85 Factory* factory() const { return isolate_->factory(); } | 85 Factory* factory() const { return isolate_->factory(); } |
86 Handle<Object> GetReceiver() const { return receiver_; } | 86 Handle<Object> GetReceiver() const { return receiver_; } |
87 Handle<JSObject> GetStoreTarget() const; | 87 Handle<JSObject> GetStoreTarget() const; |
88 bool is_dictionary_holder() const { return holder_map_->is_dictionary_map(); } | 88 bool is_dictionary_holder() const { return holder_map_->is_dictionary_map(); } |
89 Handle<Map> transition_map() const { | 89 Handle<Map> transition_map() const { |
90 DCHECK_EQ(TRANSITION, state_); | 90 DCHECK_EQ(TRANSITION, state_); |
91 return transition_map_; | 91 return Handle<Map>::cast(transition_); |
92 } | 92 } |
93 template <class T> | 93 template <class T> |
94 Handle<T> GetHolder() const { | 94 Handle<T> GetHolder() const { |
95 DCHECK(IsFound()); | 95 DCHECK(IsFound()); |
96 return Handle<T>::cast(holder_); | 96 return Handle<T>::cast(holder_); |
97 } | 97 } |
98 Handle<JSReceiver> GetRoot() const; | 98 Handle<JSReceiver> GetRoot() const; |
99 bool HolderIsReceiverOrHiddenPrototype() const; | 99 bool HolderIsReceiverOrHiddenPrototype() const; |
100 | 100 |
101 /* ACCESS_CHECK */ | 101 /* ACCESS_CHECK */ |
102 bool HasAccess(v8::AccessType access_type) const; | 102 bool HasAccess(v8::AccessType access_type) const; |
103 | 103 |
104 /* PROPERTY */ | 104 /* PROPERTY */ |
105 void PrepareForDataProperty(Handle<Object> value); | 105 void PrepareForDataProperty(Handle<Object> value); |
106 void PrepareTransitionToDataProperty(Handle<Object> value, | 106 void PrepareTransitionToDataProperty(Handle<Object> value, |
107 PropertyAttributes attributes, | 107 PropertyAttributes attributes, |
108 Object::StoreFromKeyed store_mode); | 108 Object::StoreFromKeyed store_mode); |
109 bool IsCacheableTransition() { | 109 bool IsCacheableTransition() { |
110 bool cacheable = | 110 if (state_ != TRANSITION) return false; |
111 state_ == TRANSITION && transition_map()->GetBackPointer()->IsMap(); | 111 return transition_->IsPropertyCell() || |
112 if (cacheable) { | 112 transition_map()->GetBackPointer()->IsMap(); |
113 property_details_ = transition_map_->GetLastDescriptorDetails(); | |
114 has_property_ = true; | |
115 } | |
116 return cacheable; | |
117 } | 113 } |
118 void ApplyTransitionToDataProperty(); | 114 void ApplyTransitionToDataProperty(); |
119 void ReconfigureDataProperty(Handle<Object> value, | 115 void ReconfigureDataProperty(Handle<Object> value, |
120 PropertyAttributes attributes); | 116 PropertyAttributes attributes); |
121 void TransitionToAccessorProperty(AccessorComponent component, | 117 void TransitionToAccessorProperty(AccessorComponent component, |
122 Handle<Object> accessor, | 118 Handle<Object> accessor, |
123 PropertyAttributes attributes); | 119 PropertyAttributes attributes); |
124 PropertyDetails property_details() const { | 120 PropertyDetails property_details() const { |
125 DCHECK(has_property_); | 121 DCHECK(has_property_); |
126 return property_details_; | 122 return property_details_; |
127 } | 123 } |
128 bool IsConfigurable() const { return property_details().IsConfigurable(); } | 124 bool IsConfigurable() const { return property_details().IsConfigurable(); } |
129 bool IsReadOnly() const { return property_details().IsReadOnly(); } | 125 bool IsReadOnly() const { return property_details().IsReadOnly(); } |
130 Representation representation() const { | 126 Representation representation() const { |
131 return property_details().representation(); | 127 return property_details().representation(); |
132 } | 128 } |
133 FieldIndex GetFieldIndex() const; | 129 FieldIndex GetFieldIndex() const; |
134 Handle<HeapType> GetFieldType() const; | 130 Handle<HeapType> GetFieldType() const; |
135 int GetAccessorIndex() const; | 131 int GetAccessorIndex() const; |
136 int GetConstantIndex() const; | 132 int GetConstantIndex() const; |
137 Handle<PropertyCell> GetPropertyCell() const; | 133 Handle<PropertyCell> GetPropertyCell() const; |
| 134 Handle<PropertyCell> GetTransitionPropertyCell() const { |
| 135 DCHECK_EQ(TRANSITION, state_); |
| 136 return Handle<PropertyCell>::cast(transition_); |
| 137 } |
138 Handle<Object> GetAccessors() const; | 138 Handle<Object> GetAccessors() const; |
139 Handle<Object> GetDataValue() const; | 139 Handle<Object> GetDataValue() const; |
140 // Usually returns the value that was passed in, but may perform | 140 // Usually returns the value that was passed in, but may perform |
141 // non-observable modifications on it, such as internalize strings. | 141 // non-observable modifications on it, such as internalize strings. |
142 Handle<Object> WriteDataValue(Handle<Object> value); | 142 Handle<Object> WriteDataValue(Handle<Object> value); |
143 | 143 |
144 // Checks whether the receiver is an indexed exotic object | 144 // Checks whether the receiver is an indexed exotic object |
145 // and name is a special numeric index. | 145 // and name is a special numeric index. |
146 bool IsSpecialNumericIndex() const; | 146 bool IsSpecialNumericIndex() const; |
147 | 147 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 // If configuration_ becomes mutable, update | 188 // If configuration_ becomes mutable, update |
189 // HolderIsReceiverOrHiddenPrototype. | 189 // HolderIsReceiverOrHiddenPrototype. |
190 Configuration configuration_; | 190 Configuration configuration_; |
191 State state_; | 191 State state_; |
192 bool has_property_; | 192 bool has_property_; |
193 PropertyDetails property_details_; | 193 PropertyDetails property_details_; |
194 Isolate* isolate_; | 194 Isolate* isolate_; |
195 Handle<Name> name_; | 195 Handle<Name> name_; |
196 Handle<Map> holder_map_; | 196 Handle<Map> holder_map_; |
197 Handle<Map> transition_map_; | 197 Handle<Object> transition_; |
198 Handle<Object> receiver_; | 198 Handle<Object> receiver_; |
199 Handle<JSReceiver> holder_; | 199 Handle<JSReceiver> holder_; |
200 | 200 |
201 int number_; | 201 int number_; |
202 }; | 202 }; |
203 | 203 |
204 | 204 |
205 } } // namespace v8::internal | 205 } } // namespace v8::internal |
206 | 206 |
207 #endif // V8_LOOKUP_H_ | 207 #endif // V8_LOOKUP_H_ |
OLD | NEW |