Commit 3836adc7 authored by Mythri A's avatar Mythri A Committed by Commit Bot

[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: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67060}
parent 12ac859c
...@@ -983,7 +983,7 @@ int FeedbackNexus::ExtractMaps(MapHandles* maps) const { ...@@ -983,7 +983,7 @@ int FeedbackNexus::ExtractMaps(MapHandles* maps) const {
int FeedbackNexus::ExtractMapsAndHandlers( int FeedbackNexus::ExtractMapsAndHandlers(
std::vector<std::pair<Handle<Map>, MaybeObjectHandle>>* maps_and_handlers, std::vector<std::pair<Handle<Map>, MaybeObjectHandle>>* maps_and_handlers,
bool drop_deprecated) const { bool try_update_deprecated) const {
DCHECK(IsLoadICKind(kind()) || DCHECK(IsLoadICKind(kind()) ||
IsStoreICKind(kind()) | IsKeyedLoadICKind(kind()) || IsStoreICKind(kind()) | IsKeyedLoadICKind(kind()) ||
IsKeyedStoreICKind(kind()) || IsStoreOwnICKind(kind()) || IsKeyedStoreICKind(kind()) || IsStoreOwnICKind(kind()) ||
...@@ -1015,10 +1015,13 @@ int FeedbackNexus::ExtractMapsAndHandlers( ...@@ -1015,10 +1015,13 @@ int FeedbackNexus::ExtractMapsAndHandlers(
MaybeObject handler = array.Get(i + 1); MaybeObject handler = array.Get(i + 1);
if (!handler->IsCleared()) { if (!handler->IsCleared()) {
DCHECK(IC::IsHandler(handler)); DCHECK(IC::IsHandler(handler));
Map map = Map::cast(heap_object); Handle<Map> map(Map::cast(heap_object), isolate);
if (drop_deprecated && map.is_deprecated()) continue; if (try_update_deprecated &&
!Map::TryUpdate(isolate, map).ToHandle(&map)) {
continue;
}
maps_and_handlers->push_back( maps_and_handlers->push_back(
MapAndHandler(handle(map, isolate), handle(handler, isolate))); MapAndHandler(map, handle(handler, isolate)));
found++; found++;
} }
} }
...@@ -1028,10 +1031,13 @@ int FeedbackNexus::ExtractMapsAndHandlers( ...@@ -1028,10 +1031,13 @@ int FeedbackNexus::ExtractMapsAndHandlers(
MaybeObject handler = GetFeedbackExtra(); MaybeObject handler = GetFeedbackExtra();
if (!handler->IsCleared()) { if (!handler->IsCleared()) {
DCHECK(IC::IsHandler(handler)); DCHECK(IC::IsHandler(handler));
Map map = Map::cast(heap_object); Handle<Map> map = handle(Map::cast(heap_object), isolate);
if (drop_deprecated && map.is_deprecated()) return 0; if (try_update_deprecated &&
!Map::TryUpdate(isolate, map).ToHandle(&map)) {
return 0;
}
maps_and_handlers->push_back( maps_and_handlers->push_back(
MapAndHandler(handle(map, isolate), handle(handler, isolate))); MapAndHandler(map, handle(handler, isolate)));
return 1; return 1;
} }
} }
......
...@@ -651,7 +651,7 @@ class V8_EXPORT_PRIVATE FeedbackNexus final { ...@@ -651,7 +651,7 @@ class V8_EXPORT_PRIVATE FeedbackNexus final {
int ExtractMaps(MapHandles* maps) const; int ExtractMaps(MapHandles* maps) const;
int ExtractMapsAndHandlers(std::vector<MapAndHandler>* maps_and_handlers, 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; MaybeObjectHandle FindHandlerForMap(Handle<Map> map) const;
bool IsCleared() const { bool IsCleared() const {
......
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