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

Side by Side Diff: src/lookup.cc

Issue 1587633002: LookupIterator should find private symbols on JSProxies (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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 #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/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 JSReceiver* const holder) { 604 JSReceiver* const holder) {
605 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY); 605 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY);
606 DisallowHeapAllocation no_gc; 606 DisallowHeapAllocation no_gc;
607 if (interceptor_state_ == InterceptorState::kProcessNonMasking) { 607 if (interceptor_state_ == InterceptorState::kProcessNonMasking) {
608 return LookupNonMaskingInterceptorInHolder(map, holder); 608 return LookupNonMaskingInterceptorInHolder(map, holder);
609 } 609 }
610 switch (state_) { 610 switch (state_) {
611 case NOT_FOUND: 611 case NOT_FOUND:
612 if (map->IsJSProxyMap()) { 612 if (map->IsJSProxyMap()) {
613 // Do not leak private property names. 613 // Do not leak private property names.
614 if (!name_.is_null() && name_->IsPrivate()) return NOT_FOUND; 614 if (name_.is_null() || !name_->IsPrivate()) return JSPROXY;
neis 2016/01/13 13:53:48 This looks wrong. I think you should just return
615 return JSPROXY;
616 } 615 }
617 if (map->is_access_check_needed() && 616 if (map->is_access_check_needed() &&
618 (IsElement() || !isolate_->IsInternallyUsedPropertyName(name_))) { 617 (IsElement() || !isolate_->IsInternallyUsedPropertyName(name_))) {
619 return ACCESS_CHECK; 618 return ACCESS_CHECK;
620 } 619 }
621 // Fall through. 620 // Fall through.
622 case ACCESS_CHECK: 621 case ACCESS_CHECK:
623 if (exotic_index_state_ != ExoticIndexState::kNotExotic && 622 if (exotic_index_state_ != ExoticIndexState::kNotExotic &&
624 holder->IsJSTypedArray() && IsIntegerIndexedExotic(holder)) { 623 holder->IsJSTypedArray() && IsIntegerIndexedExotic(holder)) {
625 return INTEGER_INDEXED_EXOTIC; 624 return INTEGER_INDEXED_EXOTIC;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } else if (map->IsJSGlobalObjectMap()) { 660 } else if (map->IsJSGlobalObjectMap()) {
662 GlobalDictionary* dict = JSObject::cast(holder)->global_dictionary(); 661 GlobalDictionary* dict = JSObject::cast(holder)->global_dictionary();
663 int number = dict->FindEntry(name_); 662 int number = dict->FindEntry(name_);
664 if (number == GlobalDictionary::kNotFound) return NOT_FOUND; 663 if (number == GlobalDictionary::kNotFound) return NOT_FOUND;
665 number_ = static_cast<uint32_t>(number); 664 number_ = static_cast<uint32_t>(number);
666 DCHECK(dict->ValueAt(number_)->IsPropertyCell()); 665 DCHECK(dict->ValueAt(number_)->IsPropertyCell());
667 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_)); 666 PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_));
668 if (cell->value()->IsTheHole()) return NOT_FOUND; 667 if (cell->value()->IsTheHole()) return NOT_FOUND;
669 property_details_ = cell->property_details(); 668 property_details_ = cell->property_details();
670 } else { 669 } else {
671 NameDictionary* dict = JSObject::cast(holder)->property_dictionary(); 670 NameDictionary* dict = holder->property_dictionary();
672 int number = dict->FindEntry(name_); 671 int number = dict->FindEntry(name_);
673 if (number == NameDictionary::kNotFound) return NOT_FOUND; 672 if (number == NameDictionary::kNotFound) return NOT_FOUND;
674 number_ = static_cast<uint32_t>(number); 673 number_ = static_cast<uint32_t>(number);
675 property_details_ = dict->DetailsAt(number_); 674 property_details_ = dict->DetailsAt(number_);
676 } 675 }
677 has_property_ = true; 676 has_property_ = true;
678 switch (property_details_.kind()) { 677 switch (property_details_.kind()) {
679 case v8::internal::kData: 678 case v8::internal::kData:
680 return DATA; 679 return DATA;
681 case v8::internal::kAccessor: 680 case v8::internal::kAccessor:
(...skipping 23 matching lines...) Expand all
705 // Fall through. 704 // Fall through.
706 default: 705 default:
707 return NOT_FOUND; 706 return NOT_FOUND;
708 } 707 }
709 UNREACHABLE(); 708 UNREACHABLE();
710 return state_; 709 return state_;
711 } 710 }
712 711
713 } // namespace internal 712 } // namespace internal
714 } // namespace v8 713 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698