summaryrefslogtreecommitdiff
path: root/deps/v8/src/objects/objects.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/objects/objects.cc')
-rw-r--r--deps/v8/src/objects/objects.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/deps/v8/src/objects/objects.cc b/deps/v8/src/objects/objects.cc
index cf1a3dcc20..9b53019297 100644
--- a/deps/v8/src/objects/objects.cc
+++ b/deps/v8/src/objects/objects.cc
@@ -7220,10 +7220,9 @@ int BaseNameDictionary<Derived, Shape>::NextEnumerationIndex(
// Check whether the next enumeration index is valid.
if (!PropertyDetails::IsValidIndex(index)) {
// If not, we generate new indices for the properties.
- int length = dictionary->NumberOfElements();
-
Handle<FixedArray> iteration_order = IterationIndices(isolate, dictionary);
- DCHECK_EQ(length, iteration_order->length());
+ int length = iteration_order->length();
+ DCHECK_LE(length, dictionary->NumberOfElements());
// Iterate over the dictionary using the enumeration order and update
// the dictionary with new enumeration indices.
@@ -7467,8 +7466,8 @@ void BaseNameDictionary<Derived, Shape>::CopyEnumKeysTo(
template <typename Derived, typename Shape>
Handle<FixedArray> BaseNameDictionary<Derived, Shape>::IterationIndices(
Isolate* isolate, Handle<Derived> dictionary) {
- int length = dictionary->NumberOfElements();
- Handle<FixedArray> array = isolate->factory()->NewFixedArray(length);
+ Handle<FixedArray> array =
+ isolate->factory()->NewFixedArray(dictionary->NumberOfElements());
ReadOnlyRoots roots(isolate);
int array_size = 0;
{
@@ -7480,7 +7479,13 @@ Handle<FixedArray> BaseNameDictionary<Derived, Shape>::IterationIndices(
array->set(array_size++, Smi::FromInt(i.as_int()));
}
- DCHECK_EQ(array_size, length);
+ // The global dictionary doesn't track its deletion count, so we may iterate
+ // fewer entries than the count of elements claimed by the dictionary.
+ if (std::is_same<Derived, GlobalDictionary>::value) {
+ DCHECK_LE(array_size, dictionary->NumberOfElements());
+ } else {
+ DCHECK_EQ(array_size, dictionary->NumberOfElements());
+ }
EnumIndexComparator<Derived> cmp(raw_dictionary);
// Use AtomicSlot wrapper to ensure that std::sort uses atomic load and