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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 Handle<Object> GetReceiver() const { | 92 Handle<Object> GetReceiver() const { |
93 return Handle<Object>::cast(maybe_receiver_.ToHandleChecked()); | 93 return Handle<Object>::cast(maybe_receiver_.ToHandleChecked()); |
94 } | 94 } |
95 Handle<Map> holder_map() const { return holder_map_; } | 95 Handle<Map> holder_map() const { return holder_map_; } |
96 template <class T> | 96 template <class T> |
97 Handle<T> GetHolder() const { | 97 Handle<T> GetHolder() const { |
98 ASSERT(IsFound()); | 98 ASSERT(IsFound()); |
99 return Handle<T>::cast(maybe_holder_.ToHandleChecked()); | 99 return Handle<T>::cast(maybe_holder_.ToHandleChecked()); |
100 } | 100 } |
101 Handle<JSReceiver> GetRoot() const; | 101 Handle<JSReceiver> GetRoot() const; |
102 bool HolderIsReceiver() const; | 102 bool HolderIsReceiverOrHiddenPrototype() const; |
103 | 103 |
104 /* Dynamically reduce the trapped types. */ | 104 /* Dynamically reduce the trapped types. */ |
105 void skip_interceptor() { | 105 void skip_interceptor() { |
106 configuration_ = static_cast<Configuration>( | 106 configuration_ = static_cast<Configuration>( |
107 configuration_ & ~CHECK_INTERCEPTOR); | 107 configuration_ & ~CHECK_INTERCEPTOR); |
108 } | 108 } |
109 void skip_access_check() { | 109 void skip_access_check() { |
110 configuration_ = static_cast<Configuration>( | 110 configuration_ = static_cast<Configuration>( |
111 configuration_ & ~CHECK_ACCESS_CHECK); | 111 configuration_ & ~CHECK_ACCESS_CHECK); |
112 } | 112 } |
113 | 113 |
114 /* ACCESS_CHECK */ | 114 /* ACCESS_CHECK */ |
115 bool HasAccess(v8::AccessType access_type) const; | 115 bool HasAccess(v8::AccessType access_type) const; |
116 | 116 |
117 /* PROPERTY */ | 117 /* PROPERTY */ |
118 // HasProperty needs to be called before any of the other PROPERTY methods | 118 // HasProperty needs to be called before any of the other PROPERTY methods |
119 // below can be used. It ensures that we are able to provide a definite | 119 // below can be used. It ensures that we are able to provide a definite |
120 // answer, and loads extra information about the property. | 120 // answer, and loads extra information about the property. |
121 bool HasProperty(); | 121 bool HasProperty(); |
122 void PrepareForDataProperty(Handle<Object> value); | 122 void PrepareForDataProperty(Handle<Object> value); |
123 void TransitionToDataProperty(Handle<Object> value, | 123 void TransitionToDataProperty(Handle<Object> value, |
124 PropertyAttributes attributes, | 124 PropertyAttributes attributes, |
125 Object::StoreFromKeyed store_mode); | 125 Object::StoreFromKeyed store_mode); |
126 PropertyKind property_kind() const { | 126 PropertyKind property_kind() const { |
127 ASSERT(has_property_); | 127 ASSERT(has_property_); |
128 return property_kind_; | 128 return property_kind_; |
129 } | 129 } |
| 130 PropertyEncoding property_encoding() const { |
| 131 ASSERT(has_property_); |
| 132 return property_encoding_; |
| 133 } |
130 PropertyDetails property_details() const { | 134 PropertyDetails property_details() const { |
131 ASSERT(has_property_); | 135 ASSERT(has_property_); |
132 return property_details_; | 136 return property_details_; |
133 } | 137 } |
134 int descriptor_number() const { | 138 bool IsConfigurable() const { return !property_details().IsDontDelete(); } |
135 ASSERT(has_property_); | 139 Representation representation() const { |
136 ASSERT_EQ(DESCRIPTOR, property_encoding_); | 140 return property_details().representation(); |
137 return number_; | |
138 } | 141 } |
| 142 FieldIndex GetFieldIndex() const; |
| 143 Handle<PropertyCell> GetPropertyCell() const; |
139 Handle<Object> GetAccessors() const; | 144 Handle<Object> GetAccessors() const; |
140 Handle<Object> GetDataValue() const; | 145 Handle<Object> GetDataValue() const; |
141 void WriteDataValue(Handle<Object> value); | 146 void WriteDataValue(Handle<Object> value); |
142 | 147 |
143 void InternalizeName(); | 148 void InternalizeName(); |
144 | 149 |
145 private: | 150 private: |
146 Handle<Map> GetReceiverMap() const; | 151 Handle<Map> GetReceiverMap() const; |
147 | 152 |
148 MUST_USE_RESULT bool NextHolder(); | 153 MUST_USE_RESULT bool NextHolder(); |
(...skipping 14 matching lines...) Expand all Loading... |
163 } | 168 } |
164 bool check_derived() const { | 169 bool check_derived() const { |
165 return (configuration_ & CHECK_DERIVED) != 0; | 170 return (configuration_ & CHECK_DERIVED) != 0; |
166 } | 171 } |
167 bool check_hidden() const { | 172 bool check_hidden() const { |
168 return (configuration_ & CHECK_HIDDEN) != 0; | 173 return (configuration_ & CHECK_HIDDEN) != 0; |
169 } | 174 } |
170 bool check_access_check() const { | 175 bool check_access_check() const { |
171 return (configuration_ & CHECK_ACCESS_CHECK) != 0; | 176 return (configuration_ & CHECK_ACCESS_CHECK) != 0; |
172 } | 177 } |
| 178 int descriptor_number() const { |
| 179 ASSERT(has_property_); |
| 180 ASSERT_EQ(DESCRIPTOR, property_encoding_); |
| 181 return number_; |
| 182 } |
| 183 int dictionary_entry() const { |
| 184 ASSERT(has_property_); |
| 185 ASSERT_EQ(DICTIONARY, property_encoding_); |
| 186 return number_; |
| 187 } |
173 | 188 |
174 Configuration configuration_; | 189 Configuration configuration_; |
175 State state_; | 190 State state_; |
176 bool has_property_; | 191 bool has_property_; |
177 PropertyKind property_kind_; | 192 PropertyKind property_kind_; |
178 PropertyEncoding property_encoding_; | 193 PropertyEncoding property_encoding_; |
179 PropertyDetails property_details_; | 194 PropertyDetails property_details_; |
180 Isolate* isolate_; | 195 Isolate* isolate_; |
181 Handle<Name> name_; | 196 Handle<Name> name_; |
182 Handle<Map> holder_map_; | 197 Handle<Map> holder_map_; |
183 MaybeHandle<Object> maybe_receiver_; | 198 MaybeHandle<Object> maybe_receiver_; |
184 MaybeHandle<JSReceiver> maybe_holder_; | 199 MaybeHandle<JSReceiver> maybe_holder_; |
185 | 200 |
186 int number_; | 201 int number_; |
187 }; | 202 }; |
188 | 203 |
189 | 204 |
190 } } // namespace v8::internal | 205 } } // namespace v8::internal |
191 | 206 |
192 #endif // V8_LOOKUP_H_ | 207 #endif // V8_LOOKUP_H_ |
OLD | NEW |