| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Flags: --allow-natives-syntax | |
| 6 | |
| 7 function assertDoubleBits(hi, lo, x) { | |
| 8 hi = hi | 0; | |
| 9 lo = lo | 0; | |
| 10 assertEquals(x, %_ConstructDouble(hi, lo)); | |
| 11 assertEquals(hi, %_DoubleHi(x)); | |
| 12 assertEquals(lo, %_DoubleLo(x)); | |
| 13 assertEquals(x, %_ConstructDouble(%_DoubleHi(x), %_DoubleLo(x))); | |
| 14 } | |
| 15 | |
| 16 | |
| 17 var tests = [0x7ff80000, 0x00000000, NaN, | |
| 18 0x7ff00000, 0x00000000, Infinity, | |
| 19 0xfff00000, 0x00000000, -Infinity, | |
| 20 0x80000000, 0x00000000, -0, | |
| 21 0x400921fb, 0x54442d18, Math.PI, | |
| 22 0xc00921fb, 0x54442d18, -Math.PI, | |
| 23 0x4005bf0a, 0x8b145769, Math.E, | |
| 24 0xc005bf0a, 0x8b145769, -Math.E, | |
| 25 0xbfe80000, 0x00000000, -0.75]; | |
| 26 | |
| 27 | |
| 28 for (var i = 0; i < tests.length; i += 3) { | |
| 29 assertDoubleBits(tests[i], tests[i + 1], tests[i + 2]); | |
| 30 } | |
| 31 | |
| 32 %OptimizeFunctionOnNextCall(assertDoubleBits); | |
| 33 | |
| 34 for (var i = 0; i < tests.length; i += 3) { | |
| 35 assertDoubleBits(tests[i], tests[i + 1], tests[i + 2]); | |
| 36 assertOptimized(assertDoubleBits); | |
| 37 } | |
| OLD | NEW |