Chromium Code Reviews| Index: test/mjsunit/double-intrinsics.js |
| diff --git a/test/mjsunit/double-intrinsics.js b/test/mjsunit/double-intrinsics.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8fdb42d0e8e6cdd8390ad5503743939299f75eb8 |
| --- /dev/null |
| +++ b/test/mjsunit/double-intrinsics.js |
| @@ -0,0 +1,32 @@ |
| +// Copyright 2014 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 assertDoubleBits(hi, lo, x) { |
| + hi = hi | 0; |
| + lo = lo | 0; |
| + assertEquals(x, %_ConstructDouble(hi, lo)); |
| + assertEquals(hi, %_DoubleHi(x)); |
| + assertEquals(lo, %_DoubleLo(x)); |
| + assertEquals(x, %_ConstructDouble(%_DoubleHi(x), %_DoubleLo(x))); |
| +} |
| + |
| +function test() { |
| + assertDoubleBits(0x7ff80000, 0x00000000, NaN); |
| + assertDoubleBits(0x7ff00000, 0x00000000, Infinity); |
| + assertDoubleBits(0xfff00000, 0x00000000, -Infinity); |
| + assertDoubleBits(0x80000000, 0x00000000, -0); |
| + assertDoubleBits(0x400921fb, 0x54442d18, Math.PI); |
| + assertDoubleBits(0xc00921fb, 0x54442d18, -Math.PI); |
| + assertDoubleBits(0x4005bf0a, 0x8b145769, Math.E); |
| + assertDoubleBits(0xc005bf0a, 0x8b145769, -Math.E); |
| + assertDoubleBits(0xbfe80000, 0x00000000, -0.75); |
| +} |
| + |
| +test(); |
| +test(); |
| +%OptimizeFunctionOnNextCall(test); |
|
Sven Panne
2014/03/05 08:00:52
Hmmm, this relies on inlining heuristics, otherwis
|
| +test(); |
| +assertOptimized(test); |