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 29 matching lines...) Expand all Loading... |
40 if (map->IsJSProxyMap()) return JSPROXY; | 40 if (map->IsJSProxyMap()) return JSPROXY; |
41 if (map->is_access_check_needed()) return ACCESS_CHECK; | 41 if (map->is_access_check_needed()) return ACCESS_CHECK; |
42 // Fall through. | 42 // Fall through. |
43 case ACCESS_CHECK: | 43 case ACCESS_CHECK: |
44 if (check_interceptor() && map->has_named_interceptor()) { | 44 if (check_interceptor() && map->has_named_interceptor()) { |
45 return INTERCEPTOR; | 45 return INTERCEPTOR; |
46 } | 46 } |
47 // Fall through. | 47 // Fall through. |
48 case INTERCEPTOR: | 48 case INTERCEPTOR: |
49 if (map->is_dictionary_map()) { | 49 if (map->is_dictionary_map()) { |
50 if (holder == NULL) return UNKNOWN; | |
51 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); | 50 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); |
52 number_ = dict->FindEntry(name_); | 51 number_ = dict->FindEntry(name_); |
53 if (number_ == NameDictionary::kNotFound) return NOT_FOUND; | 52 if (number_ == NameDictionary::kNotFound) return NOT_FOUND; |
54 property_details_ = dict->DetailsAt(number_); | 53 property_details_ = dict->DetailsAt(number_); |
55 if (holder->IsGlobalObject()) { | 54 if (holder->IsGlobalObject()) { |
56 if (property_details_.IsDeleted()) return NOT_FOUND; | 55 if (property_details_.IsDeleted()) return NOT_FOUND; |
57 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); | 56 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); |
58 if (cell->value()->IsTheHole()) return NOT_FOUND; | 57 if (cell->value()->IsTheHole()) return NOT_FOUND; |
59 } | 58 } |
60 } else { | 59 } else { |
61 DescriptorArray* descriptors = map->instance_descriptors(); | 60 DescriptorArray* descriptors = map->instance_descriptors(); |
62 number_ = descriptors->SearchWithCache(*name_, map); | 61 number_ = descriptors->SearchWithCache(*name_, map); |
63 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND; | 62 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND; |
64 property_details_ = descriptors->GetDetails(number_); | 63 property_details_ = descriptors->GetDetails(number_); |
65 } | 64 } |
66 has_property_ = true; | 65 has_property_ = true; |
67 switch (property_details_.type()) { | 66 switch (property_details_.type()) { |
68 case v8::internal::CONSTANT: | 67 case v8::internal::CONSTANT: |
69 case v8::internal::FIELD: | 68 case v8::internal::FIELD: |
70 case v8::internal::NORMAL: | 69 case v8::internal::NORMAL: |
71 return DATA; | 70 return DATA; |
72 case v8::internal::CALLBACKS: | 71 case v8::internal::CALLBACKS: |
73 return ACCESSOR; | 72 return ACCESSOR; |
74 } | 73 } |
75 case ACCESSOR: | 74 case ACCESSOR: |
76 case DATA: | 75 case DATA: |
77 case UNKNOWN: | |
78 return NOT_FOUND; | 76 return NOT_FOUND; |
79 case JSPROXY: | 77 case JSPROXY: |
80 case TRANSITION: | 78 case TRANSITION: |
81 UNREACHABLE(); | 79 UNREACHABLE(); |
82 } | 80 } |
83 UNREACHABLE(); | 81 UNREACHABLE(); |
84 return state_; | 82 return state_; |
85 } | 83 } |
86 } | 84 } |
87 } // namespace v8::internal | 85 } // namespace v8::internal |
88 | 86 |
89 #endif // V8_LOOKUP_INL_H_ | 87 #endif // V8_LOOKUP_INL_H_ |
OLD | NEW |