js/src/jit-test/tests/ion/bug860838-4.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial