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

Side by Side Diff: src/lookup.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/ic/ic.cc ('k') | src/lookup.cc » ('j') | src/lookup-inl.h » ('J')
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_H_ 5 #ifndef V8_LOOKUP_H_
6 #define V8_LOOKUP_H_ 6 #define V8_LOOKUP_H_
7 7
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 28 matching lines...) Expand all
39 TRANSITION, 39 TRANSITION,
40 // Set state_ to BEFORE_PROPERTY to ensure that the next lookup will be a 40 // Set state_ to BEFORE_PROPERTY to ensure that the next lookup will be a
41 // PROPERTY lookup. 41 // PROPERTY lookup.
42 BEFORE_PROPERTY = INTERCEPTOR 42 BEFORE_PROPERTY = INTERCEPTOR
43 }; 43 };
44 44
45 LookupIterator(Handle<Object> receiver, Handle<Name> name, 45 LookupIterator(Handle<Object> receiver, Handle<Name> name,
46 Configuration configuration = PROTOTYPE_CHAIN) 46 Configuration configuration = PROTOTYPE_CHAIN)
47 : configuration_(ComputeConfiguration(configuration, name)), 47 : configuration_(ComputeConfiguration(configuration, name)),
48 state_(NOT_FOUND), 48 state_(NOT_FOUND),
49 interceptor_state_(InterceptorState::kUninitialized),
49 property_details_(NONE, v8::internal::DATA, 0), 50 property_details_(NONE, v8::internal::DATA, 0),
50 isolate_(name->GetIsolate()), 51 isolate_(name->GetIsolate()),
51 name_(name), 52 name_(name),
52 receiver_(receiver), 53 receiver_(receiver),
54 holder_(GetRoot(receiver_, isolate_)),
55 holder_map_(holder_->map(), isolate_),
56 initial_holder_(holder_),
53 number_(DescriptorArray::kNotFound) { 57 number_(DescriptorArray::kNotFound) {
54 holder_ = GetRoot();
55 holder_map_ = handle(holder_->map(), isolate_);
56 Next(); 58 Next();
57 } 59 }
58 60
59 LookupIterator(Handle<Object> receiver, Handle<Name> name, 61 LookupIterator(Handle<Object> receiver, Handle<Name> name,
60 Handle<JSReceiver> holder, 62 Handle<JSReceiver> holder,
61 Configuration configuration = PROTOTYPE_CHAIN) 63 Configuration configuration = PROTOTYPE_CHAIN)
62 : configuration_(ComputeConfiguration(configuration, name)), 64 : configuration_(ComputeConfiguration(configuration, name)),
63 state_(NOT_FOUND), 65 state_(NOT_FOUND),
66 interceptor_state_(InterceptorState::kUninitialized),
64 property_details_(NONE, v8::internal::DATA, 0), 67 property_details_(NONE, v8::internal::DATA, 0),
65 isolate_(name->GetIsolate()), 68 isolate_(name->GetIsolate()),
66 name_(name), 69 name_(name),
67 holder_map_(holder->map(), isolate_),
68 receiver_(receiver), 70 receiver_(receiver),
69 holder_(holder), 71 holder_(holder),
72 holder_map_(holder_->map(), isolate_),
73 initial_holder_(holder_),
70 number_(DescriptorArray::kNotFound) { 74 number_(DescriptorArray::kNotFound) {
71 Next(); 75 Next();
72 } 76 }
73 77
74 Isolate* isolate() const { return isolate_; } 78 Isolate* isolate() const { return isolate_; }
75 State state() const { return state_; } 79 State state() const { return state_; }
76 Handle<Name> name() const { return name_; } 80 Handle<Name> name() const { return name_; }
77 81
78 bool IsFound() const { return state_ != NOT_FOUND; } 82 bool IsFound() const { return state_ != NOT_FOUND; }
79 void Next(); 83 void Next();
80 void NotFound() { 84 void NotFound() {
81 has_property_ = false; 85 has_property_ = false;
82 state_ = NOT_FOUND; 86 state_ = NOT_FOUND;
83 } 87 }
84 88
85 Factory* factory() const { return isolate_->factory(); } 89 Factory* factory() const { return isolate_->factory(); }
86 Handle<Object> GetReceiver() const { return receiver_; } 90 Handle<Object> GetReceiver() const { return receiver_; }
87 Handle<JSObject> GetStoreTarget() const; 91 Handle<JSObject> GetStoreTarget() const;
88 bool is_dictionary_holder() const { return holder_map_->is_dictionary_map(); } 92 bool is_dictionary_holder() const { return holder_map_->is_dictionary_map(); }
89 Handle<Map> transition_map() const { 93 Handle<Map> transition_map() const {
90 DCHECK_EQ(TRANSITION, state_); 94 DCHECK_EQ(TRANSITION, state_);
91 return Handle<Map>::cast(transition_); 95 return Handle<Map>::cast(transition_);
92 } 96 }
93 template <class T> 97 template <class T>
94 Handle<T> GetHolder() const { 98 Handle<T> GetHolder() const {
95 DCHECK(IsFound()); 99 DCHECK(IsFound());
96 return Handle<T>::cast(holder_); 100 return Handle<T>::cast(holder_);
97 } 101 }
98 Handle<JSReceiver> GetRoot() const; 102 static Handle<JSReceiver> GetRoot(Handle<Object> receiver, Isolate* isolate);
99 bool HolderIsReceiverOrHiddenPrototype() const; 103 bool HolderIsReceiverOrHiddenPrototype() const;
100 104
101 /* ACCESS_CHECK */ 105 /* ACCESS_CHECK */
102 bool HasAccess() const; 106 bool HasAccess() const;
103 107
104 /* PROPERTY */ 108 /* PROPERTY */
105 void PrepareForDataProperty(Handle<Object> value); 109 void PrepareForDataProperty(Handle<Object> value);
106 void PrepareTransitionToDataProperty(Handle<Object> value, 110 void PrepareTransitionToDataProperty(Handle<Object> value,
107 PropertyAttributes attributes, 111 PropertyAttributes attributes,
108 Object::StoreFromKeyed store_mode); 112 Object::StoreFromKeyed store_mode);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // non-observable modifications on it, such as internalize strings. 145 // non-observable modifications on it, such as internalize strings.
142 Handle<Object> WriteDataValue(Handle<Object> value); 146 Handle<Object> WriteDataValue(Handle<Object> value);
143 147
144 // Checks whether the receiver is an indexed exotic object 148 // Checks whether the receiver is an indexed exotic object
145 // and name is a special numeric index. 149 // and name is a special numeric index.
146 bool IsSpecialNumericIndex() const; 150 bool IsSpecialNumericIndex() const;
147 151
148 void InternalizeName(); 152 void InternalizeName();
149 153
150 private: 154 private:
155 enum class InterceptorState {
156 kUninitialized,
157 kSkipNonMasking,
158 kProcessNonMasking
159 };
160
151 Handle<Map> GetReceiverMap() const; 161 Handle<Map> GetReceiverMap() const;
152 162
153 MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map); 163 MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map);
154 inline State LookupInHolder(Map* map, JSReceiver* holder); 164 inline State LookupInHolder(Map* map, JSReceiver* holder);
165 void RestartLookupForNonMaskingInterceptors();
166 State LookupNonMaskingInterceptorInHolder(Map* map, JSReceiver* holder);
155 Handle<Object> FetchValue() const; 167 Handle<Object> FetchValue() const;
156 void ReloadPropertyInformation(); 168 void ReloadPropertyInformation();
169 bool SkipInterceptor(JSObject* holder);
157 170
158 bool IsBootstrapping() const; 171 bool IsBootstrapping() const;
159 172
160 bool check_hidden() const { return (configuration_ & kHidden) != 0; } 173 bool check_hidden() const { return (configuration_ & kHidden) != 0; }
161 bool check_interceptor() const { 174 bool check_interceptor() const {
162 return !IsBootstrapping() && (configuration_ & kInterceptor) != 0; 175 return !IsBootstrapping() && (configuration_ & kInterceptor) != 0;
163 } 176 }
164 bool check_prototype_chain() const { 177 bool check_prototype_chain() const {
165 return (configuration_ & kPrototypeChain) != 0; 178 return (configuration_ & kPrototypeChain) != 0;
166 } 179 }
(...skipping 13 matching lines...) Expand all
180 if (name->IsOwn()) { 193 if (name->IsOwn()) {
181 return static_cast<Configuration>(configuration & 194 return static_cast<Configuration>(configuration &
182 HIDDEN_SKIP_INTERCEPTOR); 195 HIDDEN_SKIP_INTERCEPTOR);
183 } else { 196 } else {
184 return configuration; 197 return configuration;
185 } 198 }
186 } 199 }
187 200
188 // If configuration_ becomes mutable, update 201 // If configuration_ becomes mutable, update
189 // HolderIsReceiverOrHiddenPrototype. 202 // HolderIsReceiverOrHiddenPrototype.
190 Configuration configuration_; 203 const Configuration configuration_;
191 State state_; 204 State state_;
192 bool has_property_; 205 bool has_property_;
206 InterceptorState interceptor_state_;
193 PropertyDetails property_details_; 207 PropertyDetails property_details_;
194 Isolate* isolate_; 208 Isolate* const isolate_;
195 Handle<Name> name_; 209 Handle<Name> name_;
210 Handle<Object> transition_;
211 const Handle<Object> receiver_;
212 Handle<JSReceiver> holder_;
196 Handle<Map> holder_map_; 213 Handle<Map> holder_map_;
197 Handle<Object> transition_; 214 const Handle<JSReceiver> initial_holder_;
198 Handle<Object> receiver_;
199 Handle<JSReceiver> holder_;
200
201 int number_; 215 int number_;
202 }; 216 };
203 217
204 218
205 } } // namespace v8::internal 219 } } // namespace v8::internal
206 220
207 #endif // V8_LOOKUP_H_ 221 #endif // V8_LOOKUP_H_
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | src/lookup.cc » ('j') | src/lookup-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698