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

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

Issue 962613002: add interceptors which do not mask existing properties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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') | src/objects.h » ('j') | 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 13 matching lines...) Expand all
24 // Always lookup behind the JSGlobalProxy into the JSGlobalObject, even 24 // Always lookup behind the JSGlobalProxy into the JSGlobalObject, even
25 // when not checking other hidden prototypes. 25 // when not checking other hidden prototypes.
26 !map->IsJSGlobalProxyMap()) { 26 !map->IsJSGlobalProxyMap()) {
27 return NULL; 27 return NULL;
28 } 28 }
29 29
30 return next; 30 return next;
31 } 31 }
32 32
33 33
34 LookupIterator::State LookupIterator::LookupInHolder(Map* map, 34 LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
35 JSReceiver* 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) {
39 return LookupNonMaskingInterceptorInHolder(map, holder);
40 }
38 switch (state_) { 41 switch (state_) {
39 case NOT_FOUND: 42 case NOT_FOUND:
40 if (map->IsJSProxyMap()) return JSPROXY; 43 if (map->IsJSProxyMap()) return JSPROXY;
41 if (map->is_access_check_needed() && 44 if (map->is_access_check_needed() &&
42 !isolate_->IsInternallyUsedPropertyName(name_)) { 45 !isolate_->IsInternallyUsedPropertyName(name_)) {
43 return ACCESS_CHECK; 46 return ACCESS_CHECK;
44 } 47 }
45 // Fall through. 48 // Fall through.
46 case ACCESS_CHECK: 49 case ACCESS_CHECK:
47 if (exotic_index_state_ != ExoticIndexState::kNoIndex && 50 if (exotic_index_state_ != ExoticIndexState::kNoIndex &&
48 IsIntegerIndexedExotic(holder)) { 51 IsIntegerIndexedExotic(holder)) {
49 return INTEGER_INDEXED_EXOTIC; 52 return INTEGER_INDEXED_EXOTIC;
50 } 53 }
51 if (check_interceptor() && map->has_named_interceptor()) { 54 if (check_interceptor() && map->has_named_interceptor() &&
55 !SkipInterceptor(JSObject::cast(holder))) {
52 return INTERCEPTOR; 56 return INTERCEPTOR;
53 } 57 }
54 // Fall through. 58 // Fall through.
55 case INTERCEPTOR: 59 case INTERCEPTOR:
56 if (map->is_dictionary_map()) { 60 if (map->is_dictionary_map()) {
57 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); 61 NameDictionary* dict = JSObject::cast(holder)->property_dictionary();
58 number_ = dict->FindEntry(name_); 62 number_ = dict->FindEntry(name_);
59 if (number_ == NameDictionary::kNotFound) return NOT_FOUND; 63 if (number_ == NameDictionary::kNotFound) return NOT_FOUND;
60 if (holder->IsGlobalObject()) { 64 if (holder->IsGlobalObject()) {
61 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); 65 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_));
(...skipping 17 matching lines...) Expand all
79 case DATA: 83 case DATA:
80 return NOT_FOUND; 84 return NOT_FOUND;
81 case INTEGER_INDEXED_EXOTIC: 85 case INTEGER_INDEXED_EXOTIC:
82 case JSPROXY: 86 case JSPROXY:
83 case TRANSITION: 87 case TRANSITION:
84 UNREACHABLE(); 88 UNREACHABLE();
85 } 89 }
86 UNREACHABLE(); 90 UNREACHABLE();
87 return state_; 91 return state_;
88 } 92 }
93
94
95 LookupIterator::State LookupIterator::LookupNonMaskingInterceptorInHolder(
96 Map* const map, JSReceiver* const holder) {
97 switch (state_) {
98 case NOT_FOUND:
99 if (check_interceptor() && map->has_named_interceptor() &&
100 !SkipInterceptor(JSObject::cast(holder))) {
101 return INTERCEPTOR;
102 }
103 // Fall through.
104 default:
105 return NOT_FOUND;
106 }
107 UNREACHABLE();
108 return state_;
109 }
89 } 110 }
90 } // namespace v8::internal 111 } // namespace v8::internal
91 112
92 #endif // V8_LOOKUP_INL_H_ 113 #endif // V8_LOOKUP_INL_H_
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698