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_INL_H_ | 5 #ifndef V8_LOOKUP_INL_H_ |
6 #define V8_LOOKUP_INL_H_ | 6 #define V8_LOOKUP_INL_H_ |
7 | 7 |
8 #include "src/lookup.h" | 8 #include "src/lookup.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Always lookup behind the JSGlobalProxy into the JSGlobalObject, even | 24 // Always lookup behind the JSGlobalProxy into the JSGlobalObject, even |
25 // when not checking other hidden prototypes. | 25 // when not checking other hidden prototypes. |
26 !map->IsJSGlobalProxyMap()) { | 26 !map->IsJSGlobalProxyMap()) { |
27 return NULL; | 27 return NULL; |
28 } | 28 } |
29 | 29 |
30 return next; | 30 return next; |
31 } | 31 } |
32 | 32 |
33 | 33 |
34 LookupIterator::State LookupIterator::LookupInHolder(Map* map) { | 34 LookupIterator::State LookupIterator::LookupInHolder(Map* map, |
| 35 JSReceiver* holder) { |
35 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY); | 36 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY); |
36 DisallowHeapAllocation no_gc; | 37 DisallowHeapAllocation no_gc; |
37 switch (state_) { | 38 switch (state_) { |
38 case NOT_FOUND: | 39 case NOT_FOUND: |
39 if (map->IsJSProxyMap()) return JSPROXY; | 40 if (map->IsJSProxyMap()) return JSPROXY; |
40 if (map->is_access_check_needed()) return ACCESS_CHECK; | 41 if (map->is_access_check_needed()) return ACCESS_CHECK; |
41 // Fall through. | 42 // Fall through. |
42 case ACCESS_CHECK: | 43 case ACCESS_CHECK: |
43 if (check_interceptor() && map->has_named_interceptor()) { | 44 if (check_interceptor() && map->has_named_interceptor()) { |
44 return INTERCEPTOR; | 45 return INTERCEPTOR; |
45 } | 46 } |
46 // Fall through. | 47 // Fall through. |
47 case INTERCEPTOR: | 48 case INTERCEPTOR: |
48 if (map->is_dictionary_map()) { | 49 if (map->is_dictionary_map()) { |
49 property_encoding_ = DICTIONARY; | 50 property_encoding_ = DICTIONARY; |
| 51 if (holder == NULL) return UNKNOWN; |
| 52 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); |
| 53 number_ = dict->FindEntry(name_); |
| 54 if (number_ == NameDictionary::kNotFound) return NOT_FOUND; |
| 55 property_details_ = dict->DetailsAt(number_); |
| 56 if (holder->IsGlobalObject()) { |
| 57 if (property_details_.IsDeleted()) return NOT_FOUND; |
| 58 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); |
| 59 if (cell->value()->IsTheHole()) return NOT_FOUND; |
| 60 } |
50 } else { | 61 } else { |
51 DescriptorArray* descriptors = map->instance_descriptors(); | 62 DescriptorArray* descriptors = map->instance_descriptors(); |
52 number_ = descriptors->SearchWithCache(*name_, map); | 63 number_ = descriptors->SearchWithCache(*name_, map); |
53 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND; | 64 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND; |
54 property_encoding_ = DESCRIPTOR; | 65 property_encoding_ = DESCRIPTOR; |
| 66 property_details_ = descriptors->GetDetails(number_); |
55 } | 67 } |
56 return PROPERTY; | 68 has_property_ = true; |
57 case PROPERTY: | 69 switch (property_details_.type()) { |
| 70 case v8::internal::CONSTANT: |
| 71 case v8::internal::FIELD: |
| 72 case v8::internal::NORMAL: |
| 73 return DATA; |
| 74 case v8::internal::CALLBACKS: |
| 75 return ACCESSOR; |
| 76 } |
| 77 case ACCESSOR: |
| 78 case DATA: |
| 79 case UNKNOWN: |
58 return NOT_FOUND; | 80 return NOT_FOUND; |
59 case JSPROXY: | 81 case JSPROXY: |
60 case TRANSITION: | 82 case TRANSITION: |
61 UNREACHABLE(); | 83 UNREACHABLE(); |
62 } | 84 } |
63 UNREACHABLE(); | 85 UNREACHABLE(); |
64 return state_; | 86 return state_; |
65 } | 87 } |
66 } | 88 } |
67 } // namespace v8::internal | 89 } // namespace v8::internal |
68 | 90 |
69 #endif // V8_LOOKUP_INL_H_ | 91 #endif // V8_LOOKUP_INL_H_ |
OLD | NEW |