[maglev] Insert and keep track of empty unstable map sets

They do have a meaning as well: there are no unstable maps. When we need
to clear unstable maps (and drop related stable maps), we can avoid
doing this for empty unstable map sets since no unstable maps can have
transitioned to new stable maps.

Bug: v8:7700
Change-Id: Ie74f62b6bff81dff8118a46e22a2ea81550d09c4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3981278
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83929}
This commit is contained in:
Toon Verwaest 2022-10-26 12:15:01 +02:00 committed by V8 LUCI CQ
parent b835d86cd4
commit f51fa7ddd8
2 changed files with 10 additions and 4 deletions

View File

@ -1333,7 +1333,9 @@ void MaglevGraphBuilder::BuildCheckMaps(
if (std::find(maps.begin(), maps.end(), constant_map) != maps.end()) {
if (constant_map.is_stable()) {
ZoneHandleSet<Map> stable_maps(constant_map.object());
ZoneHandleSet<Map> unstable_maps;
known_node_aspects().stable_maps.emplace(object, stable_maps);
known_node_aspects().unstable_maps.emplace(object, unstable_maps);
broker()->dependencies()->DependOnStableMap(constant_map);
return;
}

View File

@ -852,11 +852,15 @@ class MaglevGraphBuilder {
// we can no longer assume that objects with unstable maps still have the
// same map. Unstable maps can also transition to stable ones, so the
// set of stable maps becomes invalid for a not that had a unstable map.
for (auto it = known_node_aspects().unstable_maps.begin();
it != known_node_aspects().unstable_maps.end(); it++) {
known_node_aspects().stable_maps.erase(it->first);
auto it = known_node_aspects().unstable_maps.begin();
while (it != known_node_aspects().unstable_maps.end()) {
if (it->second.size() == 0) {
it++;
} else {
known_node_aspects().stable_maps.erase(it->first);
it = known_node_aspects().unstable_maps.erase(it);
}
}
known_node_aspects().unstable_maps.clear();
// Similarly, side-effects can change object contents, so we have to clear
// our known loaded properties -- however, constant properties are known
// to not change (and we added a dependency on this), so we don't have to