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 #include "src/elements.h" | 10 #include "src/elements.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (js_object->elements() == isolate()->heap()->empty_fixed_array()) { | 71 if (js_object->elements() == isolate()->heap()->empty_fixed_array()) { |
72 return NOT_FOUND; | 72 return NOT_FOUND; |
73 } | 73 } |
74 | 74 |
75 ElementsAccessor* accessor = js_object->GetElementsAccessor(); | 75 ElementsAccessor* accessor = js_object->GetElementsAccessor(); |
76 FixedArrayBase* backing_store = js_object->elements(); | 76 FixedArrayBase* backing_store = js_object->elements(); |
77 number_ = accessor->GetIndexForKey(js_object, backing_store, index_); | 77 number_ = accessor->GetIndexForKey(js_object, backing_store, index_); |
78 if (number_ == kMaxUInt32) return NOT_FOUND; | 78 if (number_ == kMaxUInt32) return NOT_FOUND; |
79 property_details_ = accessor->GetDetails(backing_store, number_); | 79 property_details_ = accessor->GetDetails(backing_store, number_); |
80 } | 80 } |
81 } else if (holder->IsGlobalObject()) { | 81 } else if (!map->is_dictionary_map()) { |
| 82 DescriptorArray* descriptors = map->instance_descriptors(); |
| 83 int number = descriptors->SearchWithCache(*name_, map); |
| 84 if (number == DescriptorArray::kNotFound) return NOT_FOUND; |
| 85 number_ = static_cast<uint32_t>(number); |
| 86 property_details_ = descriptors->GetDetails(number_); |
| 87 } else if (map->IsGlobalObjectMap()) { |
82 GlobalDictionary* dict = JSObject::cast(holder)->global_dictionary(); | 88 GlobalDictionary* dict = JSObject::cast(holder)->global_dictionary(); |
83 int number = dict->FindEntry(name_); | 89 int number = dict->FindEntry(name_); |
84 if (number == GlobalDictionary::kNotFound) return NOT_FOUND; | 90 if (number == GlobalDictionary::kNotFound) return NOT_FOUND; |
85 number_ = static_cast<uint32_t>(number); | 91 number_ = static_cast<uint32_t>(number); |
86 DCHECK(dict->ValueAt(number_)->IsPropertyCell()); | 92 DCHECK(dict->ValueAt(number_)->IsPropertyCell()); |
87 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); | 93 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); |
88 if (cell->value()->IsTheHole()) return NOT_FOUND; | 94 if (cell->value()->IsTheHole()) return NOT_FOUND; |
89 property_details_ = cell->property_details(); | 95 property_details_ = cell->property_details(); |
90 } else if (map->is_dictionary_map()) { | 96 } else { |
91 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); | 97 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); |
92 int number = dict->FindEntry(name_); | 98 int number = dict->FindEntry(name_); |
93 if (number == NameDictionary::kNotFound) return NOT_FOUND; | 99 if (number == NameDictionary::kNotFound) return NOT_FOUND; |
94 number_ = static_cast<uint32_t>(number); | 100 number_ = static_cast<uint32_t>(number); |
95 property_details_ = dict->DetailsAt(number_); | 101 property_details_ = dict->DetailsAt(number_); |
96 } else { | |
97 DescriptorArray* descriptors = map->instance_descriptors(); | |
98 int number = descriptors->SearchWithCache(*name_, map); | |
99 if (number == DescriptorArray::kNotFound) return NOT_FOUND; | |
100 number_ = static_cast<uint32_t>(number); | |
101 property_details_ = descriptors->GetDetails(number_); | |
102 } | 102 } |
103 has_property_ = true; | 103 has_property_ = true; |
104 switch (property_details_.kind()) { | 104 switch (property_details_.kind()) { |
105 case v8::internal::kData: | 105 case v8::internal::kData: |
106 return DATA; | 106 return DATA; |
107 case v8::internal::kAccessor: | 107 case v8::internal::kAccessor: |
108 return ACCESSOR; | 108 return ACCESSOR; |
109 } | 109 } |
110 case ACCESSOR: | 110 case ACCESSOR: |
111 case DATA: | 111 case DATA: |
(...skipping 20 matching lines...) Expand all Loading... |
132 default: | 132 default: |
133 return NOT_FOUND; | 133 return NOT_FOUND; |
134 } | 134 } |
135 UNREACHABLE(); | 135 UNREACHABLE(); |
136 return state_; | 136 return state_; |
137 } | 137 } |
138 } | 138 } |
139 } // namespace v8::internal | 139 } // namespace v8::internal |
140 | 140 |
141 #endif // V8_LOOKUP_INL_H_ | 141 #endif // V8_LOOKUP_INL_H_ |
OLD | NEW |