diff options
Diffstat (limited to 'deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js')
-rw-r--r-- | deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js b/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js new file mode 100644 index 00000000000..4dedf4d27c7 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js @@ -0,0 +1,16 @@ +// 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 --harmony-bigint + +function f(x, b) { + if (b) return Math.trunc(+(x)) + else return Math.trunc(Number(x)) +} + +f("1", true); +f("2", true); +f("2", false); +%OptimizeFunctionOnNextCall(f); +f(3n); |