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

Unified Diff: src/objects.cc

Issue 2010593002: Revert of [keys] Simplify KeyAccumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 0e575ed1039043ded77541e3acaa220bdebe7b8d..433aea5b7affaafa9b4a251861ca9dcddbabedfc 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -6179,7 +6179,7 @@
// 5. ReturnIfAbrupt(keys).
Handle<FixedArray> keys;
ASSIGN_RETURN_ON_EXCEPTION(
- isolate, keys, KeyAccumulator::GetKeys(props, OWN_ONLY, ALL_PROPERTIES),
+ isolate, keys, JSReceiver::GetKeys(props, OWN_ONLY, ALL_PROPERTIES),
Object);
// 6. Let descriptors be an empty List.
int capacity = keys->length();
@@ -7858,7 +7858,8 @@
PropertyFilter filter = static_cast<PropertyFilter>(
ONLY_WRITABLE | ONLY_ENUMERABLE | ONLY_CONFIGURABLE);
KeyAccumulator accumulator(isolate, OWN_ONLY, filter);
- accumulator.CollectOwnPropertyNames(copy, copy);
+ accumulator.NextPrototype();
+ accumulator.CollectOwnPropertyNames(copy);
Handle<FixedArray> names = accumulator.GetKeys();
for (int i = 0; i < names->length(); i++) {
DCHECK(names->get(i)->IsName());
@@ -8161,6 +8162,15 @@
return !IsStringWrapperElementsKind(elements_kind()) &&
instance_type() > LAST_SPECIAL_RECEIVER_TYPE &&
!has_hidden_prototype() && !is_dictionary_map();
+}
+
+MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object,
+ KeyCollectionType type,
+ PropertyFilter filter,
+ GetKeysConversion keys_conversion,
+ bool filter_proxy_keys) {
+ return KeyAccumulator::GetKeys(object, type, filter, keys_conversion,
+ filter_proxy_keys);
}
MUST_USE_RESULT Maybe<bool> FastGetOwnValuesOrEntries(
@@ -17179,23 +17189,9 @@
std::sort(start, start + array_size, cmp);
}
- bool has_seen_symbol = false;
for (int i = 0; i < array_size; i++) {
int index = Smi::cast(array->get(i))->value();
- Object* key = dictionary->KeyAt(index);
- if (key->IsSymbol()) {
- has_seen_symbol = true;
- continue;
- }
- keys->AddKey(key, DO_NOT_CONVERT);
- }
- if (has_seen_symbol) {
- for (int i = 0; i < array_size; i++) {
- int index = Smi::cast(array->get(i))->value();
- Object* key = dictionary->KeyAt(index);
- if (!key->IsSymbol()) continue;
- keys->AddKey(key, DO_NOT_CONVERT);
- }
+ keys->AddKey(dictionary->KeyAt(index), DO_NOT_CONVERT);
}
}
@@ -17495,26 +17491,6 @@
return table;
}
-Handle<FixedArray> OrderedHashSet::ConvertToKeysArray(
- Handle<OrderedHashSet> table, GetKeysConversion convert) {
- Isolate* isolate = table->GetIsolate();
- int length = table->NumberOfElements();
- int nof_buckets = table->NumberOfBuckets();
- // Convert the dictionary to a linear list.
- Handle<FixedArray> result = Handle<FixedArray>::cast(table);
- // From this point on table is no longer a valid OrderedHashSet.
- result->set_map_no_write_barrier(isolate->heap()->fixed_array_map());
- for (int i = 0; i < length; i++) {
- int index = kHashTableStartIndex + nof_buckets + (i * kEntrySize);
- Object* key = table->get(index);
- if (convert == CONVERT_TO_STRING && key->IsNumber()) {
- key = *isolate->factory()->NumberToString(handle(key, isolate));
- }
- result->set(i, key);
- }
- result->Shrink(length);
- return result;
-}
template<class Derived, class Iterator, int entrysize>
Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Rehash(
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698