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 function Module() { |
| 6 "use asm"; |
| 7 |
| 8 function if0() { |
| 9 if (0) return 11; |
| 10 return 12; |
| 11 } |
| 12 |
| 13 function if1() { |
| 14 if (1) return 13; |
| 15 return 14; |
| 16 } |
| 17 |
| 18 function if2() { |
| 19 if (0) return 15; |
| 20 else return 16; |
| 21 } |
| 22 |
| 23 function if3() { |
| 24 if (1) return 17; |
| 25 else return 18; |
| 26 } |
| 27 |
| 28 function if4() { |
| 29 return 1 ? 19 : 20; |
| 30 } |
| 31 |
| 32 function if5() { |
| 33 return 0 ? 21 : 22; |
| 34 } |
| 35 |
| 36 function if6() { |
| 37 var x = 0 ? 23 : 24; |
| 38 return x; |
| 39 } |
| 40 |
| 41 function if7() { |
| 42 if (0) { var x = 0 ? 25 : 26; } |
| 43 else { var x = 0 ? 27 : 28; } |
| 44 return x; |
| 45 } |
| 46 |
| 47 function if8() { |
| 48 if (0) { |
| 49 if (0) { var x = 0 ? 29 : 30; } |
| 50 else { var x = 0 ? 31 : 32; } |
| 51 } else { |
| 52 if (0) { var x = 0 ? 33 : 34; } |
| 53 else { var x = 0 ? 35 : 36; } |
| 54 } |
| 55 return x; |
| 56 } |
| 57 |
| 58 return {if0: if0, if1: if1, if2: if2, if3: if3, if4: if4, if5: if5, if6: if6,
if7: if7, if8: if8 }; |
| 59 } |
| 60 |
| 61 var m = Module(); |
| 62 assertEquals(12, m.if0()); |
| 63 assertEquals(13, m.if1()); |
| 64 assertEquals(16, m.if2()); |
| 65 assertEquals(17, m.if3()); |
| 66 assertEquals(19, m.if4()); |
| 67 assertEquals(22, m.if5()); |
| 68 assertEquals(24, m.if6()); |
| 69 assertEquals(28, m.if7()); |
| 70 assertEquals(36, m.if8()); |
| 71 |
| 72 |
| 73 function Spec(a,b,c) { |
| 74 "use asm"; |
| 75 |
| 76 var xx = a | 0; |
| 77 var yy = b | 0; |
| 78 var zz = c | 0; |
| 79 |
| 80 function f() { |
| 81 if (xx) { |
| 82 if (yy) { var x = zz ? 29 : 30; } |
| 83 else { var x = zz ? 31 : 32; } |
| 84 } else { |
| 85 if (yy) { var x = zz ? 33 : 34; } |
| 86 else { var x = zz ? 35 : 36; } |
| 87 } |
| 88 return x; |
| 89 } |
| 90 return {f: f}; |
| 91 } |
| 92 |
| 93 assertEquals(36, Spec(0,0,0).f()); |
| 94 assertEquals(35, Spec(0,0,1).f()); |
| 95 assertEquals(34, Spec(0,1,0).f()); |
| 96 assertEquals(33, Spec(0,1,1).f()); |
| 97 assertEquals(32, Spec(1,0,0).f()); |
| 98 assertEquals(31, Spec(1,0,1).f()); |
| 99 assertEquals(30, Spec(1,1,0).f()); |
| 100 assertEquals(29, Spec(1,1,1).f()); |
OLD | NEW |