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

Unified Diff: src/lookup.cc

Issue 1660903002: [runtime] Remove receiver==holder check in IntegerIndexedExotic lookup (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lookup.h ('k') | test/mjsunit/regress/regress-integer-indexed-element.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index e3227dfc329873d26cdf7b452a51c40f5052455b..4eed6a9f193d1379019f5da7a4f5687d25f1c3f3 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -518,18 +518,6 @@ void LookupIterator::WriteDataValue(Handle<Object> value) {
}
-bool LookupIterator::IsIntegerIndexedExotic(JSReceiver* holder) {
- DCHECK(!IsElement());
- if (!name_->IsString()) return false;
- if (*receiver_ != holder) return false;
-
- Handle<String> name_string = Handle<String>::cast(name_);
- if (name_string->length() == 0) return false;
-
- return IsSpecialIndex(isolate_->unicode_cache(), *name_string);
-}
-
-
void LookupIterator::InternalizeName() {
if (name_->IsUniqueName()) return;
name_ = factory()->InternalizeString(Handle<String>::cast(name_));
@@ -579,6 +567,17 @@ JSReceiver* LookupIterator::NextHolder(Map* map) {
return next;
}
+LookupIterator::State LookupIterator::NotFound(JSReceiver* const holder) const {
+ DCHECK(!IsElement());
+ if (!holder->IsJSTypedArray() || !name_->IsString()) return NOT_FOUND;
+
+ Handle<String> name_string = Handle<String>::cast(name_);
+ if (name_string->length() == 0) return NOT_FOUND;
+
+ return IsSpecialIndex(isolate_->unicode_cache(), *name_string)
+ ? INTEGER_INDEXED_EXOTIC
+ : NOT_FOUND;
+}
LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
JSReceiver* const holder) {
@@ -613,18 +612,13 @@ LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
FixedArrayBase* backing_store = js_object->elements();
number_ = accessor->GetEntryForIndex(js_object, backing_store, index_);
if (number_ == kMaxUInt32) {
- if (*receiver_ == holder && holder->IsJSTypedArray()) {
- return INTEGER_INDEXED_EXOTIC;
- }
- return NOT_FOUND;
+ return holder->IsJSTypedArray() ? INTEGER_INDEXED_EXOTIC : NOT_FOUND;
}
property_details_ = accessor->GetDetails(js_object, number_);
- } else if (holder->IsJSTypedArray() && IsIntegerIndexedExotic(holder)) {
- return INTEGER_INDEXED_EXOTIC;
} else if (!map->is_dictionary_map()) {
DescriptorArray* descriptors = map->instance_descriptors();
int number = descriptors->SearchWithCache(*name_, map);
- if (number == DescriptorArray::kNotFound) return NOT_FOUND;
+ if (number == DescriptorArray::kNotFound) return NotFound(holder);
number_ = static_cast<uint32_t>(number);
property_details_ = descriptors->GetDetails(number_);
} else if (map->IsJSGlobalObjectMap()) {
@@ -639,7 +633,7 @@ LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
} else {
NameDictionary* dict = holder->property_dictionary();
int number = dict->FindEntry(name_);
- if (number == NameDictionary::kNotFound) return NOT_FOUND;
+ if (number == NameDictionary::kNotFound) return NotFound(holder);
number_ = static_cast<uint32_t>(number);
property_details_ = dict->DetailsAt(number_);
}
« no previous file with comments | « src/lookup.h ('k') | test/mjsunit/regress/regress-integer-indexed-element.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698