[ic] Try update deprecated maps when recomputing handlers for keyed store

For keyed stores we recompute handlers when we see a new map so that
we could transition to the most general elements kind we have seen so
far. When recomputing these handlers we drop the deprecated maps.
Instead we could TryUpdate deprecated maps. This would be inline with
what TurboFan does and also may be better for performance.

Bug: chromium:1053939
Change-Id: Id38b60538d56f4b376460c0faece20768a18f25f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2130129
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67060}
This commit is contained in:
Mythri A 2020-04-03 16:30:13 +01:00 committed by Commit Bot
parent 12ac859cf6
commit 3836adc755
2 changed files with 14 additions and 8 deletions

View File

@ -983,7 +983,7 @@ int FeedbackNexus::ExtractMaps(MapHandles* maps) const {
int FeedbackNexus::ExtractMapsAndHandlers(
std::vector<std::pair<Handle<Map>, MaybeObjectHandle>>* maps_and_handlers,
bool drop_deprecated) const {
bool try_update_deprecated) const {
DCHECK(IsLoadICKind(kind()) ||
IsStoreICKind(kind()) | IsKeyedLoadICKind(kind()) ||
IsKeyedStoreICKind(kind()) || IsStoreOwnICKind(kind()) ||
@ -1015,10 +1015,13 @@ int FeedbackNexus::ExtractMapsAndHandlers(
MaybeObject handler = array.Get(i + 1);
if (!handler->IsCleared()) {
DCHECK(IC::IsHandler(handler));
Map map = Map::cast(heap_object);
if (drop_deprecated && map.is_deprecated()) continue;
Handle<Map> map(Map::cast(heap_object), isolate);
if (try_update_deprecated &&
!Map::TryUpdate(isolate, map).ToHandle(&map)) {
continue;
}
maps_and_handlers->push_back(
MapAndHandler(handle(map, isolate), handle(handler, isolate)));
MapAndHandler(map, handle(handler, isolate)));
found++;
}
}
@ -1028,10 +1031,13 @@ int FeedbackNexus::ExtractMapsAndHandlers(
MaybeObject handler = GetFeedbackExtra();
if (!handler->IsCleared()) {
DCHECK(IC::IsHandler(handler));
Map map = Map::cast(heap_object);
if (drop_deprecated && map.is_deprecated()) return 0;
Handle<Map> map = handle(Map::cast(heap_object), isolate);
if (try_update_deprecated &&
!Map::TryUpdate(isolate, map).ToHandle(&map)) {
return 0;
}
maps_and_handlers->push_back(
MapAndHandler(handle(map, isolate), handle(handler, isolate)));
MapAndHandler(map, handle(handler, isolate)));
return 1;
}
}

View File

@ -651,7 +651,7 @@ class V8_EXPORT_PRIVATE FeedbackNexus final {
int ExtractMaps(MapHandles* maps) const;
int ExtractMapsAndHandlers(std::vector<MapAndHandler>* maps_and_handlers,
bool drop_deprecated = false) const;
bool try_update_deprecated = false) const;
MaybeObjectHandle FindHandlerForMap(Handle<Map> map) const;
bool IsCleared() const {