Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 function DiagModule(stdlib, foreign) {
2 "use asm";
4 var sqrt = stdlib.Math.sqrt;
5 var test = foreign.test;
6 var foo = foreign.foo;
8 function square(x) {
9 x = x|0;
10 return ((x|0)+(x|0))|0;
11 }
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 }
24 function diag_1() {
25 foo();
26 return 0;
27 }
30 return { diag: diag, diag_1:diag_1 };
31 }
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 }
47 // make sure foreign is compiled
49 var fast = DiagModule(this, foreign); // produces AOT-compiled version
50 print(fast.diag_1()); // 5
51 gc()
52 print(fast.diag()); // 5