Chromium Code Reviews

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.
Jump to:
View unified diff |
« 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...)
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 (check_interceptor() && map->has_named_interceptor()) { 50 if (check_interceptor() && map->has_named_interceptor() &&
51 !SkipInterceptor(JSObject::cast(holder))) {
48 return INTERCEPTOR; 52 return INTERCEPTOR;
49 } 53 }
50 // Fall through. 54 // Fall through.
51 case INTERCEPTOR: 55 case INTERCEPTOR:
52 if (map->is_dictionary_map()) { 56 if (map->is_dictionary_map()) {
53 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); 57 NameDictionary* dict = JSObject::cast(holder)->property_dictionary();
54 number_ = dict->FindEntry(name_); 58 number_ = dict->FindEntry(name_);
55 if (number_ == NameDictionary::kNotFound) return NOT_FOUND; 59 if (number_ == NameDictionary::kNotFound) return NOT_FOUND;
56 property_details_ = dict->DetailsAt(number_); 60 property_details_ = dict->DetailsAt(number_);
57 if (holder->IsGlobalObject()) { 61 if (holder->IsGlobalObject()) {
(...skipping 17 matching lines...)
75 case ACCESSOR: 79 case ACCESSOR:
76 case DATA: 80 case DATA:
77 return NOT_FOUND; 81 return NOT_FOUND;
78 case JSPROXY: 82 case JSPROXY:
79 case TRANSITION: 83 case TRANSITION:
80 UNREACHABLE(); 84 UNREACHABLE();
81 } 85 }
82 UNREACHABLE(); 86 UNREACHABLE();
83 return state_; 87 return state_;
84 } 88 }
89
90
91 LookupIterator::State LookupIterator::LookupNonMaskingInterceptorInHolder(
92 Map* const map, JSReceiver* const holder) {
93 switch (state_) {
94 case NOT_FOUND:
95 if (map->is_access_check_needed() &&
96 !isolate_->IsInternallyUsedPropertyName(name_)) {
Toon Verwaest 2015/03/11 14:09:35 You don't need these, given that you had to have a
97 return ACCESS_CHECK;
98 }
99 // Fall through.
100 case ACCESS_CHECK:
101 if (check_interceptor() && map->has_named_interceptor() &&
102 !SkipInterceptor(JSObject::cast(holder))) {
103 return INTERCEPTOR;
104 }
105 // Fall through.
106 default:
107 return NOT_FOUND;
108 }
109 UNREACHABLE();
110 return state_;
111 }
85 } 112 }
86 } // namespace v8::internal 113 } // namespace v8::internal
87 114
88 #endif // V8_LOOKUP_INL_H_ 115 #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