OLD | NEW |
---|---|
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
10 #include "src/lookup-inl.h" | 10 #include "src/lookup-inl.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 PrototypeIterator::START_AT_RECEIVER); | 263 PrototypeIterator::START_AT_RECEIVER); |
264 do { | 264 do { |
265 if (JSReceiver::cast(iter.GetCurrent()) == holder) return true; | 265 if (JSReceiver::cast(iter.GetCurrent()) == holder) return true; |
266 DCHECK(!current->IsJSProxy()); | 266 DCHECK(!current->IsJSProxy()); |
267 iter.Advance(); | 267 iter.Advance(); |
268 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); | 268 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); |
269 return false; | 269 return false; |
270 } | 270 } |
271 | 271 |
272 | 272 |
273 void LookupIterator::LookupForRead() { | |
274 for (; IsFound(); Next()) { | |
275 switch (state()) { | |
276 case LookupIterator::NOT_FOUND: | |
277 case LookupIterator::TRANSITION: | |
278 UNREACHABLE(); | |
279 case LookupIterator::JSPROXY: | |
280 return; | |
281 case LookupIterator::INTERCEPTOR: { | |
282 // If there is a getter, return; otherwise loop to perform the lookup. | |
283 Handle<JSObject> holder = GetHolder<JSObject>(); | |
284 if (!holder->GetNamedInterceptor()->getter()->IsUndefined()) { | |
285 return; | |
286 } | |
287 break; | |
288 } | |
289 case LookupIterator::ACCESS_CHECK: | |
290 // PropertyHandlerCompiler::CheckPrototypes() knows how to emit | |
291 // access checks for global proxies. | |
292 if (GetHolder<JSObject>()->IsJSGlobalProxy() && | |
Toon Verwaest
2014/09/15 11:57:20
Wth? Why do you explicitly avoid access checks on
Dmitry Lomov (no reviews)
2014/09/15 12:31:12
As discussed offline, this returns otherwise, so d
| |
293 HasAccess(v8::ACCESS_GET)) { | |
294 break; | |
295 } | |
296 return; | |
297 case LookupIterator::PROPERTY: | |
298 if (HasProperty()) return; // Yay! | |
299 break; | |
300 } | |
301 } | |
302 } | |
303 | |
304 | |
273 Handle<Object> LookupIterator::FetchValue() const { | 305 Handle<Object> LookupIterator::FetchValue() const { |
274 Object* result = NULL; | 306 Object* result = NULL; |
275 Handle<JSObject> holder = GetHolder<JSObject>(); | 307 Handle<JSObject> holder = GetHolder<JSObject>(); |
276 switch (property_encoding_) { | 308 switch (property_encoding_) { |
277 case DICTIONARY: | 309 case DICTIONARY: |
278 result = holder->property_dictionary()->ValueAt(number_); | 310 result = holder->property_dictionary()->ValueAt(number_); |
279 if (holder->IsGlobalObject()) { | 311 if (holder->IsGlobalObject()) { |
280 result = PropertyCell::cast(result)->value(); | 312 result = PropertyCell::cast(result)->value(); |
281 } | 313 } |
282 break; | 314 break; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 DCHECK_EQ(v8::internal::CONSTANT, property_details_.type()); | 396 DCHECK_EQ(v8::internal::CONSTANT, property_details_.type()); |
365 } | 397 } |
366 } | 398 } |
367 | 399 |
368 | 400 |
369 void LookupIterator::InternalizeName() { | 401 void LookupIterator::InternalizeName() { |
370 if (name_->IsUniqueName()) return; | 402 if (name_->IsUniqueName()) return; |
371 name_ = factory()->InternalizeString(Handle<String>::cast(name_)); | 403 name_ = factory()->InternalizeString(Handle<String>::cast(name_)); |
372 } | 404 } |
373 } } // namespace v8::internal | 405 } } // namespace v8::internal |
OLD | NEW |