18e9cece40
This adjusts parsing of negative numbers in UnaryExpression and MultiplicativeExpression to return double if the token is -0. R=clemensb@chromium.org TEST=mjsunit/regress/regress-6838-4 BUG=v8:6838 Change-Id: I6c2113b520c3831f4a5101f0a963f49c1eb9d7d7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2007272 Reviewed-by: Clemens Backes <clemensb@chromium.org> Commit-Queue: Emanuel Ziegler <ecmziegler@chromium.org> Cr-Commit-Position: refs/heads/master@{#65862}
80 lines
1.6 KiB
JavaScript
80 lines
1.6 KiB
JavaScript
// Copyright 2020 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 TestMinusZeroIsDouble() {
|
|
function Module(stdlib) {
|
|
'use asm';
|
|
function f() {
|
|
var x = 0.;
|
|
x = 1. / +-0;
|
|
return +x;
|
|
}
|
|
return f;
|
|
}
|
|
var f = Module(this);
|
|
assertEquals(-Infinity, f());
|
|
assertTrue(%IsAsmWasmCode(Module));
|
|
})();
|
|
|
|
(function TestMinusZeroIsDoubleBracketed() {
|
|
function Module(stdlib) {
|
|
'use asm';
|
|
function f() {
|
|
var x = 0.;
|
|
x = 1. / (-0);
|
|
return +x;
|
|
}
|
|
return f;
|
|
}
|
|
var f = Module(this);
|
|
assertEquals(-Infinity, f());
|
|
assertTrue(%IsAsmWasmCode(Module));
|
|
})();
|
|
|
|
(function TestMinusZeroIsDoubleMultDouble1() {
|
|
function Module(stdlib) {
|
|
'use asm';
|
|
function f() {
|
|
var x = 0.;
|
|
x = 1. / (-0 * 1.0);
|
|
return +x;
|
|
}
|
|
return f;
|
|
}
|
|
var f = Module(this);
|
|
assertEquals(-Infinity, f());
|
|
assertTrue(%IsAsmWasmCode(Module));
|
|
})();
|
|
|
|
(function TestMinusZeroIsDoubleMultDouble2() {
|
|
function Module(stdlib) {
|
|
'use asm';
|
|
function f() {
|
|
var x = 0.;
|
|
x = 1. / (1.0 * -0);
|
|
return +x;
|
|
}
|
|
return f;
|
|
}
|
|
var f = Module(this);
|
|
assertEquals(-Infinity, f());
|
|
assertTrue(%IsAsmWasmCode(Module));
|
|
})();
|
|
|
|
(function TestMinusZeroIsDoubleMultInt() {
|
|
function Module(stdlib) {
|
|
'use asm';
|
|
function f() {
|
|
var x = 0.;
|
|
x = 1. / (-0 * 1);
|
|
return +x;
|
|
}
|
|
return f;
|
|
}
|
|
var f = Module(this);
|
|
assertFalse(%IsAsmWasmCode(Module));
|
|
})();
|