Commit bfe7f4af authored by jkummerow's avatar jkummerow Committed by Commit bot

Fix HConstant(double, ...) constructor

It must always populate int32_value_, even if that's lossy, because other code (specifically, constant folding for truncating operations) relies on it.

BUG=v8:3865
LOG=y

Review URL: https://codereview.chromium.org/897263002

Cr-Commit-Position: refs/heads/master@{#26453}
parent 8fa3d991
...@@ -2810,7 +2810,7 @@ HConstant::HConstant(double double_value, Representation r, ...@@ -2810,7 +2810,7 @@ HConstant::HConstant(double double_value, Representation r,
!std::isnan(double_value)) | !std::isnan(double_value)) |
IsUndetectableField::encode(false) | IsUndetectableField::encode(false) |
InstanceTypeField::encode(kUnknownInstanceType)), InstanceTypeField::encode(kUnknownInstanceType)),
int32_value_(HasInteger32Value() ? DoubleToInt32(double_value) : 0), int32_value_(DoubleToInt32(double_value)),
double_value_(double_value) { double_value_(double_value) {
bit_field_ = HasSmiValueField::update( bit_field_ = HasSmiValueField::update(
bit_field_, HasInteger32Value() && Smi::IsValid(int32_value_)); bit_field_, HasInteger32Value() && Smi::IsValid(int32_value_));
......
// Copyright 2015 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 bar() {
var radix = 10;
return 21 / radix | 0;
}
assertEquals(2, bar());
assertEquals(2, bar());
%OptimizeFunctionOnNextCall(bar);
assertEquals(2, bar());
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