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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 // Fall through. | 58 // Fall through. |
59 case INTERCEPTOR: | 59 case INTERCEPTOR: |
60 if (IsElement()) { | 60 if (IsElement()) { |
61 JSObject* js_object = JSObject::cast(holder); | 61 JSObject* js_object = JSObject::cast(holder); |
62 ElementsAccessor* accessor = js_object->GetElementsAccessor(); | 62 ElementsAccessor* accessor = js_object->GetElementsAccessor(); |
63 FixedArrayBase* backing_store = js_object->elements(); | 63 FixedArrayBase* backing_store = js_object->elements(); |
64 number_ = accessor->GetIndexForKey(backing_store, index_); | 64 number_ = accessor->GetIndexForKey(backing_store, index_); |
65 if (number_ == kMaxUInt32) return NOT_FOUND; | 65 if (number_ == kMaxUInt32) return NOT_FOUND; |
66 property_details_ = accessor->GetDetails(backing_store, number_); | 66 property_details_ = accessor->GetDetails(backing_store, number_); |
| 67 } else if (holder->IsGlobalObject()) { |
| 68 GlobalDictionary* dict = JSObject::cast(holder)->global_dictionary(); |
| 69 int number = dict->FindEntry(name_); |
| 70 if (number == GlobalDictionary::kNotFound) return NOT_FOUND; |
| 71 number_ = static_cast<uint32_t>(number); |
| 72 DCHECK(dict->ValueAt(number_)->IsPropertyCell()); |
| 73 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); |
| 74 if (cell->value()->IsTheHole()) return NOT_FOUND; |
| 75 property_details_ = dict->DetailsAt(number_); |
67 } else if (map->is_dictionary_map()) { | 76 } else if (map->is_dictionary_map()) { |
68 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); | 77 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); |
69 int number = dict->FindEntry(name_); | 78 int number = dict->FindEntry(name_); |
70 if (number == NameDictionary::kNotFound) return NOT_FOUND; | 79 if (number == NameDictionary::kNotFound) return NOT_FOUND; |
71 number_ = static_cast<uint32_t>(number); | 80 number_ = static_cast<uint32_t>(number); |
72 if (holder->IsGlobalObject()) { | |
73 DCHECK(dict->ValueAt(number_)->IsPropertyCell()); | |
74 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); | |
75 if (cell->value()->IsTheHole()) return NOT_FOUND; | |
76 } | |
77 property_details_ = dict->DetailsAt(number_); | 81 property_details_ = dict->DetailsAt(number_); |
78 } else { | 82 } else { |
79 DescriptorArray* descriptors = map->instance_descriptors(); | 83 DescriptorArray* descriptors = map->instance_descriptors(); |
80 int number = descriptors->SearchWithCache(*name_, map); | 84 int number = descriptors->SearchWithCache(*name_, map); |
81 if (number == DescriptorArray::kNotFound) return NOT_FOUND; | 85 if (number == DescriptorArray::kNotFound) return NOT_FOUND; |
82 number_ = static_cast<uint32_t>(number); | 86 number_ = static_cast<uint32_t>(number); |
83 property_details_ = descriptors->GetDetails(number_); | 87 property_details_ = descriptors->GetDetails(number_); |
84 } | 88 } |
85 has_property_ = true; | 89 has_property_ = true; |
86 switch (property_details_.kind()) { | 90 switch (property_details_.kind()) { |
(...skipping 27 matching lines...) Expand all Loading... |
114 default: | 118 default: |
115 return NOT_FOUND; | 119 return NOT_FOUND; |
116 } | 120 } |
117 UNREACHABLE(); | 121 UNREACHABLE(); |
118 return state_; | 122 return state_; |
119 } | 123 } |
120 } | 124 } |
121 } // namespace v8::internal | 125 } // namespace v8::internal |
122 | 126 |
123 #endif // V8_LOOKUP_INL_H_ | 127 #endif // V8_LOOKUP_INL_H_ |
OLD | NEW |