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 | function func1() { return "123" } |
michael@0 | 2 | function func2(a,b,c,d,e) { return "123" } |
michael@0 | 3 | var imp = { func1:func1, func2:func2 }; |
michael@0 | 4 | |
michael@0 | 5 | function FFI1(stdlib, foreign) { |
michael@0 | 6 | "use asm"; |
michael@0 | 7 | |
michael@0 | 8 | var func1 = foreign.func1; |
michael@0 | 9 | var func2 = foreign.func2; |
michael@0 | 10 | |
michael@0 | 11 | function g() { |
michael@0 | 12 | return func1()|0 |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | function h() { |
michael@0 | 16 | return func2()|0 |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | return {g:g, h:h}; |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | var f = FFI1(this, imp); // produces AOT-compiled version |
michael@0 | 23 | |
michael@0 | 24 | assertEq(f.g(), 123); |
michael@0 | 25 | assertEq(f.g(), 123); |
michael@0 | 26 | |
michael@0 | 27 | assertEq(f.h(), 123); |
michael@0 | 28 | assertEq(f.h(), 123); |