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