Commit 63f92a9f authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[turbofan] Fix representation selection of CheckFloat64Hole.

Properly handle the case where the CheckFloat64Hole becomes a
no-op after RETYPE (because the feedback type is already Number).
We always need to pass the Number restriction type here.

Bug: chromium:895199
Change-Id: I96a949ba35db1e6d35abedddc4507c101d95b716
Reviewed-on: https://chromium-review.googlesource.com/c/1278804Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56622}
parent c59c9c46
......@@ -3103,32 +3103,25 @@ class RepresentationSelector {
}
case IrOpcode::kCheckFloat64Hole: {
Type const input_type = TypeOf(node->InputAt(0));
if (input_type.Is(Type::Number())) {
VisitNoop(node, truncation);
} else {
CheckFloat64HoleMode mode =
CheckFloat64HoleParametersOf(node->op()).mode();
switch (mode) {
case CheckFloat64HoleMode::kAllowReturnHole:
if (mode == CheckFloat64HoleMode::kAllowReturnHole) {
// If {mode} is allow-return-hole _and_ the {truncation}
// identifies NaN and undefined, we can just pass along
// the {truncation} and completely wipe the {node}.
if (truncation.IsUnused()) return VisitUnused(node);
if (truncation.IsUsedAsFloat64()) {
VisitUnop(node, UseInfo::TruncatingFloat64(),
MachineRepresentation::kFloat64);
if (lower()) DeferReplacement(node, node->InputAt(0));
} else {
VisitUnop(
node,
UseInfo(MachineRepresentation::kFloat64, Truncation::Any()),
MachineRepresentation::kFloat64, Type::Number());
return;
}
break;
case CheckFloat64HoleMode::kNeverReturnHole:
VisitUnop(
node,
}
VisitUnop(node,
UseInfo(MachineRepresentation::kFloat64, Truncation::Any()),
MachineRepresentation::kFloat64, Type::Number());
break;
}
if (lower() && input_type.Is(Type::Number())) {
DeferReplacement(node, node->InputAt(0));
}
return;
}
......
// 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
function foo() {
var a = new Array(2);
a[0] = 23.1234;
a[1] = 25.1234;
%DeoptimizeNow();
return a[2];
}
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
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