Commit 7d5e6b15 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Don't infer receiver map for keyed stores.

This avoids a deopt loop.

Bug: v8:7254
Change-Id: I3a676186bc52fd47b03f03c26cb07d9257993693
Reviewed-on: https://chromium-review.googlesource.com/968503Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52036}
parent b6ecf53b
......@@ -2803,11 +2803,20 @@ bool JSNativeContextSpecialization::ExtractReceiverMaps(
MapHandles* receiver_maps) {
DCHECK_EQ(0, receiver_maps->size());
if (nexus.IsUninitialized()) return true;
// See if we can infer a concrete type for the {receiver}.
if (InferReceiverMaps(receiver, effect, receiver_maps)) {
// We can assume that the {receiver} still has the inferred {receiver_maps}.
return true;
// See if we can infer a concrete type for the {receiver}. Solely relying on
// the inference is not safe for keyed stores, because we would potentially
// miss out on transitions that need to be performed.
{
FeedbackSlotKind kind = nexus.kind();
bool use_inference =
!IsKeyedStoreICKind(kind) && !IsStoreInArrayLiteralICKind(kind);
if (use_inference && InferReceiverMaps(receiver, effect, receiver_maps)) {
// We can assume that {receiver} still has the inferred {receiver_maps}.
return true;
}
}
// Try to extract some maps from the {nexus}.
if (nexus.ExtractMaps(receiver_maps) != 0) {
// Try to filter impossible candidates based on inferred root map.
......@@ -2824,6 +2833,7 @@ bool JSNativeContextSpecialization::ExtractReceiverMaps(
}
return true;
}
return false;
}
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --opt
function foo(a) {
a[0];
a[1] = "";
}
foo([0,0].map(x => x));
foo([0,0].map(x => x));
%OptimizeFunctionOnNextCall(foo);
foo([0,0].map(x => x));
assertOptimized(foo);
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