Commit 8161dabd authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[ic] Reorder feedback vector to have deprecated maps at the end

This will allow minimorphic ICs the best chance of succeeding as they
only check the first FLAG_max_minimorphic_map_checks maps in the
feedback vector.

Bug: v8:10582
Change-Id: I1c78dcc8b6f7072b2563fdc8bf69b349a99c4bb5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2400340
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70003}
parent d0805bad
......@@ -574,7 +574,7 @@ bool IC::UpdatePolymorphicIC(Handle<Name> name,
std::vector<MapAndHandler> maps_and_handlers;
maps_and_handlers.reserve(FLAG_max_valid_polymorphic_map_count);
int deprecated_maps = 0;
std::vector<MapAndHandler> deprecated_maps_and_handlers;
int handler_to_overwrite = -1;
{
......@@ -584,13 +584,18 @@ bool IC::UpdatePolymorphicIC(Handle<Name> name,
if (it.handler()->IsCleared()) continue;
MaybeObjectHandle existing_handler = handle(it.handler(), isolate());
Handle<Map> existing_map = handle(it.map(), isolate());
maps_and_handlers.push_back(
MapAndHandler(existing_map, existing_handler));
if (existing_map->is_deprecated()) {
// Filter out deprecated maps to ensure their instances get migrated.
++deprecated_maps;
} else if (map.is_identical_to(existing_map)) {
deprecated_maps_and_handlers.push_back(
MapAndHandler(existing_map, existing_handler));
continue;
}
maps_and_handlers.push_back(
MapAndHandler(existing_map, existing_handler));
if (map.is_identical_to(existing_map)) {
// If both map and handler stayed the same (and the name is also the
// same as checked above, for keyed accesses), we're not progressing
// in the lattice and need to go MEGAMORPHIC instead. There's one
......@@ -612,9 +617,20 @@ bool IC::UpdatePolymorphicIC(Handle<Name> name,
i++;
}
DCHECK_LE(i, maps_and_handlers.size());
}
// Reorder the deprecated maps to be at the end, so that
// minimorphic ICs have the best chance of succeeding as they only
// check the first FLAG_max_minimorphic_map_checks maps.
if (deprecated_maps_and_handlers.size() > 0) {
maps_and_handlers.insert(maps_and_handlers.end(),
deprecated_maps_and_handlers.begin(),
deprecated_maps_and_handlers.end());
}
int number_of_maps = static_cast<int>(maps_and_handlers.size());
int deprecated_maps = static_cast<int>(deprecated_maps_and_handlers.size());
int number_of_valid_maps =
number_of_maps - deprecated_maps - (handler_to_overwrite != -1);
......
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