OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var if0 = (function Module() { | 5 var if0 = (function Module() { |
6 "use asm"; | 6 "use asm"; |
7 function if0(i, j) { | 7 function if0(i, j) { |
8 i = i|0; | 8 i = i|0; |
9 j = j|0; | 9 j = j|0; |
10 if (i == 0 ? j == 0 : 0) return 1; | 10 if ((i | 0) == 0 ? (j | 0) == 0 : 0) return 1; |
11 return 0; | 11 return 0; |
12 } | 12 } |
13 return {if0: if0}; | 13 return {if0: if0}; |
14 })().if0; | 14 })().if0; |
15 assertEquals(1, if0(0, 0)); | 15 assertEquals(1, if0(0, 0)); |
16 assertEquals(0, if0(11, 0)); | 16 assertEquals(0, if0(11, 0)); |
17 assertEquals(0, if0(0, -1)); | 17 assertEquals(0, if0(0, -1)); |
18 assertEquals(0, if0(-1024, 1)); | 18 assertEquals(0, if0(-1024, 1)); |
19 | 19 |
20 | 20 |
21 var if1 = (function Module() { | 21 var if1 = (function Module() { |
22 "use asm"; | 22 "use asm"; |
23 function if1(i, j) { | 23 function if1(i, j) { |
24 i = i|0; | 24 i = i|0; |
25 j = j|0; | 25 j = j|0; |
26 if (i == 0 ? j == 0 : 1) return 0; | 26 if ((i | 0) == 0 ? (j | 0) == 0 : 1) return 0; |
27 return 1; | 27 return 1; |
28 } | 28 } |
29 return {if1: if1}; | 29 return {if1: if1}; |
30 })().if1; | 30 })().if1; |
31 assertEquals(0, if1(0, 0)); | 31 assertEquals(0, if1(0, 0)); |
32 assertEquals(0, if1(11, 0)); | 32 assertEquals(0, if1(11, 0)); |
33 assertEquals(1, if1(0, -1)); | 33 assertEquals(1, if1(0, -1)); |
34 assertEquals(0, if1(-1024, 9)); | 34 assertEquals(0, if1(-1024, 9)); |
OLD | NEW |