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