diff options
Diffstat (limited to 'deps/v8/test/mjsunit/regress/regress-crbug-905457.js')
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-crbug-905457.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-905457.js b/deps/v8/test/mjsunit/regress/regress-crbug-905457.js new file mode 100644 index 0000000000..3a97a87520 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-905457.js @@ -0,0 +1,49 @@ +// 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() { + function foo(x) { + return Math.abs(Math.min(+x, 0)); + } + + assertEquals(NaN, foo()); + assertEquals(NaN, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(NaN, foo()); +})(); + +(function() { + function foo(x) { + return Math.abs(Math.min(-x, 0)); + } + + assertEquals(NaN, foo()); + assertEquals(NaN, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(NaN, foo()); +})(); + +(function() { + function foo(x) { + return Math.abs(Math.max(0, +x)); + } + + assertEquals(NaN, foo()); + assertEquals(NaN, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(NaN, foo()); +})(); + +(function() { + function foo(x) { + return Math.abs(Math.max(0, -x)); + } + + assertEquals(NaN, foo()); + assertEquals(NaN, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(NaN, foo()); +})(); |