OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 var a = new Float64Array(4); |
| 8 a[2] *= -1; |
| 9 a[3] *= -1; |
| 10 assertEquals(0, a[0]); |
| 11 assertEquals(0, a[1]); |
| 12 assertEquals(-0, a[2]); |
| 13 assertEquals(-0, a[3]); |
| 14 |
| 15 function f1() { |
| 16 var z = a[0]; |
| 17 // Same register. |
| 18 assertEquals(0, Math.min(z, z)); |
| 19 } |
| 20 |
| 21 function f2() { |
| 22 // Different registers. |
| 23 assertEquals(0, Math.min(a[0], a[1])); |
| 24 } |
| 25 |
| 26 function f3() { |
| 27 // Zero and minus zero. |
| 28 assertEquals(-0, Math.min(a[1], a[2])); |
| 29 } |
| 30 |
| 31 function f4() { |
| 32 // Zero and minus zero, reversed order. |
| 33 assertEquals(-0, Math.min(a[2], a[1])); |
| 34 } |
| 35 |
| 36 function f5() { |
| 37 // Minus zero, same register. |
| 38 var m_z = a[2]; |
| 39 assertEquals(-0, Math.min(m_z, m_z)); |
| 40 } |
| 41 |
| 42 function f6() { |
| 43 // Minus zero, different registers. |
| 44 assertEquals(-0, Math.min(a[2], a[3])); |
| 45 } |
| 46 |
| 47 for (var i = 0; i < 3; i++) { |
| 48 f1(); |
| 49 f2(); |
| 50 f3(); |
| 51 f4(); |
| 52 f5(); |
| 53 f6(); |
| 54 } |
| 55 %OptimizeFunctionOnNextCall(f1); |
| 56 %OptimizeFunctionOnNextCall(f2); |
| 57 %OptimizeFunctionOnNextCall(f3); |
| 58 %OptimizeFunctionOnNextCall(f4); |
| 59 %OptimizeFunctionOnNextCall(f5); |
| 60 %OptimizeFunctionOnNextCall(f6); |
| 61 f1(); |
| 62 f2(); |
| 63 f3(); |
| 64 f4(); |
| 65 f5(); |
| 66 f6(); |
OLD | NEW |