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/lookup.h" | 5 #include "src/lookup.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/elements.h" | 9 #include "src/elements.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 ReloadPropertyInformation(); | 450 ReloadPropertyInformation(); |
451 } | 451 } |
452 | 452 |
453 | 453 |
454 bool LookupIterator::HolderIsReceiverOrHiddenPrototype() const { | 454 bool LookupIterator::HolderIsReceiverOrHiddenPrototype() const { |
455 DCHECK(has_property_ || state_ == INTERCEPTOR || state_ == JSPROXY); | 455 DCHECK(has_property_ || state_ == INTERCEPTOR || state_ == JSPROXY); |
456 // Optimization that only works if configuration_ is not mutable. | 456 // Optimization that only works if configuration_ is not mutable. |
457 if (!check_prototype_chain()) return true; | 457 if (!check_prototype_chain()) return true; |
458 DisallowHeapAllocation no_gc; | 458 DisallowHeapAllocation no_gc; |
| 459 if (*receiver_ == *holder_) return true; |
459 if (!receiver_->IsJSReceiver()) return false; | 460 if (!receiver_->IsJSReceiver()) return false; |
460 JSReceiver* current = JSReceiver::cast(*receiver_); | 461 JSReceiver* current = JSReceiver::cast(*receiver_); |
461 JSReceiver* object = *holder_; | 462 JSReceiver* object = *holder_; |
462 if (current == object) return true; | |
463 if (!current->map()->has_hidden_prototype()) return false; | 463 if (!current->map()->has_hidden_prototype()) return false; |
464 // JSProxy do not occur as hidden prototypes. | 464 // JSProxy do not occur as hidden prototypes. |
465 if (current->IsJSProxy()) return false; | 465 if (object->IsJSProxy()) return false; |
466 PrototypeIterator iter(isolate(), current, | 466 PrototypeIterator iter(isolate(), current, |
467 PrototypeIterator::START_AT_PROTOTYPE, | 467 PrototypeIterator::START_AT_PROTOTYPE, |
468 PrototypeIterator::END_AT_NON_HIDDEN); | 468 PrototypeIterator::END_AT_NON_HIDDEN); |
469 while (!iter.IsAtEnd()) { | 469 while (!iter.IsAtEnd()) { |
470 if (iter.GetCurrent<JSReceiver>() == object) return true; | 470 if (iter.GetCurrent<JSReceiver>() == object) return true; |
471 iter.Advance(); | 471 iter.Advance(); |
472 } | 472 } |
473 return false; | 473 return false; |
474 } | 474 } |
475 | 475 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 case v8::internal::kAccessor: | 724 case v8::internal::kAccessor: |
725 return ACCESSOR; | 725 return ACCESSOR; |
726 } | 726 } |
727 | 727 |
728 UNREACHABLE(); | 728 UNREACHABLE(); |
729 return state_; | 729 return state_; |
730 } | 730 } |
731 | 731 |
732 } // namespace internal | 732 } // namespace internal |
733 } // namespace v8 | 733 } // namespace v8 |
OLD | NEW |