Skip to content
forked from v8/v8

Commit

Permalink
[runtime] Recreate enum cache on map update
Browse files Browse the repository at this point in the history
If we had one before, we probably want one after too.

Bug: chromium:1470668
Change-Id: Ib83f7b9549b5686a16d35dd7114bf88b12d0a3a0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4771019
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89488}
  • Loading branch information
LeszekSwirski authored and V8 LUCI CQ committed Aug 11, 2023
1 parent 610c197 commit 1c623f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/objects/map-updater.cc
Expand Up @@ -12,6 +12,7 @@
#include "src/handles/handles.h"
#include "src/heap/parked-scope-inl.h"
#include "src/objects/field-type.h"
#include "src/objects/keys.h"
#include "src/objects/objects-inl.h"
#include "src/objects/objects.h"
#include "src/objects/property-details.h"
Expand Down Expand Up @@ -1038,6 +1039,12 @@ MapUpdater::State MapUpdater::ConstructNewMap() {
// 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) {
FastKeyAccumulator::InitializeFastPropertyEnumCache(
isolate_, new_map, new_map->NumberOfEnumerableProperties());
}

if (has_integrity_level_transition_) {
target_map_ = new_map;
state_ = kAtIntegrityLevelSource;
Expand Down

0 comments on commit 1c623f9

Please sign in to comment.