1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/ion/bug860838-4.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +function DiagModule(stdlib, foreign) { 1.5 + "use asm"; 1.6 + 1.7 + var sqrt = stdlib.Math.sqrt; 1.8 + var test = foreign.test; 1.9 + var foo = foreign.foo; 1.10 + 1.11 + function square(x) { 1.12 + x = x|0; 1.13 + return ((x|0)+(x|0))|0; 1.14 + } 1.15 + 1.16 + function diag() { 1.17 + var x = 0.0; 1.18 + while(1) { 1.19 + test(1, x); 1.20 + x = x+1.0 1.21 + if (x > 15.0) 1.22 + return 0; 1.23 + } 1.24 + return 0; 1.25 + } 1.26 + 1.27 + function diag_1() { 1.28 + foo(); 1.29 + return 0; 1.30 + } 1.31 + 1.32 + 1.33 + return { diag: diag, diag_1:diag_1 }; 1.34 +} 1.35 + 1.36 +var foreign = { 1.37 + test:function(a,b) { 1.38 + print(a+":"+b) 1.39 + var c = [0.0]; 1.40 + if (b > 10) 1.41 + return c[1]; 1.42 + return c[0]; 1.43 + }, 1.44 + foo:function() { 1.45 + with({}) {}; 1.46 + gc(); 1.47 + } 1.48 +} 1.49 + 1.50 +// make sure foreign is compiled 1.51 + 1.52 +var fast = DiagModule(this, foreign); // produces AOT-compiled version 1.53 +print(fast.diag_1()); // 5 1.54 +gc() 1.55 +print(fast.diag()); // 5 1.56 + 1.57 +