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 | // rejoining after recompilation from CompileFunction or a native called by an inlined frame. |
michael@0 | 2 | |
michael@0 | 3 | var global = 0; |
michael@0 | 4 | var arr = [ |
michael@0 | 5 | function() { return 0; }, |
michael@0 | 6 | function() { return 1; }, |
michael@0 | 7 | function() { return 2; }, |
michael@0 | 8 | function() { return 3; }, |
michael@0 | 9 | function() { return 4; }, |
michael@0 | 10 | function() { return 5; }, |
michael@0 | 11 | function() { return 6; }, |
michael@0 | 12 | function() { return 7; }, |
michael@0 | 13 | function() { global = -"three"; return 8; } |
michael@0 | 14 | ]; |
michael@0 | 15 | function wrap_call(i) { |
michael@0 | 16 | var fn = arr["" + i]; |
michael@0 | 17 | return fn(); |
michael@0 | 18 | } |
michael@0 | 19 | function foo1() { |
michael@0 | 20 | var res = 0; |
michael@0 | 21 | for (var i = 0; i < arr.length; i++) { |
michael@0 | 22 | res += wrap_call(i); |
michael@0 | 23 | var expected = (i == arr.length - 1) ? NaN : 10; |
michael@0 | 24 | assertEq(global + 10, expected); |
michael@0 | 25 | } |
michael@0 | 26 | } |
michael@0 | 27 | foo1(); |
michael@0 | 28 | |
michael@0 | 29 | var callfn = Function.call; |
michael@0 | 30 | function wrap_floor(x, y) { |
michael@0 | 31 | var z = x; |
michael@0 | 32 | if (y) |
michael@0 | 33 | z = {}; // trick the compiler into not inlining the floor() call. |
michael@0 | 34 | return Math.floor(z); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | function foo2(x, y) { |
michael@0 | 38 | var z = 0; |
michael@0 | 39 | for (var i = 0; i < y; i++) |
michael@0 | 40 | z = wrap_floor(x + i, false); |
michael@0 | 41 | assertEq(z + 10, 2147483661); |
michael@0 | 42 | } |
michael@0 | 43 | foo2(0x7ffffff0 + .5, 20); |