| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index ddf62b153cb6e98dbb8291b9184a1ebe35c975e8..646552810095c77a0fc430d8e82486dafaeaa1a8 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -16515,6 +16515,11 @@ template Handle<NameDictionary>
|
| HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >::
|
| New(Isolate*, int, MinimumCapacity, PretenureFlag);
|
|
|
| +template Handle<ObjectHashSet> HashTable<ObjectHashSet, ObjectHashSetShape,
|
| + Handle<Object>>::New(Isolate*, int n,
|
| + MinimumCapacity,
|
| + PretenureFlag);
|
| +
|
| template Handle<NameDictionary>
|
| HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >::
|
| Shrink(Handle<NameDictionary>, Handle<Name>);
|
| @@ -16585,24 +16590,33 @@ template int Dictionary<GlobalDictionary, GlobalDictionaryShape, Handle<Name>>::
|
| template int Dictionary<NameDictionary, NameDictionaryShape, Handle<Name>>::
|
| NumberOfElementsFilterAttributes(PropertyFilter filter);
|
|
|
| -template void Dictionary<GlobalDictionary, GlobalDictionaryShape,
|
| - Handle<Name>>::CopyEnumKeysTo(FixedArray* storage);
|
| +template void
|
| +Dictionary<GlobalDictionary, GlobalDictionaryShape, Handle<Name>>::
|
| + CopyEnumKeysTo(Handle<Dictionary<GlobalDictionary, GlobalDictionaryShape,
|
| + Handle<Name>>>
|
| + dictionary,
|
| + Handle<FixedArray> storage, KeyCollectionMode mode,
|
| + KeyAccumulator* accumulator);
|
|
|
| -template void Dictionary<NameDictionary, NameDictionaryShape,
|
| - Handle<Name>>::CopyEnumKeysTo(FixedArray* storage);
|
| +template void
|
| +Dictionary<NameDictionary, NameDictionaryShape, Handle<Name>>::CopyEnumKeysTo(
|
| + Handle<Dictionary<NameDictionary, NameDictionaryShape, Handle<Name>>>
|
| + dictionary,
|
| + Handle<FixedArray> storage, KeyCollectionMode mode,
|
| + KeyAccumulator* accumulator);
|
|
|
| template void
|
| Dictionary<GlobalDictionary, GlobalDictionaryShape, Handle<Name>>::
|
| CollectKeysTo(Handle<Dictionary<GlobalDictionary, GlobalDictionaryShape,
|
| Handle<Name>>>
|
| dictionary,
|
| - KeyAccumulator* keys, PropertyFilter filter);
|
| + KeyAccumulator* keys);
|
|
|
| template void
|
| Dictionary<NameDictionary, NameDictionaryShape, Handle<Name>>::CollectKeysTo(
|
| Handle<Dictionary<NameDictionary, NameDictionaryShape, Handle<Name>>>
|
| dictionary,
|
| - KeyAccumulator* keys, PropertyFilter filter);
|
| + KeyAccumulator* keys);
|
|
|
| Handle<Object> JSObject::PrepareSlowElementsForSort(
|
| Handle<JSObject> object, uint32_t limit) {
|
| @@ -17099,6 +17113,20 @@ bool StringSet::Has(Handle<String> name) {
|
| return FindEntry(*name) != kNotFound;
|
| }
|
|
|
| +Handle<ObjectHashSet> ObjectHashSet::Add(Handle<ObjectHashSet> set,
|
| + Handle<Object> key) {
|
| + Isolate* isolate = set->GetIsolate();
|
| + int32_t hash = Object::GetOrCreateHash(isolate, key)->value();
|
| +
|
| + if (!set->Has(isolate, key, hash)) {
|
| + set = EnsureCapacity(set, 1, key);
|
| + int entry = set->FindInsertionEntry(hash);
|
| + set->set(EntryToIndex(entry), *key);
|
| + set->ElementAdded();
|
| + }
|
| + return set;
|
| +}
|
| +
|
| Handle<Object> CompilationCacheTable::Lookup(Handle<String> src,
|
| Handle<Context> context,
|
| LanguageMode language_mode) {
|
| @@ -17554,43 +17582,61 @@ struct EnumIndexComparator {
|
| Dictionary* dict;
|
| };
|
|
|
| -
|
| template <typename Derived, typename Shape, typename Key>
|
| -void Dictionary<Derived, Shape, Key>::CopyEnumKeysTo(FixedArray* storage) {
|
| - Isolate* isolate = this->GetIsolate();
|
| +void Dictionary<Derived, Shape, Key>::CopyEnumKeysTo(
|
| + Handle<Dictionary<Derived, Shape, Key>> dictionary,
|
| + Handle<FixedArray> storage, KeyCollectionMode mode,
|
| + KeyAccumulator* accumulator) {
|
| + Isolate* isolate = dictionary->GetIsolate();
|
| int length = storage->length();
|
| - int capacity = this->Capacity();
|
| + int capacity = dictionary->Capacity();
|
| int properties = 0;
|
| for (int i = 0; i < capacity; i++) {
|
| - Object* k = this->KeyAt(i);
|
| - if (this->IsKey(isolate, k) && !k->IsSymbol()) {
|
| - PropertyDetails details = this->DetailsAt(i);
|
| - if (details.IsDontEnum() || this->IsDeleted(i)) continue;
|
| + Object* key = dictionary->KeyAt(i);
|
| + bool is_shadowing_key = false;
|
| + if (!dictionary->IsKey(isolate, key)) continue;
|
| + if (key->IsSymbol()) continue;
|
| + PropertyDetails details = dictionary->DetailsAt(i);
|
| + if (details.IsDontEnum()) {
|
| + if (mode == KeyCollectionMode::kIncludePrototypes) {
|
| + is_shadowing_key = true;
|
| + } else {
|
| + continue;
|
| + }
|
| + }
|
| + if (dictionary->IsDeleted(i)) continue;
|
| + if (is_shadowing_key) {
|
| + accumulator->AddShadowKey(key);
|
| + continue;
|
| + } else {
|
| storage->set(properties, Smi::FromInt(i));
|
| - properties++;
|
| - if (properties == length) break;
|
| }
|
| + properties++;
|
| + if (properties == length) break;
|
| }
|
| +
|
| CHECK_EQ(length, properties);
|
| - EnumIndexComparator<Derived> cmp(static_cast<Derived*>(this));
|
| + DisallowHeapAllocation no_gc;
|
| + Dictionary<Derived, Shape, Key>* raw_dictionary = *dictionary;
|
| + FixedArray* raw_storage = *storage;
|
| + EnumIndexComparator<Derived> cmp(static_cast<Derived*>(*dictionary));
|
| Smi** start = reinterpret_cast<Smi**>(storage->GetFirstElementAddress());
|
| std::sort(start, start + length, cmp);
|
| for (int i = 0; i < length; i++) {
|
| - int index = Smi::cast(storage->get(i))->value();
|
| - storage->set(i, this->KeyAt(index));
|
| + int index = Smi::cast(raw_storage->get(i))->value();
|
| + raw_storage->set(i, raw_dictionary->KeyAt(index));
|
| }
|
| }
|
|
|
| template <typename Derived, typename Shape, typename Key>
|
| void Dictionary<Derived, Shape, Key>::CollectKeysTo(
|
| - Handle<Dictionary<Derived, Shape, Key> > dictionary, KeyAccumulator* keys,
|
| - PropertyFilter filter) {
|
| + Handle<Dictionary<Derived, Shape, Key>> dictionary, KeyAccumulator* keys) {
|
| Isolate* isolate = keys->isolate();
|
| int capacity = dictionary->Capacity();
|
| Handle<FixedArray> array =
|
| isolate->factory()->NewFixedArray(dictionary->NumberOfElements());
|
| int array_size = 0;
|
| -
|
| + PropertyFilter filter = keys->filter();
|
| {
|
| DisallowHeapAllocation no_gc;
|
| Dictionary<Derived, Shape, Key>* raw_dict = *dictionary;
|
| @@ -17599,7 +17645,10 @@ void Dictionary<Derived, Shape, Key>::CollectKeysTo(
|
| if (!raw_dict->IsKey(isolate, k) || k->FilterKey(filter)) continue;
|
| if (raw_dict->IsDeleted(i)) continue;
|
| PropertyDetails details = raw_dict->DetailsAt(i);
|
| - if ((details.attributes() & filter) != 0) continue;
|
| + if ((details.attributes() & filter) != 0) {
|
| + keys->AddShadowKey(k);
|
| + continue;
|
| + }
|
| if (filter & ONLY_ALL_CAN_READ) {
|
| if (details.kind() != kAccessor) continue;
|
| Object* accessors = raw_dict->ValueAt(i);
|
|
|