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