diff --git a/chromium/v8/src/objects/map-updater.cc b/chromium/v8/src/objects/map-updater.cc index 2ebfc84d3e3..489a2a613d0 100644 --- a/chromium/v8/src/objects/map-updater.cc +++ b/chromium/v8/src/objects/map-updater.cc @@ -1031,14 +1031,21 @@ MapUpdater::State MapUpdater::ConstructNewMap() { Handle new_map = Map::AddMissingTransitions(isolate_, split_map, new_descriptors); + bool had_any_enum_cache = + split_map->instance_descriptors(isolate_) + .enum_cache() + .keys() + .length() > 0 || + old_descriptors_->enum_cache().keys().length() > 0; + // Deprecated part of the transition tree is no longer reachable, so replace // current instance descriptors in the "survived" part of the tree with // the new descriptors to maintain descriptors sharing invariant. split_map->ReplaceDescriptors(isolate_, *new_descriptors); - // If the old descriptors had an enum cache, make sure the new ones do too. - if (old_descriptors_->enum_cache().keys().length() > 0 && - new_map->NumberOfEnumerableProperties() > 0) { + // If the old descriptors had an enum cache (or if {split_map}'s descriptors + // had one), make sure the new ones do too. + if (had_any_enum_cache && new_map->NumberOfEnumerableProperties() > 0) { FastKeyAccumulator::InitializeFastPropertyEnumCache( isolate_, new_map, new_map->NumberOfEnumerableProperties()); }