Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Side by Side Diff: src/lookup-inl.h

Issue 1144883002: Start adding support for elements to the LookupIterator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/lookup.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 JSReceiver* const holder) { 35 JSReceiver* const holder) {
36 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY); 36 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY);
37 DisallowHeapAllocation no_gc; 37 DisallowHeapAllocation no_gc;
38 if (interceptor_state_ == InterceptorState::kProcessNonMasking) { 38 if (interceptor_state_ == InterceptorState::kProcessNonMasking) {
39 return LookupNonMaskingInterceptorInHolder(map, holder); 39 return LookupNonMaskingInterceptorInHolder(map, holder);
40 } 40 }
41 switch (state_) { 41 switch (state_) {
42 case NOT_FOUND: 42 case NOT_FOUND:
43 if (map->IsJSProxyMap()) return JSPROXY; 43 if (map->IsJSProxyMap()) return JSPROXY;
44 if (map->is_access_check_needed() && 44 if (map->is_access_check_needed() &&
45 !isolate_->IsInternallyUsedPropertyName(name_)) { 45 (IsElement() || !isolate_->IsInternallyUsedPropertyName(name_))) {
46 return ACCESS_CHECK; 46 return ACCESS_CHECK;
47 } 47 }
48 // Fall through. 48 // Fall through.
49 case ACCESS_CHECK: 49 case ACCESS_CHECK:
50 if (exotic_index_state_ != ExoticIndexState::kNoIndex && 50 if (exotic_index_state_ != ExoticIndexState::kNotExotic &&
51 IsIntegerIndexedExotic(holder)) { 51 IsIntegerIndexedExotic(holder)) {
52 return INTEGER_INDEXED_EXOTIC; 52 return INTEGER_INDEXED_EXOTIC;
53 } 53 }
54 if (check_interceptor() && map->has_named_interceptor() && 54 if (check_interceptor() && HasInterceptor(map) &&
55 !SkipInterceptor(JSObject::cast(holder))) { 55 !SkipInterceptor(JSObject::cast(holder))) {
56 return INTERCEPTOR; 56 return INTERCEPTOR;
57 } 57 }
58 // Fall through. 58 // Fall through.
59 case INTERCEPTOR: 59 case INTERCEPTOR:
60 if (map->is_dictionary_map()) { 60 if (IsElement()) {
61 JSObject* js_object = JSObject::cast(holder);
62 ElementsAccessor* accessor = js_object->GetElementsAccessor();
63 FixedArrayBase* backing_store = js_object->elements();
64 number_ = accessor->GetIndexForKey(backing_store, index_);
65 if (number_ == kMaxUInt32) return NOT_FOUND;
66 property_details_ = accessor->GetDetails(backing_store, number_);
67 } else if (map->is_dictionary_map()) {
61 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); 68 NameDictionary* dict = JSObject::cast(holder)->property_dictionary();
62 number_ = dict->FindEntry(name_); 69 int number = dict->FindEntry(name_);
63 if (number_ == NameDictionary::kNotFound) return NOT_FOUND; 70 if (number == NameDictionary::kNotFound) return NOT_FOUND;
71 number_ = static_cast<uint32_t>(number);
64 if (holder->IsGlobalObject()) { 72 if (holder->IsGlobalObject()) {
65 DCHECK(dict->ValueAt(number_)->IsPropertyCell()); 73 DCHECK(dict->ValueAt(number_)->IsPropertyCell());
66 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); 74 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_));
67 if (cell->value()->IsTheHole()) return NOT_FOUND; 75 if (cell->value()->IsTheHole()) return NOT_FOUND;
68 } 76 }
69 property_details_ = dict->DetailsAt(number_); 77 property_details_ = dict->DetailsAt(number_);
70 } else { 78 } else {
71 DescriptorArray* descriptors = map->instance_descriptors(); 79 DescriptorArray* descriptors = map->instance_descriptors();
72 number_ = descriptors->SearchWithCache(*name_, map); 80 int number = descriptors->SearchWithCache(*name_, map);
73 if (number_ == DescriptorArray::kNotFound) return NOT_FOUND; 81 if (number == DescriptorArray::kNotFound) return NOT_FOUND;
82 number_ = static_cast<uint32_t>(number);
74 property_details_ = descriptors->GetDetails(number_); 83 property_details_ = descriptors->GetDetails(number_);
75 } 84 }
76 has_property_ = true; 85 has_property_ = true;
77 switch (property_details_.kind()) { 86 switch (property_details_.kind()) {
78 case v8::internal::kData: 87 case v8::internal::kData:
79 return DATA; 88 return DATA;
80 case v8::internal::kAccessor: 89 case v8::internal::kAccessor:
81 return ACCESSOR; 90 return ACCESSOR;
82 } 91 }
83 case ACCESSOR: 92 case ACCESSOR:
84 case DATA: 93 case DATA:
85 return NOT_FOUND; 94 return NOT_FOUND;
86 case INTEGER_INDEXED_EXOTIC: 95 case INTEGER_INDEXED_EXOTIC:
87 case JSPROXY: 96 case JSPROXY:
88 case TRANSITION: 97 case TRANSITION:
89 UNREACHABLE(); 98 UNREACHABLE();
90 } 99 }
91 UNREACHABLE(); 100 UNREACHABLE();
92 return state_; 101 return state_;
93 } 102 }
94 103
95 104
96 LookupIterator::State LookupIterator::LookupNonMaskingInterceptorInHolder( 105 LookupIterator::State LookupIterator::LookupNonMaskingInterceptorInHolder(
97 Map* const map, JSReceiver* const holder) { 106 Map* const map, JSReceiver* const holder) {
98 switch (state_) { 107 switch (state_) {
99 case NOT_FOUND: 108 case NOT_FOUND:
100 if (check_interceptor() && map->has_named_interceptor() && 109 if (check_interceptor() && HasInterceptor(map) &&
101 !SkipInterceptor(JSObject::cast(holder))) { 110 !SkipInterceptor(JSObject::cast(holder))) {
102 return INTERCEPTOR; 111 return INTERCEPTOR;
103 } 112 }
104 // Fall through. 113 // Fall through.
105 default: 114 default:
106 return NOT_FOUND; 115 return NOT_FOUND;
107 } 116 }
108 UNREACHABLE(); 117 UNREACHABLE();
109 return state_; 118 return state_;
110 } 119 }
111 } 120 }
112 } // namespace v8::internal 121 } // namespace v8::internal
113 122
114 #endif // V8_LOOKUP_INL_H_ 123 #endif // V8_LOOKUP_INL_H_
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698