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

Side by Side Diff: src/lookup.h

Issue 536943002: Never skip access checks when looking up properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/isolate.cc ('k') | src/lookup-inl.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_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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 class LookupIterator FINAL BASE_EMBEDDED { 15 class LookupIterator FINAL BASE_EMBEDDED {
16 public: 16 public:
17 enum Configuration { 17 enum Configuration {
18 // Configuration bits. 18 // Configuration bits.
19 kAccessCheck = 1 << 0, 19 kHidden = 1 << 0,
20 kHidden = 1 << 1, 20 kInterceptor = 1 << 1,
21 kInterceptor = 1 << 2, 21 kPrototypeChain = 1 << 2,
22 kPrototypeChain = 1 << 3,
23 22
24 // Convience combinations of bits. 23 // Convience combinations of bits.
25 OWN_PROPERTY = 0, 24 OWN_SKIP_INTERCEPTOR = 0,
26 OWN_SKIP_INTERCEPTOR = kAccessCheck, 25 OWN = kInterceptor,
27 OWN = kAccessCheck | kInterceptor, 26 HIDDEN_SKIP_INTERCEPTOR = kHidden,
28 HIDDEN_PROPERTY = kHidden, 27 HIDDEN = kHidden | kInterceptor,
29 HIDDEN_SKIP_INTERCEPTOR = kAccessCheck | kHidden, 28 PROTOTYPE_CHAIN_SKIP_INTERCEPTOR = kHidden | kPrototypeChain,
30 HIDDEN = kAccessCheck | kHidden | kInterceptor, 29 PROTOTYPE_CHAIN = kHidden | kPrototypeChain | kInterceptor
31 PROTOTYPE_CHAIN_PROPERTY = kHidden | kPrototypeChain,
32 PROTOTYPE_CHAIN_SKIP_INTERCEPTOR = kAccessCheck | kHidden | kPrototypeChain,
33 PROTOTYPE_CHAIN = kAccessCheck | kHidden | kPrototypeChain | kInterceptor
34 }; 30 };
35 31
36 enum State { 32 enum State {
37 ACCESS_CHECK, 33 ACCESS_CHECK,
38 INTERCEPTOR, 34 INTERCEPTOR,
39 JSPROXY, 35 JSPROXY,
40 NOT_FOUND, 36 NOT_FOUND,
41 PROPERTY, 37 PROPERTY,
42 TRANSITION, 38 TRANSITION,
43 // Set state_ to BEFORE_PROPERTY to ensure that the next lookup will be a 39 // Set state_ to BEFORE_PROPERTY to ensure that the next lookup will be a
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 180
185 bool IsBootstrapping() const; 181 bool IsBootstrapping() const;
186 182
187 // Methods that fetch data from the holder ensure they always have a holder. 183 // Methods that fetch data from the holder ensure they always have a holder.
188 // This means the receiver needs to be present as opposed to just the receiver 184 // This means the receiver needs to be present as opposed to just the receiver
189 // map. Other objects in the prototype chain are transitively guaranteed to be 185 // map. Other objects in the prototype chain are transitively guaranteed to be
190 // present via the receiver map. 186 // present via the receiver map.
191 bool is_guaranteed_to_have_holder() const { 187 bool is_guaranteed_to_have_holder() const {
192 return !maybe_receiver_.is_null(); 188 return !maybe_receiver_.is_null();
193 } 189 }
194 bool check_access_check() const {
195 return (configuration_ & kAccessCheck) != 0;
196 }
197 bool check_hidden() const { return (configuration_ & kHidden) != 0; } 190 bool check_hidden() const { return (configuration_ & kHidden) != 0; }
198 bool check_interceptor() const { 191 bool check_interceptor() const {
199 return !IsBootstrapping() && (configuration_ & kInterceptor) != 0; 192 return !IsBootstrapping() && (configuration_ & kInterceptor) != 0;
200 } 193 }
201 bool check_prototype_chain() const { 194 bool check_prototype_chain() const {
202 return (configuration_ & kPrototypeChain) != 0; 195 return (configuration_ & kPrototypeChain) != 0;
203 } 196 }
204 int descriptor_number() const { 197 int descriptor_number() const {
205 DCHECK(has_property_); 198 DCHECK(has_property_);
206 DCHECK_EQ(DESCRIPTOR, property_encoding_); 199 DCHECK_EQ(DESCRIPTOR, property_encoding_);
(...skipping 29 matching lines...) Expand all
236 MaybeHandle<Object> maybe_receiver_; 229 MaybeHandle<Object> maybe_receiver_;
237 MaybeHandle<JSReceiver> maybe_holder_; 230 MaybeHandle<JSReceiver> maybe_holder_;
238 231
239 int number_; 232 int number_;
240 }; 233 };
241 234
242 235
243 } } // namespace v8::internal 236 } } // namespace v8::internal
244 237
245 #endif // V8_LOOKUP_H_ 238 #endif // V8_LOOKUP_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/lookup-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698