| 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" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 class LookupIterator final BASE_EMBEDDED { | 15 class LookupIterator final BASE_EMBEDDED { |
| 16 public: | 16 public: |
| 17 enum Configuration { | 17 enum Configuration { |
| 18 // Configuration bits. | 18 // Configuration bits. |
| 19 kHidden = 1 << 0, | 19 kInterceptor = 1 << 0, |
| 20 kInterceptor = 1 << 1, | 20 kPrototypeChain = 1 << 1, |
| 21 kPrototypeChain = 1 << 2, | |
| 22 | 21 |
| 23 // Convience combinations of bits. | 22 // Convience combinations of bits. |
| 24 OWN_SKIP_INTERCEPTOR = 0, | 23 OWN_SKIP_INTERCEPTOR = 0, |
| 25 OWN = kInterceptor, | 24 OWN = kInterceptor, |
| 26 HIDDEN_SKIP_INTERCEPTOR = kHidden, | 25 PROTOTYPE_CHAIN_SKIP_INTERCEPTOR = kPrototypeChain, |
| 27 HIDDEN = kHidden | kInterceptor, | 26 PROTOTYPE_CHAIN = kPrototypeChain | kInterceptor, |
| 28 PROTOTYPE_CHAIN_SKIP_INTERCEPTOR = kHidden | kPrototypeChain, | |
| 29 PROTOTYPE_CHAIN = kHidden | kPrototypeChain | kInterceptor, | |
| 30 DEFAULT = PROTOTYPE_CHAIN | 27 DEFAULT = PROTOTYPE_CHAIN |
| 31 }; | 28 }; |
| 32 | 29 |
| 33 enum State { | 30 enum State { |
| 34 ACCESS_CHECK, | 31 ACCESS_CHECK, |
| 35 INTEGER_INDEXED_EXOTIC, | 32 INTEGER_INDEXED_EXOTIC, |
| 36 INTERCEPTOR, | 33 INTERCEPTOR, |
| 37 JSPROXY, | 34 JSPROXY, |
| 38 NOT_FOUND, | 35 NOT_FOUND, |
| 39 ACCESSOR, | 36 ACCESSOR, |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 void ReloadPropertyInformation(); | 306 void ReloadPropertyInformation(); |
| 310 | 307 |
| 311 template <bool is_element> | 308 template <bool is_element> |
| 312 bool SkipInterceptor(JSObject* holder); | 309 bool SkipInterceptor(JSObject* holder); |
| 313 template <bool is_element> | 310 template <bool is_element> |
| 314 inline InterceptorInfo* GetInterceptor(JSObject* holder) const { | 311 inline InterceptorInfo* GetInterceptor(JSObject* holder) const { |
| 315 return is_element ? holder->GetIndexedInterceptor() | 312 return is_element ? holder->GetIndexedInterceptor() |
| 316 : holder->GetNamedInterceptor(); | 313 : holder->GetNamedInterceptor(); |
| 317 } | 314 } |
| 318 | 315 |
| 319 bool check_hidden() const { return (configuration_ & kHidden) != 0; } | |
| 320 bool check_interceptor() const { | 316 bool check_interceptor() const { |
| 321 return (configuration_ & kInterceptor) != 0; | 317 return (configuration_ & kInterceptor) != 0; |
| 322 } | 318 } |
| 323 int descriptor_number() const { | 319 int descriptor_number() const { |
| 324 DCHECK(!IsElement()); | 320 DCHECK(!IsElement()); |
| 325 DCHECK(has_property_); | 321 DCHECK(has_property_); |
| 326 DCHECK(holder_->HasFastProperties()); | 322 DCHECK(holder_->HasFastProperties()); |
| 327 return number_; | 323 return number_; |
| 328 } | 324 } |
| 329 int dictionary_entry() const { | 325 int dictionary_entry() const { |
| 330 DCHECK(!IsElement()); | 326 DCHECK(!IsElement()); |
| 331 DCHECK(has_property_); | 327 DCHECK(has_property_); |
| 332 DCHECK(!holder_->HasFastProperties()); | 328 DCHECK(!holder_->HasFastProperties()); |
| 333 return number_; | 329 return number_; |
| 334 } | 330 } |
| 335 | 331 |
| 336 static Configuration ComputeConfiguration( | 332 static Configuration ComputeConfiguration( |
| 337 Configuration configuration, Handle<Name> name) { | 333 Configuration configuration, Handle<Name> name) { |
| 338 if (name->IsPrivate()) { | 334 return name->IsPrivate() ? OWN_SKIP_INTERCEPTOR : configuration; |
| 339 return static_cast<Configuration>(configuration & | |
| 340 HIDDEN_SKIP_INTERCEPTOR); | |
| 341 } else { | |
| 342 return configuration; | |
| 343 } | |
| 344 } | 335 } |
| 345 | 336 |
| 346 static Handle<JSReceiver> GetRootForNonJSReceiver( | 337 static Handle<JSReceiver> GetRootForNonJSReceiver( |
| 347 Isolate* isolate, Handle<Object> receiver, uint32_t index = kMaxUInt32); | 338 Isolate* isolate, Handle<Object> receiver, uint32_t index = kMaxUInt32); |
| 348 inline static Handle<JSReceiver> GetRoot(Isolate* isolate, | 339 inline static Handle<JSReceiver> GetRoot(Isolate* isolate, |
| 349 Handle<Object> receiver, | 340 Handle<Object> receiver, |
| 350 uint32_t index = kMaxUInt32) { | 341 uint32_t index = kMaxUInt32) { |
| 351 if (receiver->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver); | 342 if (receiver->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver); |
| 352 return GetRootForNonJSReceiver(isolate, receiver, index); | 343 return GetRootForNonJSReceiver(isolate, receiver, index); |
| 353 } | 344 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 369 const Handle<JSReceiver> initial_holder_; | 360 const Handle<JSReceiver> initial_holder_; |
| 370 const uint32_t index_; | 361 const uint32_t index_; |
| 371 uint32_t number_; | 362 uint32_t number_; |
| 372 }; | 363 }; |
| 373 | 364 |
| 374 | 365 |
| 375 } // namespace internal | 366 } // namespace internal |
| 376 } // namespace v8 | 367 } // namespace v8 |
| 377 | 368 |
| 378 #endif // V8_LOOKUP_H_ | 369 #endif // V8_LOOKUP_H_ |
| OLD | NEW |