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 | |
michael@0 | 2 | /* Handle recompilation on overflow of inc/dec operations. */ |
michael@0 | 3 | |
michael@0 | 4 | function local() |
michael@0 | 5 | { |
michael@0 | 6 | var j = 0x7ffffff0; |
michael@0 | 7 | for (var i = 0; i < 100; i++) |
michael@0 | 8 | j++; |
michael@0 | 9 | assertEq(j, 2147483732); |
michael@0 | 10 | } |
michael@0 | 11 | local(); |
michael@0 | 12 | |
michael@0 | 13 | function olocal() |
michael@0 | 14 | { |
michael@0 | 15 | var j = 0x7ffffff0; |
michael@0 | 16 | for (var i = 0; i < 100; i++) { |
michael@0 | 17 | if (j++ == 5000) |
michael@0 | 18 | break; |
michael@0 | 19 | } |
michael@0 | 20 | assertEq(j, 2147483732); |
michael@0 | 21 | } |
michael@0 | 22 | olocal(); |
michael@0 | 23 | |
michael@0 | 24 | function arg(j) |
michael@0 | 25 | { |
michael@0 | 26 | for (var i = 0; i < 100; i++) |
michael@0 | 27 | j++; |
michael@0 | 28 | assertEq(j, 2147483732); |
michael@0 | 29 | } |
michael@0 | 30 | arg(0x7ffffff0); |
michael@0 | 31 | |
michael@0 | 32 | function oarg(j) |
michael@0 | 33 | { |
michael@0 | 34 | for (var i = 0; i < 100; i++) { |
michael@0 | 35 | if (j++ == 5000) |
michael@0 | 36 | break; |
michael@0 | 37 | } |
michael@0 | 38 | assertEq(j, 2147483732); |
michael@0 | 39 | } |
michael@0 | 40 | oarg(0x7ffffff0); |
michael@0 | 41 | |
michael@0 | 42 | // basic global inc/dec correctness |
michael@0 | 43 | var x = 1.23; |
michael@0 | 44 | x = x--; |
michael@0 | 45 | x = x++; |
michael@0 | 46 | x = ++x; |
michael@0 | 47 | x = --x; |
michael@0 | 48 | assertEq(x, 1.23); |
michael@0 | 49 | |
michael@0 | 50 | var g = 0x7ffffff0; |
michael@0 | 51 | function glob() |
michael@0 | 52 | { |
michael@0 | 53 | for (var i = 0; i < 100; i++) |
michael@0 | 54 | g++; |
michael@0 | 55 | assertEq(g, 2147483732); |
michael@0 | 56 | } |
michael@0 | 57 | glob(); |
michael@0 | 58 | |
michael@0 | 59 | function gname() |
michael@0 | 60 | { |
michael@0 | 61 | n = 0x7ffffff0; |
michael@0 | 62 | for (var i = 0; i < 100; i++) |
michael@0 | 63 | n++; |
michael@0 | 64 | assertEq(n, 2147483732); |
michael@0 | 65 | } |
michael@0 | 66 | gname(); |
michael@0 | 67 | |
michael@0 | 68 | function prop() |
michael@0 | 69 | { |
michael@0 | 70 | var v = {f: 0x7ffffff0}; |
michael@0 | 71 | for (var i = 0; i < 100; i++) |
michael@0 | 72 | v.f++; |
michael@0 | 73 | assertEq(v.f, 2147483732); |
michael@0 | 74 | } |
michael@0 | 75 | prop(); |
michael@0 | 76 | |
michael@0 | 77 | function elem(v, f) |
michael@0 | 78 | { |
michael@0 | 79 | for (var i = 0; i < 100; i++) |
michael@0 | 80 | v[f]++; |
michael@0 | 81 | assertEq(v.f, 2147483732); |
michael@0 | 82 | } |
michael@0 | 83 | elem({f: 0x7ffffff0}, "f"); |
michael@0 | 84 | |
michael@0 | 85 | function name() |
michael@0 | 86 | { |
michael@0 | 87 | var v = 0x7ffffff0; |
michael@0 | 88 | var i; |
michael@0 | 89 | eval("for (i = 0; i < 100; i++) v++"); |
michael@0 | 90 | assertEq(v + 10, 2147483742); |
michael@0 | 91 | } |
michael@0 | 92 | name(); |