bug860838.js (844B)
1 enableOsiPointRegisterChecks(); 2 3 function DiagModule(stdlib, foreign) { 4 "use asm"; 5 6 var sqrt = stdlib.Math.sqrt; 7 var test = foreign.test; 8 9 function square(x) { 10 x = x|0; 11 return ((x|0)+(x|0))|0; 12 } 13 14 function diag() { 15 var x = 0.0; 16 while(1) { 17 test(1, x); 18 x = x+1.0 19 if (x > 15.0) 20 return 0; 21 } 22 return 0; 23 } 24 25 function diag_1() { 26 test(); 27 return 0; 28 } 29 30 31 return { diag: diag, diag_1:diag_1 }; 32 } 33 34 var foreign = { 35 test:function(a,b) { 36 print(a+":"+b) 37 var c = [0.0]; 38 if (b > 10) 39 return c[1]; 40 return c[0]; 41 } 42 } 43 44 // make sure foreign is compiled 45 46 var fast = DiagModule(this, foreign); // produces AOT-compiled version 47 print(fast.diag()); // 5 48 gc() 49 print(fast.diag()); // 5