Commit 496aecb6 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Fix NumberIsHoleNaN to check the upper word.

The NumberIsHoleNaN operator used to test the lower word of the double
input which is obviously wrong.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2022753002
Cr-Commit-Position: refs/heads/master@{#36584}
parent 20e43a3a
......@@ -1091,14 +1091,14 @@ class RepresentationSelector {
VisitUnop(node, UseInfo::TruncatingFloat64(),
MachineRepresentation::kBit);
if (lower()) {
// NumberIsHoleNaN(x) => Word32Equal(Float64ExtractLowWord32(x),
// #HoleNaNLower32)
node->ReplaceInput(0,
jsgraph_->graph()->NewNode(
lowering->machine()->Float64ExtractLowWord32(),
node->InputAt(0)));
// NumberIsHoleNaN(x) => Word32Equal(Float64ExtractHighWord32(x),
// #HoleNanUpper32)
node->ReplaceInput(
0, jsgraph_->graph()->NewNode(
lowering->machine()->Float64ExtractHighWord32(),
node->InputAt(0)));
node->AppendInput(jsgraph_->zone(),
jsgraph_->Int32Constant(kHoleNanLower32));
jsgraph_->Int32Constant(kHoleNanUpper32));
NodeProperties::ChangeOp(node, jsgraph_->machine()->Word32Equal());
}
break;
......
// Copyright 2016 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
var a = [, 2.121736758e-314];
function foo() { return a[1]; }
assertEquals(2.121736758e-314, foo());
assertEquals(2.121736758e-314, foo());
%OptimizeFunctionOnNextCall(foo);
assertEquals(2.121736758e-314, 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