OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_LOOKUP_INL_H_ |
| 6 #define V8_LOOKUP_INL_H_ |
| 7 |
| 8 #include "src/lookup.h" |
| 9 |
| 10 namespace v8 { |
| 11 namespace internal { |
| 12 |
| 13 |
| 14 JSReceiver* LookupIterator::NextHolder(Map* map) { |
| 15 DisallowHeapAllocation no_gc; |
| 16 if (map->prototype()->IsNull()) return NULL; |
| 17 |
| 18 JSReceiver* next = JSReceiver::cast(map->prototype()); |
| 19 ASSERT(!next->map()->IsGlobalObjectMap() || |
| 20 next->map()->is_hidden_prototype()); |
| 21 |
| 22 if (!check_derived() && |
| 23 !(check_hidden() && next->map()->is_hidden_prototype())) { |
| 24 return NULL; |
| 25 } |
| 26 |
| 27 return next; |
| 28 } |
| 29 |
| 30 |
| 31 LookupIterator::State LookupIterator::LookupInHolder(Map* map) { |
| 32 DisallowHeapAllocation no_gc; |
| 33 switch (state_) { |
| 34 case NOT_FOUND: |
| 35 if (map->IsJSProxyMap()) { |
| 36 return JSPROXY; |
| 37 } |
| 38 if (check_access_check() && map->is_access_check_needed()) { |
| 39 return ACCESS_CHECK; |
| 40 } |
| 41 // Fall through. |
| 42 case ACCESS_CHECK: |
| 43 if (check_interceptor() && map->has_named_interceptor()) { |
| 44 return INTERCEPTOR; |
| 45 } |
| 46 // Fall through. |
| 47 case INTERCEPTOR: |
| 48 if (map->is_dictionary_map()) { |
| 49 property_encoding_ = DICTIONARY; |
| 50 } else { |
| 51 DescriptorArray* descriptors = map->instance_descriptors(); |
| 52 number_ = descriptors->SearchWithCache(*name_, map); |
| 53 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND; |
| 54 property_encoding_ = DESCRIPTOR; |
| 55 } |
| 56 return PROPERTY; |
| 57 case PROPERTY: |
| 58 return NOT_FOUND; |
| 59 case JSPROXY: |
| 60 UNREACHABLE(); |
| 61 } |
| 62 UNREACHABLE(); |
| 63 return state_; |
| 64 } |
| 65 } |
| 66 } // namespace v8::internal |
| 67 |
| 68 #endif // V8_LOOKUP_INL_H_ |
OLD | NEW |