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