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.
5 #ifndef V8_LOOKUP_INL_H_
6 #define V8_LOOKUP_INL_H_
8 #include "src/lookup.h"
14 JSReceiver* LookupIterator::NextHolder(Map* map) {
15 DisallowHeapAllocation no_gc;
16 if (map->prototype()->IsNull()) return NULL;
18 JSReceiver* next = JSReceiver::cast(map->prototype());
19 DCHECK(!next->map()->IsGlobalObjectMap() ||
20 next->map()->is_hidden_prototype());
22 if (!check_prototype_chain() &&
23 !(check_hidden() && next->map()->is_hidden_prototype()) &&
24 // Always lookup behind the JSGlobalProxy into the JSGlobalObject, even
25 // when not checking other hidden prototypes.
26 !map->IsJSGlobalProxyMap()) {
34 LookupIterator::State LookupIterator::LookupInHolder(Map* map,
36 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY);
37 DisallowHeapAllocation no_gc;
40 if (map->IsJSProxyMap()) return JSPROXY;
41 if (map->is_access_check_needed()) return ACCESS_CHECK;
44 if (check_interceptor() && map->has_named_interceptor()) {
49 if (map->is_dictionary_map()) {
50 NameDictionary* dict = JSObject::cast(holder)->property_dictionary();
51 number_ = dict->FindEntry(name_);
52 if (number_ == NameDictionary::kNotFound) return NOT_FOUND;
53 property_details_ = dict->DetailsAt(number_);
54 if (holder->IsGlobalObject()) {
55 if (property_details_.IsDeleted()) return NOT_FOUND;
56 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_));
57 if (cell->value()->IsTheHole()) return NOT_FOUND;
60 DescriptorArray* descriptors = map->instance_descriptors();
61 number_ = descriptors->SearchWithCache(*name_, map);
62 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND;
63 property_details_ = descriptors->GetDetails(number_);
66 switch (property_details_.kind()) {
67 case v8::internal::kData:
69 case v8::internal::kAccessor:
83 } // namespace v8::internal
85 #endif // V8_LOOKUP_INL_H_