Commit 7bb79b96 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[keys] Don't keep chain of OrderedHashSets in KeyAccumulator

Bug: chromium:831984
Change-Id: Ie13b22bc2491acc255557ba0325d8d53c22d6acb
Reviewed-on: https://chromium-review.googlesource.com/1012874Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52630}
parent c536ea2d
......@@ -77,7 +77,14 @@ void KeyAccumulator::AddKey(Handle<Object> key, AddKeyConversion convert) {
Handle<String>::cast(key)->AsArrayIndex(&index)) {
key = isolate_->factory()->NewNumberFromUint(index);
}
keys_ = OrderedHashSet::Add(keys(), key);
Handle<OrderedHashSet> new_set = OrderedHashSet::Add(keys(), key);
if (*new_set != *keys_) {
// The keys_ Set is converted directly to a FixedArray in GetKeys which can
// be left-trimmer. Hence the previous Set should not keep a pointer to the
// new one.
keys_->set(OrderedHashTableBase::kNextTableIndex, Smi::kZero);
keys_ = new_set;
}
}
void KeyAccumulator::AddKeys(Handle<FixedArray> array,
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
let arr = [...Array(9000)];
for (let j = 0; j < 40; j++) {
Reflect.ownKeys(arr).shift();
Array(64386);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment