Index: test/mjsunit/asm/if-folding.js |
diff --git a/test/mjsunit/asm/if-folding.js b/test/mjsunit/asm/if-folding.js |
index 80070ee6eeb434c0a62530e7457af85938ce3fb9..e0017e2d12898a7f0300fb085877a1010096c883 100644 |
--- a/test/mjsunit/asm/if-folding.js |
+++ b/test/mjsunit/asm/if-folding.js |
@@ -18,41 +18,55 @@ function Module() { |
function if2() { |
if (0) return 15; |
else return 16; |
+ return 0; // needed for validation |
} |
function if3() { |
if (1) return 17; |
else return 18; |
+ return 0; // needed for validation |
} |
function if4() { |
- return 1 ? 19 : 20; |
+ return (1 ? 19 : 20) | 0; |
} |
function if5() { |
- return 0 ? 21 : 22; |
+ return (0 ? 21 : 22) | 0; |
} |
function if6() { |
- var x = 0 ? 23 : 24; |
- return x; |
+ var x = 0; |
+ x = 0 ? 23 : 24; |
+ return x | 0; |
} |
function if7() { |
- if (0) { var x = 0 ? 25 : 26; } |
- else { var x = 0 ? 27 : 28; } |
- return x; |
+ var x = 0; |
+ if (0) { |
+ x = 0 ? 25 : 26; |
+ } else { |
+ x = 0 ? 27 : 28; |
+ } |
+ return x | 0; |
} |
function if8() { |
+ var x = 0; |
if (0) { |
- if (0) { var x = 0 ? 29 : 30; } |
- else { var x = 0 ? 31 : 32; } |
+ if (0) { |
+ x = 0 ? 29 : 30; |
+ } else { |
+ x = 0 ? 31 : 32; |
+ } |
} else { |
- if (0) { var x = 0 ? 33 : 34; } |
- else { var x = 0 ? 35 : 36; } |
+ if (0) { |
+ x = 0 ? 33 : 34; |
+ } else { |
+ x = 0 ? 35 : 36; |
+ } |
} |
- return x; |
+ return x | 0; |
} |
return {if0: if0, if1: if1, if2: if2, if3: if3, if4: if4, if5: if5, if6: if6, if7: if7, if8: if8 }; |
@@ -70,25 +84,33 @@ assertEquals(28, m.if7()); |
assertEquals(36, m.if8()); |
-function Spec(a,b,c) { |
+function Spec0(stdlib, foreign, heap) { |
"use asm"; |
- var xx = a | 0; |
- var yy = b | 0; |
- var zz = c | 0; |
+ var xx = foreign.a | 0; |
+ var yy = foreign.b | 0; |
+ var zz = foreign.c | 0; |
function f() { |
+ var x = 0; |
if (xx) { |
- if (yy) { var x = zz ? 29 : 30; } |
- else { var x = zz ? 31 : 32; } |
+ if (yy) { |
+ x = zz ? 29 : 30; |
+ } else { |
+ x = zz ? 31 : 32; |
+ } |
} else { |
- if (yy) { var x = zz ? 33 : 34; } |
- else { var x = zz ? 35 : 36; } |
+ if (yy) { |
+ x = zz ? 33 : 34; |
+ } else { |
+ x = zz ? 35 : 36; |
+ } |
} |
- return x; |
+ return x | 0; |
} |
return {f: f}; |
} |
+var Spec = (a, b, c) => Spec0(this, {a: a, b: b, c: c}); |
assertEquals(36, Spec(0,0,0).f()); |
assertEquals(35, Spec(0,0,1).f()); |