diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/jit-test/tests/jaeger | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/jaeger')
427 files changed, 6836 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/jaeger/argumentsOptimize-1.js b/js/src/jit-test/tests/jaeger/argumentsOptimize-1.js new file mode 100644 index 0000000000..6ee2c6af14 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/argumentsOptimize-1.js @@ -0,0 +1,14 @@ + +function bar() { + foo.arguments.length = 10; +} + +function foo(x) { + var a = arguments; + var n = 0; + bar(); + assertEq(x, 5); + assertEq(a.length, 1); +} + +foo(5); diff --git a/js/src/jit-test/tests/jaeger/argumentsOptimize-2.js b/js/src/jit-test/tests/jaeger/argumentsOptimize-2.js new file mode 100644 index 0000000000..e7b1b9bd2a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/argumentsOptimize-2.js @@ -0,0 +1,27 @@ + +function foo() { + var x = 0; + for (var i = arguments.length - 1; i >= 0; i--) + x += arguments[i]; + return x; +} + +function bar() { + var x = 0; + for (var i = 0; i < arguments.length; i++) + x += arguments[i]; + return x; +} + +function baz(a,b,c,d,e) { + var x = 0; + for (var i = 0; i < arguments.length; i++) + x += arguments[i]; + return x; +} + +for (var i = 0; i < 10; i++) { + assertEq(foo(1,2,3,4,5), 15); + assertEq(bar(1,2.5,true,{valueOf:function() { return 10}},"five"), "14.5five"); + assertEq(baz(1,2,3,4,5), 15); +} diff --git a/js/src/jit-test/tests/jaeger/bug549393-1.js b/js/src/jit-test/tests/jaeger/bug549393-1.js new file mode 100644 index 0000000000..817d1255b7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug549393-1.js @@ -0,0 +1,43 @@ +// |jit-test| error: TypeError +function start() { + MAX_TOTAL_TIME = startTime = new Date + do { + if (rnd(0)) return (a[rnd()])() + lastTime = new Date + } while ( lastTime - startTime < MAX_TOTAL_TIME ) +} +function MersenneTwister19937() { + this.init_genrand = function() { + for (mti = 1; mti < 4; mti++) { + Array[mti] = 1 + } + }; + this.genrand_int32_t = function() { + if (mti > 4) { + mti = 0 + } + return Array[mti++]; + } +} (function() { + fuzzMT = new MersenneTwister19937; + fuzzMT.init_genrand() + rnd = function() { + return Math.floor(fuzzMT.genrand_int32()) + } +} ()) +function weighted(wa) { + a = [] + for (i = 0; i < wa.length; ++i) { + for (var j = 0; j < 8; ++j) { + a.push(wa[i].fun) + } + } +} +statementMakers = weighted([{ + fun: function makeMixedTypeArray() { [[, , , , , , , , , , , , , , , , , , , +, , , , , ""][(a[rnd()])()]]} +}]) +start() + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug549393-2.js b/js/src/jit-test/tests/jaeger/bug549393-2.js new file mode 100644 index 0000000000..6c902ca179 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug549393-2.js @@ -0,0 +1,10 @@ +(function () { + for (var q = 0; q < 6; ++q) { + x: (function () { + var m = (function () {})() + })([0, , 0, 0, 0, , 0, 0, 0, , 0, 0, 0, , 0, 0, 0, 0, 0, 0, Number(1)]) + } +})() + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug549396.js b/js/src/jit-test/tests/jaeger/bug549396.js new file mode 100644 index 0000000000..f0d61475b7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug549396.js @@ -0,0 +1 @@ +x = this.__defineSetter__("x", function(z) { return function() { z }; }) diff --git a/js/src/jit-test/tests/jaeger/bug549398.js b/js/src/jit-test/tests/jaeger/bug549398.js new file mode 100644 index 0000000000..7e18e43d77 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug549398.js @@ -0,0 +1,10 @@ +(function () { + eval("\ + for(var z = 0 ; z < 2 ; ++z) {\ + this\ + }\ + ", ([1,2,3])) +})() + +/* Don't crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug549521.js b/js/src/jit-test/tests/jaeger/bug549521.js new file mode 100644 index 0000000000..f7eeee8fae --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug549521.js @@ -0,0 +1,13 @@ +function f(y) { + if (y) + return; + { + let x; + for (;;) {} + } +} + + +/* Don't assert. */ +f(1); + diff --git a/js/src/jit-test/tests/jaeger/bug549602.js b/js/src/jit-test/tests/jaeger/bug549602.js new file mode 100644 index 0000000000..11797bd3b4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug549602.js @@ -0,0 +1,30 @@ +function f1(code) { + var c + var t = code.replace(/s/, "") + var f = new Function(code) + var o + e = v = f2(f, c) +} +function f2(f, e) { + try { + a = f() + } catch(r) { + var r = g() + } +} +g1 = [{ + text: "(function sum_slicing(array){return array==0?0:a+sum_slicing(array.slice(1))})", + test: function (f) { + f([, 2]) == "" + } +}]; +(function () { + for (var i = 0; i < g1.length; ++i) { + var a = g1[i] + var text = a.text + var f = eval(text.replace(/@/, "")) + if (a.test(f)) {} + } +}()) +f1("for(let a=0;a<6;a++){print([\"\"].some(function(){false>\"\"}))}") + diff --git a/js/src/jit-test/tests/jaeger/bug549603.js b/js/src/jit-test/tests/jaeger/bug549603.js new file mode 100644 index 0000000000..5d5dea67d7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug549603.js @@ -0,0 +1,3 @@ +// |jit-test| error: ReferenceError +x ? o : [] && x + diff --git a/js/src/jit-test/tests/jaeger/bug550490.js b/js/src/jit-test/tests/jaeger/bug550490.js new file mode 100644 index 0000000000..f4348067c8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug550490.js @@ -0,0 +1,14 @@ + +function a() { + function f() {} + this.d = function() { + f + } +} (function() { + var a2, x + a2 = new a; + d = (function(){x * 1})(); +})() + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug551603.js b/js/src/jit-test/tests/jaeger/bug551603.js new file mode 100644 index 0000000000..019408e270 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug551603.js @@ -0,0 +1,8 @@ +(function() { + ((function f(a) { + if (a > 0) { + f(a - 1) + } + })(6)) +})() + diff --git a/js/src/jit-test/tests/jaeger/bug553784.js b/js/src/jit-test/tests/jaeger/bug553784.js new file mode 100644 index 0000000000..85a298f4b1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug553784.js @@ -0,0 +1,18 @@ +// |jit-test| allow-oom +(function(){ + (x)=[1,2,3] +})() +try{ + (function(){ + ((function a(aaaaaa,bbbbbb){ + if(aaaaaa.length==bbbbbb){ + return eval%bbbbbb.valueOf() + } + cccccc=a(aaaaaa,bbbbbb+1) + return cccccc._=x + })([,,,,,,,,,,,,,,,,,,0],0)) + })() +}catch(e){} + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug554580-3.js b/js/src/jit-test/tests/jaeger/bug554580-3.js new file mode 100644 index 0000000000..7728e5adf7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug554580-3.js @@ -0,0 +1,11 @@ +// |jit-test| error: TypeError +Function("\n\ + for (a = 0; a < 3; a++) {\n\ + if (a == 0) {} else {\n\ + this.__defineSetter__(\"\",1)\n\ + }\n\ + }\n\ +")() + +/* Don't crash/assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug554580-5.js b/js/src/jit-test/tests/jaeger/bug554580-5.js new file mode 100644 index 0000000000..1d3ee522b0 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug554580-5.js @@ -0,0 +1,20 @@ +(function() { + (function g(m, n) { + if (m = n) { + return eval("x=this") + } + g(m, 1)[[]] + })() +})() +Function("\ + for (let b in [0]) {\ + for (var k = 0; k < 6; ++k) {\ + if (k == 1) {\ + print(x)\ + }\ + }\ + }\ +")() + +/* Don't crash/assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug554651.js b/js/src/jit-test/tests/jaeger/bug554651.js new file mode 100644 index 0000000000..23be34d793 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug554651.js @@ -0,0 +1,15 @@ +// |jit-test| error: InternalError +(function() { + try { + (Function("this.__defineGetter__(\"x\",(Function(\"for(z=0;z<6;z++)(x)\")))"))() + } catch(e) {} +})() +((function f(d, aaaaaa) { + if (bbbbbb = aaaaaa) { + x + } + f(bbbbbb, aaaaaa + 1) +})([], 0)) + +/* Don't assert (32-bit mac only, relies on very specific stack usage). */ + diff --git a/js/src/jit-test/tests/jaeger/bug554675-1.js b/js/src/jit-test/tests/jaeger/bug554675-1.js new file mode 100644 index 0000000000..2dcbae8113 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug554675-1.js @@ -0,0 +1,8 @@ +(function() { + for (e in [0, 0]) { + if (/x/ < this) {} + } +})() + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug555155.js b/js/src/jit-test/tests/jaeger/bug555155.js new file mode 100644 index 0000000000..db7b57aa1b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug555155.js @@ -0,0 +1,12 @@ +// |jit-test| error: undefined +(function() { + throw (function f(a, b) { + if (a.h == b) { + return eval("((function(){return 1})())!=this") + } + f(b) + })([], 0) +})() + +/* Don't assert/crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug555206.js b/js/src/jit-test/tests/jaeger/bug555206.js new file mode 100644 index 0000000000..e99eb75606 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug555206.js @@ -0,0 +1,4 @@ +// |jit-test| error: TypeError +__defineGetter__("x", function() { return /a/.exec(undefined); } ); +" ".replace(/\s/,""); +x.b diff --git a/js/src/jit-test/tests/jaeger/bug557070.js b/js/src/jit-test/tests/jaeger/bug557070.js new file mode 100644 index 0000000000..a3e08cc910 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug557070.js @@ -0,0 +1,6 @@ +// |jit-test| error: InternalError + +for (e in (function x() { [eval()].some(x) } ())); + +/* Don't crash or assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug557075.js b/js/src/jit-test/tests/jaeger/bug557075.js new file mode 100644 index 0000000000..264924a157 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug557075.js @@ -0,0 +1,8 @@ +// |jit-test| error: TypeError + +for (l in [Math.h.h.h.h.h.I.h.h.h.h.h.h.h.I.h.I]) { + t.x +} + +/* Don't crash or assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug560221.js b/js/src/jit-test/tests/jaeger/bug560221.js new file mode 100644 index 0000000000..4cba9500dd --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug560221.js @@ -0,0 +1,13 @@ +try { + (function() { + (Object.defineProperty(this, "x", ({ + set: function() {} + }))) + })() +} catch(e) {} +for (var a = 0; a < 4; a++) { + x = 7 +} + +/* Don't bogus assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug563000/eif-call-newvar.js b/js/src/jit-test/tests/jaeger/bug563000/eif-call-newvar.js new file mode 100644 index 0000000000..635b5bb99f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug563000/eif-call-newvar.js @@ -0,0 +1,12 @@ +load(libdir + "evalInFrame.js"); + +function callee() { + evalInFrame(1, "var x = 'success'"); +} +function caller(code) { + eval(code); + callee(); + return x; +} +assertEq(caller('var y = "ignominy"'), "success"); +assertEq(typeof x, "undefined"); diff --git a/js/src/jit-test/tests/jaeger/bug563000/eif-call-typechange.js b/js/src/jit-test/tests/jaeger/bug563000/eif-call-typechange.js new file mode 100644 index 0000000000..486659a336 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug563000/eif-call-typechange.js @@ -0,0 +1,11 @@ +load(libdir + "evalInFrame.js"); + +function callee() { + evalInFrame(1, "x = 'success'"); +} +function caller() { + var x = ({ dana : "zuul" }); + callee(); + return x; +} +assertEq(caller(), "success"); diff --git a/js/src/jit-test/tests/jaeger/bug563000/eif-call.js b/js/src/jit-test/tests/jaeger/bug563000/eif-call.js new file mode 100644 index 0000000000..eff548c8b5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug563000/eif-call.js @@ -0,0 +1,11 @@ +load(libdir + "evalInFrame.js"); + +function callee() { + evalInFrame(1, "x = 'success'"); +} +function caller() { + var x = "failure"; + callee(); + return x; +} +assertEq(caller(), "success"); diff --git a/js/src/jit-test/tests/jaeger/bug563000/eif-getter-newvar.js b/js/src/jit-test/tests/jaeger/bug563000/eif-getter-newvar.js new file mode 100644 index 0000000000..87e6923401 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug563000/eif-getter-newvar.js @@ -0,0 +1,9 @@ +load(libdir + "evalInFrame.js"); + +this.__defineGetter__("someProperty", function () { evalInFrame(1, "var x = 'success'"); }); +function caller(obj) { + var x = 'ignominy'; + obj.someProperty; + return x; +} +assertEq(caller(this), "success"); diff --git a/js/src/jit-test/tests/jaeger/bug563000/eif-getter-typechange.js b/js/src/jit-test/tests/jaeger/bug563000/eif-getter-typechange.js new file mode 100644 index 0000000000..067ec4dcda --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug563000/eif-getter-typechange.js @@ -0,0 +1,9 @@ +load(libdir + "evalInFrame.js"); + +this.__defineGetter__("someProperty", function () { evalInFrame(1, "var x = 'success'"); }); +function caller(obj) { + var x = ({ dana : 'zuul' }); + obj.someProperty; + return x; +} +assertEq(caller(this), "success"); diff --git a/js/src/jit-test/tests/jaeger/bug563000/eif-getter.js b/js/src/jit-test/tests/jaeger/bug563000/eif-getter.js new file mode 100644 index 0000000000..e64492ce47 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug563000/eif-getter.js @@ -0,0 +1,9 @@ +load(libdir + "evalInFrame.js"); + +this.__defineGetter__("someProperty", function () { evalInFrame(1, "x = 'success'"); }); +function caller(obj) { + var x = "failure"; + obj.someProperty; + return x; +} +assertEq(caller(this), "success"); diff --git a/js/src/jit-test/tests/jaeger/bug563000/eif-global-newvar.js b/js/src/jit-test/tests/jaeger/bug563000/eif-global-newvar.js new file mode 100644 index 0000000000..eb5ed0adff --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug563000/eif-global-newvar.js @@ -0,0 +1,7 @@ +load(libdir + "evalInFrame.js"); + +function callee() { + evalInFrame(1, "var x = 'success'"); +} +callee(); +assertEq(x, "success"); diff --git a/js/src/jit-test/tests/jaeger/bug565198.js b/js/src/jit-test/tests/jaeger/bug565198.js new file mode 100644 index 0000000000..1ecf6c8ef4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug565198.js @@ -0,0 +1,6 @@ +const X = 12; + +eval("switch (X) { case X: print(); }"); + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug566022.js b/js/src/jit-test/tests/jaeger/bug566022.js new file mode 100644 index 0000000000..5bd055808b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug566022.js @@ -0,0 +1,8 @@ +function f() { + var a; + var o = { valueOf: function () { x = 99; return x; } }; + var x = 2; + return [x, o + x, x] +} +assertEq(f().join(", "), "2, 101, 99"); + diff --git a/js/src/jit-test/tests/jaeger/bug573433.js b/js/src/jit-test/tests/jaeger/bug573433.js new file mode 100644 index 0000000000..aa39022bb7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug573433.js @@ -0,0 +1,7 @@ +// |jit-test| error: TypeError +function f() { + eval("(function() \n{\nfor(x in[])\n{}\n})"); + ("")() +} +f() + diff --git a/js/src/jit-test/tests/jaeger/bug576398.js b/js/src/jit-test/tests/jaeger/bug576398.js new file mode 100644 index 0000000000..82e2caaab3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug576398.js @@ -0,0 +1,10 @@ +function K(x) { + with ({}); // prevent compilation + this.x = x; +} +function f() { + var a = new K(1); + var b = new K(2); + return (a == b); +} +assertEq(f(), false); diff --git a/js/src/jit-test/tests/jaeger/bug577580.js b/js/src/jit-test/tests/jaeger/bug577580.js new file mode 100644 index 0000000000..6812a7da48 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug577580.js @@ -0,0 +1,7 @@ +// |jit-test| error: ReferenceError +(function() { + for (; i;) { + eval(/@/, "") + } +})() + diff --git a/js/src/jit-test/tests/jaeger/bug577646.js b/js/src/jit-test/tests/jaeger/bug577646.js new file mode 100644 index 0000000000..659354c8b5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug577646.js @@ -0,0 +1,5 @@ +try { + [](); +} catch(e) {} + +/* Don't crash. */ diff --git a/js/src/jit-test/tests/jaeger/bug577705.js b/js/src/jit-test/tests/jaeger/bug577705.js new file mode 100644 index 0000000000..e9e338130e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug577705.js @@ -0,0 +1,65 @@ +// |jit-test| error: ReferenceError +function f1() { + N = 62; + mt = Array + function g1(n1) { + return n1 < 0 ? (1 ^ 21) + 21: n1 + } + function g2(n1, n2) { + return g1(n1 + n2 & 4294967295); + } + function g3(n1, n2) { + sum = 0; + for (var i = 0; i < 32; ++i) { + if (n1 >> i) { + sum = g2(sum, g1(n2)) + } + } + return sum + } + this.h1 = function() { + for (mti = 1; mti < N; mti++) { + mt[mti] = g2(g3(3, g1(mt[mti - 1] ^ 0)), mti) + } + }; + this.i2 = function() { + if (mti > N) { + mti = 0; + } + y = mt[mti++]; + return y + }; + this.i1 = function() { + return (this.i2() + 5) * 2e-10 + }; +} (function() { + fuzzMT = new f1; + fuzzMT.h1(9); + rnd = function(n) { + return Math.floor(fuzzMT.i1() * n) + }; +} ()); +function f5(a) { + return a[rnd(a.length)] +} +function f2(d, b) { + f3(d, b); + return "" + f2(2, b) + ""; +} +function f3(d, b) { + if (rnd(4) == 1) { + f5(f4)(d, b) + } +} +var f4 = [function() { ["", f6(), ""] +}]; +function f6(db) { + return f5(foo)(); +} +var foo = [function() { + t(["", "", "", "", "", "", "", "", "", "", "", "" + h.I, ""]); +}]; +f2() + +/* Don't assert or crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug580712.js b/js/src/jit-test/tests/jaeger/bug580712.js new file mode 100644 index 0000000000..aabb5f5f01 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug580712.js @@ -0,0 +1 @@ +--''.trimLeft diff --git a/js/src/jit-test/tests/jaeger/bug580884-3.js b/js/src/jit-test/tests/jaeger/bug580884-3.js new file mode 100644 index 0000000000..fb22882b10 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug580884-3.js @@ -0,0 +1,10 @@ +function testDestructuring() { + eval(); + var t = 0; + for (var i = 0; i < 9; ++i) { + var [r, g, b] = [1, 1, 1]; + t += r + g + b; + } + return t +} +assertEq(testDestructuring(), (9) * 3); diff --git a/js/src/jit-test/tests/jaeger/bug580884.js b/js/src/jit-test/tests/jaeger/bug580884.js new file mode 100644 index 0000000000..b7a26f7056 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug580884.js @@ -0,0 +1,8 @@ +// |jit-test| error: ReferenceError +for (let a in [0]) +a = e +for (let a in [0]) +(function () { + a +}) + diff --git a/js/src/jit-test/tests/jaeger/bug580931-2.js b/js/src/jit-test/tests/jaeger/bug580931-2.js new file mode 100644 index 0000000000..9f18f57e02 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug580931-2.js @@ -0,0 +1,4 @@ +// |jit-test| error: TypeError +x = 0 +'a'.replace(/a/, x.toLocaleString) + diff --git a/js/src/jit-test/tests/jaeger/bug581871.js b/js/src/jit-test/tests/jaeger/bug581871.js new file mode 100644 index 0000000000..6b22dd5963 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug581871.js @@ -0,0 +1,10 @@ +function test(p) { + var alwaysFalse = p && !p; + var k = []; + var g; + if (!alwaysFalse) { + k[0] = g = alwaysFalse ? "failure" : "success"; + return g; + } +} +assertEq(test("anything"), "success"); diff --git a/js/src/jit-test/tests/jaeger/bug581936.js b/js/src/jit-test/tests/jaeger/bug581936.js new file mode 100644 index 0000000000..5b4e4f1e8e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug581936.js @@ -0,0 +1,12 @@ +function returnZero() { return 0; } +function test() { + var a = "a"; + var b = "b"; + if (returnZero()) { + return a + b; + } else { + return b + a; + } +} +assertEq(test(), "ba"); + diff --git a/js/src/jit-test/tests/jaeger/bug582185.js b/js/src/jit-test/tests/jaeger/bug582185.js new file mode 100644 index 0000000000..38d1c4219f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582185.js @@ -0,0 +1,3 @@ +let c = (this != 4.2); + +/* Don't assert. */ diff --git a/js/src/jit-test/tests/jaeger/bug582286.js b/js/src/jit-test/tests/jaeger/bug582286.js new file mode 100644 index 0000000000..094366a3c7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582286.js @@ -0,0 +1,3 @@ +evalcx("function s(){}",evalcx('lazy')) + + diff --git a/js/src/jit-test/tests/jaeger/bug582392.js b/js/src/jit-test/tests/jaeger/bug582392.js new file mode 100644 index 0000000000..ad60d3f5b1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582392.js @@ -0,0 +1,8 @@ +function cmp(x, y) { + if (x < y) + return -1; + if (x > y) + return 1; + return 0; +} +assertEq(cmp('true', 'false'), 1); diff --git a/js/src/jit-test/tests/jaeger/bug582880.js b/js/src/jit-test/tests/jaeger/bug582880.js new file mode 100644 index 0000000000..9d77df1f57 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582880.js @@ -0,0 +1,8 @@ +x = (function() {}) +(function () { + function a() {} + a([7].some(gc)) +}()) + +/* Don't crash or assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug582882.js b/js/src/jit-test/tests/jaeger/bug582882.js new file mode 100644 index 0000000000..2fafca5f43 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582882.js @@ -0,0 +1,11 @@ +// |jit-test| error: ReferenceError +function f1(code) { + f = Function(code) + f2() +} +function f2() { + f() +} +f1("d=this.__defineGetter__(\"x\",gc)") +f1("b(x&=w);function b(){}") + diff --git a/js/src/jit-test/tests/jaeger/bug582884.js b/js/src/jit-test/tests/jaeger/bug582884.js new file mode 100644 index 0000000000..3d5d9954ef --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582884.js @@ -0,0 +1,7 @@ +(function () { + x ^ x++ + var x +})() + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug582897.js b/js/src/jit-test/tests/jaeger/bug582897.js new file mode 100644 index 0000000000..0c8dbc9b08 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582897.js @@ -0,0 +1,7 @@ +{ + let x; + x + x-- +} + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug582898.js b/js/src/jit-test/tests/jaeger/bug582898.js new file mode 100644 index 0000000000..7296b3d6e7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582898.js @@ -0,0 +1,7 @@ +{ + let x = ""; + x++ + assertEq(x, 1); +} + +/* Test no assert. */ diff --git a/js/src/jit-test/tests/jaeger/bug582900.js b/js/src/jit-test/tests/jaeger/bug582900.js new file mode 100644 index 0000000000..1da55397af --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug582900.js @@ -0,0 +1,3 @@ +// |jit-test| error: ReferenceError + +[].x >>= a | 0 diff --git a/js/src/jit-test/tests/jaeger/bug583158.js b/js/src/jit-test/tests/jaeger/bug583158.js new file mode 100644 index 0000000000..6d8c124487 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug583158.js @@ -0,0 +1,9 @@ +// |jit-test| error: ReferenceError +function g() { + var rv = (function() { + this << 1 + })() + if (a) (function() {}) +} +g() + diff --git a/js/src/jit-test/tests/jaeger/bug583160.js b/js/src/jit-test/tests/jaeger/bug583160.js new file mode 100644 index 0000000000..928f588cda --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug583160.js @@ -0,0 +1,10 @@ +(function() { + for (a in []) { + (function() {}) + ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +h.I]) + } +})() + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug583672.js b/js/src/jit-test/tests/jaeger/bug583672.js new file mode 100644 index 0000000000..6280fa470e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug583672.js @@ -0,0 +1,30 @@ +(function () { + function f() + { + this.y = w + this.y = (void 0) + Object + } + for (a in [0, 0, 0, 0]) + { + new f + } + var w = {} +})() + +/* Make sure that MICs don't have the same bug. */ +x = Object(); +(function () { + function f() + { + x = w + x = (void 0) + Object + } + for (a in [0, 0, 0, 0]) + { + new f + } + var w = {} +})() +/* Don't assert. */ diff --git a/js/src/jit-test/tests/jaeger/bug583688.js b/js/src/jit-test/tests/jaeger/bug583688.js new file mode 100644 index 0000000000..c13f616021 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug583688.js @@ -0,0 +1,10 @@ +// |jit-test| error: ReferenceError +this.__defineSetter__("x", function () {}) +try { + this.__defineGetter__("d", (Function("x"))) +} catch (e) {} +d +print(delete x) +throw d + + diff --git a/js/src/jit-test/tests/jaeger/bug583689.js b/js/src/jit-test/tests/jaeger/bug583689.js new file mode 100644 index 0000000000..edb3248ea9 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug583689.js @@ -0,0 +1,7 @@ +function f() { + if (-[]) delete y +} +for (c in [0, 0, 0, 0]) { + new f +} + diff --git a/js/src/jit-test/tests/jaeger/bug584646.js b/js/src/jit-test/tests/jaeger/bug584646.js new file mode 100644 index 0000000000..566739245d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug584646.js @@ -0,0 +1,7 @@ +switch (0) { + case 2: + k; + case (-1): + case 2: +} +/* Don't assert. */ diff --git a/js/src/jit-test/tests/jaeger/bug584647.js b/js/src/jit-test/tests/jaeger/bug584647.js new file mode 100644 index 0000000000..7f0e659848 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug584647.js @@ -0,0 +1,2 @@ +(function(){for(j=0;j<3;++j)NaN=42})(); +assertEq(NaN != NaN, true); diff --git a/js/src/jit-test/tests/jaeger/bug585341.js b/js/src/jit-test/tests/jaeger/bug585341.js new file mode 100644 index 0000000000..7c192029b8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug585341.js @@ -0,0 +1,6 @@ +this.__defineGetter__("x", () => new Float64Array()) +Function("\ + with(this) {\ + eval(\"x\")\ + }\ +")() diff --git a/js/src/jit-test/tests/jaeger/bug585391.js b/js/src/jit-test/tests/jaeger/bug585391.js new file mode 100644 index 0000000000..28f969cf15 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug585391.js @@ -0,0 +1,11 @@ +var x = (function () { + return [, , ] +}()); +(function () { + while (x > 7 & 0) { + return + } +}()) + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug585408-2.js b/js/src/jit-test/tests/jaeger/bug585408-2.js new file mode 100644 index 0000000000..b77f1a9844 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug585408-2.js @@ -0,0 +1,6 @@ +for (let c in []) { + c << c++ +} + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug585408-3.js b/js/src/jit-test/tests/jaeger/bug585408-3.js new file mode 100644 index 0000000000..9359abad83 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug585408-3.js @@ -0,0 +1,7 @@ +(function() { + function a() {} + a > a-- +})() + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug585408.js b/js/src/jit-test/tests/jaeger/bug585408.js new file mode 100644 index 0000000000..118f219e33 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug585408.js @@ -0,0 +1,7 @@ +(function() { + function a() {} + a.e = a++ +})() + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug585540.js b/js/src/jit-test/tests/jaeger/bug585540.js new file mode 100644 index 0000000000..0fae459e02 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug585540.js @@ -0,0 +1,13 @@ +try { + (function () { + gczeal(2)() + })() +} catch (e) {} +(function () { + for (y in [/x/, Boolean, Boolean, 0, Boolean]) { + [Math.floor(this)].some(function () {}) + } +})() + +/* Don't crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug587431.js b/js/src/jit-test/tests/jaeger/bug587431.js new file mode 100644 index 0000000000..bfad85776c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug587431.js @@ -0,0 +1,29 @@ +function g() { + var UPPER_MASK = 2147483648 + var mt = new Array + function f1(n1) { + return n1 < 0 ? (n1 ^ UPPER_MASK) + UPPER_MASK: n1 + } + function f2(n1, n2) { + return f1(n1 + n2 & 4294967295) + } + function f3(n1, n2) { + var sum + for (var i = 0; i < 32; ++i) { + sum = f2(sum, f1(n2 << i)) + } + return sum + } + this.init_genrand = function(s) { + mt[0] = f1(s & 96295) + for (mti = 1; mti < 6; mti++) { + mt[mti] = f2(f3(3, f1(mt[mti - 1] ^ mt[1] > 0)), mti) + } + } +} (function() { + var fuzzMT = new g; + fuzzMT.init_genrand(54) +} ()) + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug588338.js b/js/src/jit-test/tests/jaeger/bug588338.js new file mode 100644 index 0000000000..c400d76875 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug588338.js @@ -0,0 +1,15 @@ +// |jit-test| error: is not a function +function f() { + (e) +} +(x = new Proxy(Function, (function(x) { + return { + get: function(r, b) { + return x[b] + } + } +})(/x/))) +for (e in [0]) { + gczeal(2) +} ( [1,2,3])("") + diff --git a/js/src/jit-test/tests/jaeger/bug588362-1.js b/js/src/jit-test/tests/jaeger/bug588362-1.js new file mode 100644 index 0000000000..460912f1c0 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug588362-1.js @@ -0,0 +1,8 @@ +for (a = 0; a < 13; a++) { + (function* e() { + yield eval() + }()) +} + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug588362-2.js b/js/src/jit-test/tests/jaeger/bug588362-2.js new file mode 100644 index 0000000000..8451448b5a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug588362-2.js @@ -0,0 +1,10 @@ +for (a = 0; a < 13; a++) { + (function* n() { + with({}) { + yield + } + } ()) +} + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug588362-3.js b/js/src/jit-test/tests/jaeger/bug588362-3.js new file mode 100644 index 0000000000..8bf0346b0e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug588362-3.js @@ -0,0 +1,10 @@ +for (a = 0; a < 13; a++) { + (function* n() { { + function s() {} + } + yield[]; + }()); +} + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug588363-1.js b/js/src/jit-test/tests/jaeger/bug588363-1.js new file mode 100644 index 0000000000..6fca00dd84 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug588363-1.js @@ -0,0 +1,6 @@ +// |jit-test| +({eval} = Object.defineProperty(evalcx("lazy"), "", {})) +eval("eval(/x/)", []) + +/* Don't assert or crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug588363-2.js b/js/src/jit-test/tests/jaeger/bug588363-2.js new file mode 100644 index 0000000000..5550be3ea8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug588363-2.js @@ -0,0 +1,7 @@ +with(evalcx('')) { + delete eval; + eval("x", this.__defineGetter__("x", Function)); +} + +/* Don't assert or crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug589108.js b/js/src/jit-test/tests/jaeger/bug589108.js new file mode 100644 index 0000000000..e1835ea209 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug589108.js @@ -0,0 +1,10 @@ +try { + var x + for (x in [x]) + gczeal(2) + new NaN +} catch(e) {} +(function() { + for (a in [Boolean(), x.t]) {} +} (function() {})) + diff --git a/js/src/jit-test/tests/jaeger/bug589461.js b/js/src/jit-test/tests/jaeger/bug589461.js new file mode 100644 index 0000000000..89fc7acad4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug589461.js @@ -0,0 +1,7 @@ +function f(h, i, Q) { + var L = Q; + var H = h; + + return h[i] * L ^ L * 0x1010100; +} +assertEq(f([6], 0, 12345), 1768429654); diff --git a/js/src/jit-test/tests/jaeger/bug590083.js b/js/src/jit-test/tests/jaeger/bug590083.js new file mode 100644 index 0000000000..c11c7a137b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug590083.js @@ -0,0 +1,11 @@ +eval("\ + (function(){\ + for(var w in [0]) {\ + function w(){}\ + print(w)\ + }\ + })\ +")() + +/* Don't crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug591606.js b/js/src/jit-test/tests/jaeger/bug591606.js new file mode 100644 index 0000000000..cb711f0bd1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug591606.js @@ -0,0 +1,5 @@ +var c = [] +function c() {} + +/* Don't assert. */ + diff --git a/js/src/jit-test/tests/jaeger/bug592973-1.js b/js/src/jit-test/tests/jaeger/bug592973-1.js new file mode 100644 index 0000000000..d3bafac623 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug592973-1.js @@ -0,0 +1,12 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: +function f(x) { + if (x) { + let y; + y = 12; + (function () { + assertEq(y, 12); + })(); + } +} +f(1); + diff --git a/js/src/jit-test/tests/jaeger/bug592973-2.js b/js/src/jit-test/tests/jaeger/bug592973-2.js new file mode 100644 index 0000000000..052c622685 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug592973-2.js @@ -0,0 +1,7 @@ +function f(a) { + function a() { + } +} + +/* Don't assert on JOF_NAME test in BindNameToSlot(). */ + diff --git a/js/src/jit-test/tests/jaeger/bug592973-3.js b/js/src/jit-test/tests/jaeger/bug592973-3.js new file mode 100644 index 0000000000..541c39981a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug592973-3.js @@ -0,0 +1,8 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: +function f([a, b, c, d]) { + a = b; + return function () { return a + b + c + d; }; +} + +var F = f(["a", "b", "c", "d"]); +assertEq(F(), "bbcd"); diff --git a/js/src/jit-test/tests/jaeger/bug593554.js b/js/src/jit-test/tests/jaeger/bug593554.js new file mode 100644 index 0000000000..20143da845 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug593554.js @@ -0,0 +1,8 @@ +/* Don't assert. */ +var b = 7; +var a = []; +for (var j = 0; j < 7; ++j) { + var d = {}; + a.push(b >> d); +} +assertEq(a.toString(), '7,7,7,7,7,7,7'); diff --git a/js/src/jit-test/tests/jaeger/bug595917.js b/js/src/jit-test/tests/jaeger/bug595917.js new file mode 100644 index 0000000000..1b3e132953 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug595917.js @@ -0,0 +1,4 @@ +if (!this.parseInt) { + var parseInt = function () { return 5; } +} +assertEq(parseInt(10), 10); diff --git a/js/src/jit-test/tests/jaeger/bug597378.js b/js/src/jit-test/tests/jaeger/bug597378.js new file mode 100644 index 0000000000..c766407ab5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug597378.js @@ -0,0 +1,12 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: +function f(a, b) { + var o = a; + var q = b; + var p; + do { } while (0); + p = o; + q = p + 1 < q ? p + 1 : 0; + assertEq(q, 0); +} +f(3, 4); + diff --git a/js/src/jit-test/tests/jaeger/bug598696.js b/js/src/jit-test/tests/jaeger/bug598696.js new file mode 100644 index 0000000000..129275d2a5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug598696.js @@ -0,0 +1,6 @@ +function f() { + eval(); + var i = 0; + assertEq(++i, 1); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug599488.js b/js/src/jit-test/tests/jaeger/bug599488.js new file mode 100644 index 0000000000..f2cf952091 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug599488.js @@ -0,0 +1,9 @@ +/* Don't crash. */ +function foo(y) { + var x = y; + if (x != x) + return true; + return false; +} +assertEq(foo("three"), false); +assertEq(foo(NaN), true); diff --git a/js/src/jit-test/tests/jaeger/bug600139.js b/js/src/jit-test/tests/jaeger/bug600139.js new file mode 100644 index 0000000000..61fa7283a0 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug600139.js @@ -0,0 +1,10 @@ +// |jit-test| error: ReferenceError +// vim: set ts=8 sts=4 et sw=4 tw=99: +function f(a, b, c) { + if (!a.__SSi) { + throw Components.returnCode = Cr.NS_ERROR_INVALID_ARG; + } + this.restoreWindow(a, b, c); + eval(); +} +f(1, 2, 3); diff --git a/js/src/jit-test/tests/jaeger/bug600419.js b/js/src/jit-test/tests/jaeger/bug600419.js new file mode 100644 index 0000000000..981a6a17c4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug600419.js @@ -0,0 +1,5 @@ +/* Don't assert. */ +(function() { + var x; + [1].map(function(){}, x << x); +})() diff --git a/js/src/jit-test/tests/jaeger/bug600424.js b/js/src/jit-test/tests/jaeger/bug600424.js new file mode 100644 index 0000000000..e59a06614f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug600424.js @@ -0,0 +1,14 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: +function f(a) { + var x = { + g: function () { + return this.a; + } + }; + x.g.prototype.a = a; + assertEq(x.g.prototype.a, a); + return x; +} +f(1); +f(2); +f(3); diff --git a/js/src/jit-test/tests/jaeger/bug601982.js b/js/src/jit-test/tests/jaeger/bug601982.js new file mode 100644 index 0000000000..99f4bf906f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug601982.js @@ -0,0 +1,33 @@ +/* vim: set ts=8 sts=4 et sw=4 tw=99: */ + +function J(i) { + /* Cause a branch to build(?) */ + if (i % 3) + [1,2,3] +} + +function h(i) { + J(i); + + /* Generate a safe point in the method JIT. */ + if (1 == 14) { eval(); } + + return J(i); +} + +function g(i) { + /* Method JIT will try to remove this frame(?) */ + if (i == 14) { with ({}); } + return h(i); +} + +function f() { + for (var i = 0; i < 9 * 2; i++) { + g(i); + } +} + +f(); + +/* Don't crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug604381.js b/js/src/jit-test/tests/jaeger/bug604381.js new file mode 100644 index 0000000000..3ca01cb362 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug604381.js @@ -0,0 +1,14 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function F() { + var T = { }; + try { + throw 12; + } catch (e) { + T.x = 5; + return T; + } +} + +assertEq((new F()).x, 5); + diff --git a/js/src/jit-test/tests/jaeger/bug604427.js b/js/src/jit-test/tests/jaeger/bug604427.js new file mode 100644 index 0000000000..1e37df8694 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug604427.js @@ -0,0 +1,6 @@ + +function testInt(x) { + var a = x|0; + return (a !== a); +} +assertEq(testInt(10), false); diff --git a/js/src/jit-test/tests/jaeger/bug606662-2.js b/js/src/jit-test/tests/jaeger/bug606662-2.js new file mode 100644 index 0000000000..dc38cbb330 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug606662-2.js @@ -0,0 +1,5 @@ +// don't crash +try{a()}catch(e){} +try{for(e in((JSON.e)(x=/x/)))throw []}catch(e){} +try{(function(){c()})()}catch(e){} +try{new function(){}}catch(e){} diff --git a/js/src/jit-test/tests/jaeger/bug606829.js b/js/src/jit-test/tests/jaeger/bug606829.js new file mode 100644 index 0000000000..1839c93d25 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug606829.js @@ -0,0 +1,8 @@ +/* Don't assert. */ +function f(x) +{ + if ("hi" == (x & 3)) { + return 1; + } +} +f(12); diff --git a/js/src/jit-test/tests/jaeger/bug610652.js b/js/src/jit-test/tests/jaeger/bug610652.js new file mode 100644 index 0000000000..b5c64d193c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug610652.js @@ -0,0 +1,5 @@ +function a1(a2) { + return 10 - a2; +} +a3 = a1(-2147483648); +assertEq(a3, 2147483658); diff --git a/js/src/jit-test/tests/jaeger/bug615440.js b/js/src/jit-test/tests/jaeger/bug615440.js new file mode 100644 index 0000000000..1ed4cd1c04 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug615440.js @@ -0,0 +1,5 @@ +Array.prototype.__proto__ = null; +for (var r = 0; r < 3; ++r) [][0] = 1; + +// Don't crash. + diff --git a/js/src/jit-test/tests/jaeger/bug616508.js b/js/src/jit-test/tests/jaeger/bug616508.js new file mode 100644 index 0000000000..d29bf75f9b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug616508.js @@ -0,0 +1,14 @@ +// |jit-test| error: ReferenceError +// vim: set ts=8 sts=4 et sw=4 tw=99: + +// Note: modified from original test, which used Uint32Array in place of Array, +// because the behavior has changed in a way that this will throw a TypeError +// before it gets to testing what used to crash. I have no idea whether this +// would actually crash the original version it was written for. +try { + (function () { + __proto__ = Array() + }()) +} catch (e) {}(function () { + length, ([eval()] ? x : 7) +})() diff --git a/js/src/jit-test/tests/jaeger/bug617433.js b/js/src/jit-test/tests/jaeger/bug617433.js new file mode 100644 index 0000000000..768f5a4149 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug617433.js @@ -0,0 +1,12 @@ +// don't crash + +function foo(x) { + (x >>> 3.14); + (x >>> true); + (x >>> (0/0)); + (x >>> 100); + (x >>> -10); + (x >>> (1/0)); + (x >>> (void 0)); +} +foo(10); diff --git a/js/src/jit-test/tests/jaeger/bug617440.js b/js/src/jit-test/tests/jaeger/bug617440.js new file mode 100644 index 0000000000..48311e7614 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug617440.js @@ -0,0 +1,11 @@ + +function f() { + var x = 1.23; + function g() { + var y = x++; + assertEq(y, 1.23); + } + g(); + assertEq(x, 2.23); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug617458.js b/js/src/jit-test/tests/jaeger/bug617458.js new file mode 100644 index 0000000000..1dc9b2f87c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug617458.js @@ -0,0 +1,6 @@ + +function f(x) { + var a = 4 | x; + a = +a; +} +f(10); diff --git a/js/src/jit-test/tests/jaeger/bug617460.js b/js/src/jit-test/tests/jaeger/bug617460.js new file mode 100644 index 0000000000..5b9f7662fc --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug617460.js @@ -0,0 +1,10 @@ + +function f() { + var x = NaN; + if (2 > 0) {} + var y = {}; + var z = (1234 - x); + y.foo = z; + assertEq(x, NaN); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug617549.js b/js/src/jit-test/tests/jaeger/bug617549.js new file mode 100644 index 0000000000..a48e80f3c5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug617549.js @@ -0,0 +1,9 @@ + +function f() { + var a, b, c; + a = -c; + b = c & 2; + a = b; + a = 123 * a; +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug617558.js b/js/src/jit-test/tests/jaeger/bug617558.js new file mode 100644 index 0000000000..1bbd30f21a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug617558.js @@ -0,0 +1,7 @@ + +Array.prototype.__proto__ = Function.prototype; +var x = [1,2,3]; +x[0]; + +[].__proto__.foo = true; +eval("[]"); diff --git a/js/src/jit-test/tests/jaeger/bug617624.js b/js/src/jit-test/tests/jaeger/bug617624.js new file mode 100644 index 0000000000..ebf1e661e8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug617624.js @@ -0,0 +1,7 @@ + +function f() { + var x; + var a = x; + Boolean(a = Number(12.34)); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug618007.js b/js/src/jit-test/tests/jaeger/bug618007.js new file mode 100644 index 0000000000..daa43e504d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug618007.js @@ -0,0 +1,31 @@ +var appendToActual = function(s) { + actual += s + ','; +} + +for(var z=0; z < 3; z++) { + function ff() { + } + ff(); + + // jit-test/tests/closures/setname-closure.js + actual = ''; + expected = '2,4,8,16,32,undefined,64,128,256,512,1024,undefined,2048,4096,8192,16384,32768,undefined,65536,131072,262144,524288,1048576,undefined,2097152,4194304,8388608,16777216,33554432,undefined,'; + + var f = function() { + var p = 1; + function g() { + for (var i = 0; i < 5; ++i) { + p = p * 2; + appendToActual(p); + } + } + return g; + } + var g = f(); + for (var i = 0; i < 5; ++i) { + g(); + appendToActual(); + } + assertEq(actual, expected); +} + diff --git a/js/src/jit-test/tests/jaeger/bug618849.js b/js/src/jit-test/tests/jaeger/bug618849.js new file mode 100644 index 0000000000..0df67a069f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug618849.js @@ -0,0 +1,11 @@ + +function f() { + function g() { + var b = x; + var c = b++ & b; + return c; + } + var x = x--; + return g(); +} +assertEq(f(), 0); diff --git a/js/src/jit-test/tests/jaeger/bug618850.js b/js/src/jit-test/tests/jaeger/bug618850.js new file mode 100644 index 0000000000..8c423d87b3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug618850.js @@ -0,0 +1,6 @@ +function f() { + var x = false; + NaN ? x = Math.floor() : x = Math.ceil(); + return x * 12345; +} +assertEq(f(), NaN); diff --git a/js/src/jit-test/tests/jaeger/bug618863.js b/js/src/jit-test/tests/jaeger/bug618863.js new file mode 100644 index 0000000000..9393361190 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug618863.js @@ -0,0 +1,23 @@ +function f() { + for(var i=0; i<3; i++) { + var x = -i / 100; + assertEq(x * -100, i); + } +} +f(); + +function g() { + for (var i = 0; i < 2; i++) { + var a = i ? true : false; + var x = -a / 100; + assertEq(x * -100, i); + } +} +g(); + +function h() { + for (var i = 0; i < 20; i++) + var x = (0x7ffffff4 + i) / 100; + assertEq(x, 21474836.55); +} +h(); diff --git a/js/src/jit-test/tests/jaeger/bug619339.js b/js/src/jit-test/tests/jaeger/bug619339.js new file mode 100644 index 0000000000..2445d24fcc --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug619339.js @@ -0,0 +1,3 @@ + +var a; +assertEq(true && 1.1 + a, NaN); diff --git a/js/src/jit-test/tests/jaeger/bug619433-1.js b/js/src/jit-test/tests/jaeger/bug619433-1.js new file mode 100644 index 0000000000..8ffb23838f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug619433-1.js @@ -0,0 +1,22 @@ + +/* Test compiling JSOP_STRICTEQ on known doubles. */ + +function foo(x) { + return x === x; +} + +for (var i = 0; i < 20; i++) { + assertEq(foo(1.2), true); + assertEq(foo(NaN), false); +} + +function bar(x) { + if (x === x) + return true; + return false; +} + +for (var i = 0; i < 20; i++) { + assertEq(bar(1.2), true); + assertEq(bar(NaN), false); +} diff --git a/js/src/jit-test/tests/jaeger/bug619433-2.js b/js/src/jit-test/tests/jaeger/bug619433-2.js new file mode 100644 index 0000000000..947557da37 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug619433-2.js @@ -0,0 +1,10 @@ + +function foo(x) { + var y = 2.5; + y = -x; + var z = [1,2,y]; + return x + 5; +} +for (var i = 0; i < 20; i++) + foo(i); +assertEq(foo(20), 25); diff --git a/js/src/jit-test/tests/jaeger/bug620643.js b/js/src/jit-test/tests/jaeger/bug620643.js new file mode 100644 index 0000000000..fcb096e953 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug620643.js @@ -0,0 +1 @@ +var a = new Int32Array(); +(a[0]={}); diff --git a/js/src/jit-test/tests/jaeger/bug621522.js b/js/src/jit-test/tests/jaeger/bug621522.js new file mode 100644 index 0000000000..a952502d82 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug621522.js @@ -0,0 +1,14 @@ + +/* Don't crash. */ +function f() { + var x; + x.a; + x = {}; +} + +try { + f(); + assertEq(0, 1); +} catch(e) { + +} diff --git a/js/src/jit-test/tests/jaeger/bug621655.js b/js/src/jit-test/tests/jaeger/bug621655.js new file mode 100644 index 0000000000..5b14df90b1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug621655.js @@ -0,0 +1,10 @@ +/* Don't assert. */ +for(p in 0.3) { } + +Number.prototype.foo = function() {} +var arr = []; + +for(p in 1.2) { + arr.push(p); +} +assertEq(arr[0], "foo"); diff --git a/js/src/jit-test/tests/jaeger/bug624100.js b/js/src/jit-test/tests/jaeger/bug624100.js new file mode 100644 index 0000000000..744ca01876 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug624100.js @@ -0,0 +1,2 @@ +// |jit-test| error: ReferenceError +eval("'use strict'; for(let j=0;j<9;++j) {} x;"); diff --git a/js/src/jit-test/tests/jaeger/bug624483.js b/js/src/jit-test/tests/jaeger/bug624483.js new file mode 100644 index 0000000000..480e53914f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug624483.js @@ -0,0 +1,5 @@ +var arr = new Uint8ClampedArray(16); +for (var i = 0; i < 16; i++) { + arr[i] = "Infinity"; +} +assertEq(arr[14], 255); diff --git a/js/src/jit-test/tests/jaeger/bug625157.js b/js/src/jit-test/tests/jaeger/bug625157.js new file mode 100644 index 0000000000..53bed4e681 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug625157.js @@ -0,0 +1,16 @@ +function f() { + { + function g() { + var a = []; + for (var i = 0; i < 10; i++) + a.push({}); + for (var i = 0; i < 10; i++) + a[i].m = function() { return 0; } + assertEq(a[8].m !== a[9].m, true); + } + g(); + } +} +f() + + diff --git a/js/src/jit-test/tests/jaeger/bug625377.js b/js/src/jit-test/tests/jaeger/bug625377.js new file mode 100644 index 0000000000..4c78939384 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug625377.js @@ -0,0 +1,13 @@ +x = [] +for(var i=0; i<3; i++) { + var obj = { first: "first", second: "second" }; + var count = 0; + for (var elem in obj) { + delete obj.second; + count++; + } + x.push(count); +} +assertEq(x[0], 1); +assertEq(x[1], 1); +assertEq(x[2], 1); diff --git a/js/src/jit-test/tests/jaeger/bug625718-1.js b/js/src/jit-test/tests/jaeger/bug625718-1.js new file mode 100644 index 0000000000..601c2a8e6d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug625718-1.js @@ -0,0 +1,12 @@ +function f3() { return 2; }; +function f4(o) { o.g4 = function() {}; }; + +var f = function() {}; +f.x = undefined; +f4(new String("x")); +f3(); +f4(f); + +for(var i=0; i<20; i++) { + f4(Math); +} diff --git a/js/src/jit-test/tests/jaeger/bug625718-2.js b/js/src/jit-test/tests/jaeger/bug625718-2.js new file mode 100644 index 0000000000..029819519c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug625718-2.js @@ -0,0 +1,14 @@ +var o3 = new String("foobarbaz"); +var o10 = Math; +var o11 = function() {}; + +function f3(o) { return o; }; +function f4(o) { o.g4 = function() {}; }; + +for(var i=0; i<20; i++) { + o11[3] = undefined; + f4(o3); + f3(o3); + f4(o11); + f4(o10); +} diff --git a/js/src/jit-test/tests/jaeger/bug625718-3.js b/js/src/jit-test/tests/jaeger/bug625718-3.js new file mode 100644 index 0000000000..81e788143a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug625718-3.js @@ -0,0 +1,52 @@ +var o0 = []; +var o1 = new String("foobarbaz"); +var o2 = {}; +var o3 = new String("foobarbaz"); +var o4 = {}; +var o5 = Math; +var o6 = {}; +var o7 = new String("foobarbaz"); +var o8 = new String("foobarbaz"); +var o9 = Math; +var o10 = Math; +var o11 = function() {}; +var o12 = {}; +var o13 = new String("foobarbaz"); +var o14 = {}; + +function f1(o) { return o.length;}; +function f2(o) { o.g2 = function() {};}; +function f3(o) { return o.g10;}; +function f4(o) { o.g4 = function() {};}; +function f5(o) { return o == o14;}; +function f6(o) { o[3] = o;}; +function f7(o) { o[3] = undefined;}; +function f8(o) { o[3] = undefined;}; +function f9(o) { return o.length;}; +function f10(o) { return o.__proto__; }; + +for(var i=0; i<20; i++) { + f9(o11); + f6(o0); + f2(o1); + f2(o6); + f7(o6); + f8(o11); + f2(o5); + f7(o9); + f7(o12); + f6(o4); + f5(o1); + f4(o1); + f8(o8); + f6(o5); + f2(o0); + f10(o7); + f3(o3); + f4(o1); + f9(o3); + f4(o11); + f4(o0); + f2(o4); + f4(o10); +} diff --git a/js/src/jit-test/tests/jaeger/bug625757.js b/js/src/jit-test/tests/jaeger/bug625757.js new file mode 100644 index 0000000000..458c1604a8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug625757.js @@ -0,0 +1,4 @@ +for(var i=0; i<20; i++) { + var x = 5e-324; +} +/* Don't crash. */ diff --git a/js/src/jit-test/tests/jaeger/bug627486.js b/js/src/jit-test/tests/jaeger/bug627486.js new file mode 100644 index 0000000000..7acc3b01e9 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug627486.js @@ -0,0 +1,23 @@ +// |jit-test| error: TypeError +// vim: set ts=8 sts=4 et sw=4 tw=99: +g = undefined; +function L() { } + +function h() { + with (h) { } + for (var i = 0; i < 10; i++) + g(); +} + +function f(x) { + g = x; +} + +f(L); +h(); +f(L); +f(2); +h(); + +/* Don't assert/crash. */ + diff --git a/js/src/jit-test/tests/jaeger/bug639459.js b/js/src/jit-test/tests/jaeger/bug639459.js new file mode 100644 index 0000000000..035952e816 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug639459.js @@ -0,0 +1,6 @@ +function f() { + var a = [].length; + return a / a; +} +assertEq(f(), NaN); + diff --git a/js/src/jit-test/tests/jaeger/bug639478-1.js b/js/src/jit-test/tests/jaeger/bug639478-1.js new file mode 100644 index 0000000000..a0f2fd37e2 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug639478-1.js @@ -0,0 +1,5 @@ + +function f(x) { + return (x % 123.45) >> x; +} +assertEq(f(-123), -4); diff --git a/js/src/jit-test/tests/jaeger/bug639478-2.js b/js/src/jit-test/tests/jaeger/bug639478-2.js new file mode 100644 index 0000000000..3412dfa3e4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug639478-2.js @@ -0,0 +1,12 @@ +var y; +function f() { + for(var _ in [3.14]) { + y = 3.14; + y = y ^ y; + return y; + + function g() { + } + } +} +assertEq(f(), 0); diff --git a/js/src/jit-test/tests/jaeger/bug639587.js b/js/src/jit-test/tests/jaeger/bug639587.js new file mode 100644 index 0000000000..462c118463 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug639587.js @@ -0,0 +1,8 @@ +/* Don't assert. */ + +function f(o) { + o == 1; + if (o == 2) {} +} +for (var i = 0; i < 20; i++) + f(3.14); diff --git a/js/src/jit-test/tests/jaeger/bug639792.js b/js/src/jit-test/tests/jaeger/bug639792.js new file mode 100644 index 0000000000..601f047ae1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug639792.js @@ -0,0 +1,8 @@ + +for(var i=0; i<20; i++) { + function f(){}; + x = -1; + x = x % 1; + assertEq(x, -0); +} + diff --git a/js/src/jit-test/tests/jaeger/bug639808.js b/js/src/jit-test/tests/jaeger/bug639808.js new file mode 100644 index 0000000000..bf6b16c3d1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug639808.js @@ -0,0 +1,16 @@ +function f() { + var x = 1.23; + var y = [].length; + x = ++y; + y - 1; +} +f(); + +function g(q) { + var x = 1.23; + var y = [].length; + x = ++y; + if (q) + assertEq(y + 5, 6); +} +g(1); diff --git a/js/src/jit-test/tests/jaeger/bug640098.js b/js/src/jit-test/tests/jaeger/bug640098.js new file mode 100644 index 0000000000..b037df8a11 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug640098.js @@ -0,0 +1,15 @@ + +eval("(function(){({6953421313:0})})")(); + +function f() { + var x = {6953421313: 123}; + assertEq(x[6953421313], 123); + + x[6953421313] = "a"; + assertEq(x[6953421313], "a"); + + var y = {3.3: true}; + assertEq(y[3.3], true); +} +f(); + diff --git a/js/src/jit-test/tests/jaeger/bug640102.js b/js/src/jit-test/tests/jaeger/bug640102.js new file mode 100644 index 0000000000..e3ad9fbc01 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug640102.js @@ -0,0 +1,3 @@ +try { + eval("v>>([]=x)") +} catch (e) {} diff --git a/js/src/jit-test/tests/jaeger/bug640614.js b/js/src/jit-test/tests/jaeger/bug640614.js new file mode 100644 index 0000000000..f17ba2719d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug640614.js @@ -0,0 +1,5 @@ +function f(x) { + x = 2 ^ x++; + if (x) {} +} +f(1.1); diff --git a/js/src/jit-test/tests/jaeger/bug642198.js b/js/src/jit-test/tests/jaeger/bug642198.js new file mode 100644 index 0000000000..dec6e7294f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug642198.js @@ -0,0 +1,9 @@ + +function test() { + for(var e=1.2; true; e=20.2) { + if (e > 10) + break; + } +} +test(); + diff --git a/js/src/jit-test/tests/jaeger/bug643653-1.js b/js/src/jit-test/tests/jaeger/bug643653-1.js new file mode 100644 index 0000000000..7900f8ddd6 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug643653-1.js @@ -0,0 +1,10 @@ +function f(x) { + var a; + var b = [1].length; + var c = x; + var d = b + 1; + AA = x; + a = d; + assertEq(b + d, 3); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug643653-2.js b/js/src/jit-test/tests/jaeger/bug643653-2.js new file mode 100644 index 0000000000..aea6896f1d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug643653-2.js @@ -0,0 +1,58 @@ +var HEAP, IHEAP, FHEAP; +var TOTAL_MEMORY = 50 * 1024 * 1024; +HEAP = IHEAP = new Int32Array(TOTAL_MEMORY); +STACK_ROOT = STACKTOP = undefined; +var _rng; +var __str2; +var __str3; +{ + var __stackBase__ = STACKTOP; + var $n; + var $tmp5 = __stackBase__ + 12; + var $tmp6 = $n; + var $mul7 = ($tmp6) * 3; + $this_addr_i23 = $tmp5; + $id_addr_i = __str2; + $desc_addr_i = __str3; + $N_addr_i = $mul7; + var $this1_i24 = $this_addr_i23; + var $tmp_i25 = $id_addr_i; + var $tmp2_i = $desc_addr_i; + var $tmp3_i = $N_addr_i; + __Z9makeFastaI10RandomizedEvPKcS2_jRT_($tmp_i25, $tmp2_i, $tmp3_i, $this1_i24); +} +function __Z9makeFastaI10RandomizedEvPKcS2_jRT_($id, $desc, $N, $output) +{ + $output_addr = $output; + var $tmp4 = $output_addr; + $this_addr_i = $tmp4; + var $this1_i = $this_addr_i; + var $table_i = $this1_i; + var $call_i = __ZN10LineBuffer7genrandER10Cumulativej(0, $table_i, 0); +} +function __ZN10LineBuffer7genrandER10Cumulativej($this, $table, $N) +{ + var $this_addr_i1; + var $pct_addr_i; + $table_addr = $table; + var $tmp3 = $table_addr; + $this_addr_i = _rng; + $max_addr_i = 1; + var $this1_i = $this_addr_i; + var $last_i = $this1_i; + var $tmp_i = IHEAP[$last_i]; + var $mul_i = ($tmp_i) * 3877; + var $add_i = ($mul_i) + 29573; + var $rem_i = ($add_i) % 139968; + var $last2_i = $this1_i; + IHEAP[$last2_i] = $rem_i; + var $tmp3_i = $max_addr_i; + var $last4_i = $this1_i; + var $tmp5_i = IHEAP[$last4_i]; + var $conv_i = ($tmp5_i); + var $mul6_i = ($tmp3_i) * ($conv_i); + var $div_i = ($mul6_i) / 139968; + $this_addr_i1 = $tmp3; + $pct_addr_i = $div_i; + assertEq($pct_addr_i, NaN); +} diff --git a/js/src/jit-test/tests/jaeger/bug643805.js b/js/src/jit-test/tests/jaeger/bug643805.js new file mode 100644 index 0000000000..14a9edb48d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug643805.js @@ -0,0 +1,50 @@ +function _tt_face_get_name() { + var __label__ = -1; + var $rec; + var $n; + while(true) { + switch(__label__) { + case -1: + $rec=0; + $n=0; + case 0: + if ($rec == 20) { + __label__ = 2; + break; + } + var $63 = $n; + var $64 = $63 + 1; + $n = $64; + var $65 = $rec; + $rec = $rec + 1; + assertEq($64 < 30, true); + __label__ = 0; + break; + case 1: + $rec = 0; + case 2: + return; + } + } +} +_tt_face_get_name(); + +/* Test tracking of lifetimes around backedges in nested loops. */ +function nested() { + var x = 100; + var i = 0; + while (i < 10) { + while (i < 10) { + i++; + if (x < 20) + break; + if (i > 10) { + x = 200; + i++; + } + } + if (i > 10) + x = 100; + } +} +nested(); diff --git a/js/src/jit-test/tests/jaeger/bug643829.js b/js/src/jit-test/tests/jaeger/bug643829.js new file mode 100644 index 0000000000..43766c0125 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug643829.js @@ -0,0 +1,12 @@ +function _build_tree() { + var $n; + var $elems = 20; + while (true) { + var $tmp18 = $n; + var $tmp19 = $elems; + var $cmp = ($n | 0) < ($elems | 0); + return $cmp; + } +} +assertEq(_build_tree(), true); + diff --git a/js/src/jit-test/tests/jaeger/bug643913.js b/js/src/jit-test/tests/jaeger/bug643913.js new file mode 100644 index 0000000000..1dc8ac5d04 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug643913.js @@ -0,0 +1,8 @@ +function f() { + var x; + eval("x = 3.14"); + x = 123; + var y = -(-x); + assertEq(y, 123); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug645629.js b/js/src/jit-test/tests/jaeger/bug645629.js new file mode 100644 index 0000000000..c92d2c7bf5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug645629.js @@ -0,0 +1,8 @@ +/* Don't assert. */ +o1 = {}; +o1 = 2; +function f(o) { + o.hasOwnProperty("x"); +} +new f(o1); +f(o1); diff --git a/js/src/jit-test/tests/jaeger/bug645657.js b/js/src/jit-test/tests/jaeger/bug645657.js new file mode 100644 index 0000000000..d33870934e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug645657.js @@ -0,0 +1,8 @@ +function f() { + var x = 3; + var y = 1.2; + var z; + y = --z; + x = z++; +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug645985.js b/js/src/jit-test/tests/jaeger/bug645985.js new file mode 100644 index 0000000000..7ba1a0386f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug645985.js @@ -0,0 +1,5 @@ +function f(o) { + o += ""; + o.hasOwnProperty("x"); +} +f({}); diff --git a/js/src/jit-test/tests/jaeger/bug646001.js b/js/src/jit-test/tests/jaeger/bug646001.js new file mode 100644 index 0000000000..eabdb12dc4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug646001.js @@ -0,0 +1,12 @@ +function jit(on) +{ + if (on && !options().match(/tracejit/)) { } +} +try { test(); } catch (e) {} +function test( + ) +{ + for (var j=0;j<5;++j) { switch(1.1) { case 2: case NaN: } } + jit(false); + reportCompare('xxxxxxx'.test(new j('(x+)(x*)'))); +} diff --git a/js/src/jit-test/tests/jaeger/bug646060.js b/js/src/jit-test/tests/jaeger/bug646060.js new file mode 100644 index 0000000000..f399e12839 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug646060.js @@ -0,0 +1,8 @@ +function f0(i) { + switch(i) { + case "a": + case { TITLE: false, VERSION: false }('test') + : + } +} +try { new TestCase(SECTION, 'switch statement', f0("a"), "ab*"); } catch (e) {} diff --git a/js/src/jit-test/tests/jaeger/bug646411.js b/js/src/jit-test/tests/jaeger/bug646411.js new file mode 100644 index 0000000000..2e4f6b9421 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug646411.js @@ -0,0 +1,12 @@ +load(libdir + "immutable-prototype.js"); + +if (globalPrototypeChainIsMutable()) + __proto__ = Function(); + +eval("\ +var MS = 16;\ +addNewTestCase(new Date(1899,11,31,16,0,0), \"new Date(1899,11,31,16,0,0)\", typeof UTC_DAY == 'undefined');\ +function addNewTestCase( DateCase, DateString, ResultArray ) {\ + ResultArray[MS];\ +}\ +"); diff --git a/js/src/jit-test/tests/jaeger/bug646495.js b/js/src/jit-test/tests/jaeger/bug646495.js new file mode 100644 index 0000000000..f961de7472 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug646495.js @@ -0,0 +1,6 @@ +function f() { + var x = 1; + var y; + if (x = y = Math) {} +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug646938.js b/js/src/jit-test/tests/jaeger/bug646938.js new file mode 100644 index 0000000000..0284bdce3d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug646938.js @@ -0,0 +1,21 @@ +function f() { + var x = -[NaN][0]; + assertEq(x === x, false); + assertEq(x !== x, true); + assertEq(x == x, false); + assertEq(x != x, true); + + var y = -("x" / {}); + var z = y; + assertEq(y === z, false); + assertEq(y !== z, true); + assertEq(y == z, false); + assertEq(y != z, true); +} +f(); + +function g(x, y) { + var z = x / y; + assertEq(z === z, false); +} +g(0, 0); diff --git a/js/src/jit-test/tests/jaeger/bug647440.js b/js/src/jit-test/tests/jaeger/bug647440.js new file mode 100644 index 0000000000..f03f2c2075 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug647440.js @@ -0,0 +1,7 @@ +if (false) + function g() {} +function f() { + var x; + (x = Infinity) >> x--; +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug647657.js b/js/src/jit-test/tests/jaeger/bug647657.js new file mode 100644 index 0000000000..09c999fa7a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug647657.js @@ -0,0 +1 @@ +Function("var{}=Array()")() diff --git a/js/src/jit-test/tests/jaeger/bug647785.js b/js/src/jit-test/tests/jaeger/bug647785.js new file mode 100644 index 0000000000..da7dd20a1a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug647785.js @@ -0,0 +1,4 @@ +assertEq(-(!new Int32Array(5)), -0); +assertEq(-(!Math), -0); +assertEq(-(!{}), -0); +assertEq(-(![]), -0); diff --git a/js/src/jit-test/tests/jaeger/bug648004.js b/js/src/jit-test/tests/jaeger/bug648004.js new file mode 100644 index 0000000000..ba215bdead --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug648004.js @@ -0,0 +1,4 @@ +var x = eval("gc(); 30"); +var y = x.toString(); +isNaN(x); +assertEq(y, "30"); diff --git a/js/src/jit-test/tests/jaeger/bug648230-1.js b/js/src/jit-test/tests/jaeger/bug648230-1.js new file mode 100644 index 0000000000..f684bc6897 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug648230-1.js @@ -0,0 +1,13 @@ + +function f() { + -null; + -null; + -null; + -null; + -null; +} +{ + function g() {}; +} +f(); +x = Math.abs(); diff --git a/js/src/jit-test/tests/jaeger/bug648230-2.js b/js/src/jit-test/tests/jaeger/bug648230-2.js new file mode 100644 index 0000000000..d9e1eb421f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug648230-2.js @@ -0,0 +1,14 @@ +var i = 1; +var j = 2; +function f() { + if (false) + function g() {}; + return i / j; +} +-null; +-null; +-null; +-null; +-null; +f(); + diff --git a/js/src/jit-test/tests/jaeger/bug648498.js b/js/src/jit-test/tests/jaeger/bug648498.js new file mode 100644 index 0000000000..8e54209e5a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug648498.js @@ -0,0 +1,5 @@ +function f(x, y) { + return x; +} +var a = 3.3; +a ? f(f(1, 2), 3) : a; diff --git a/js/src/jit-test/tests/jaeger/bug648708.js b/js/src/jit-test/tests/jaeger/bug648708.js new file mode 100644 index 0000000000..1f79596371 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug648708.js @@ -0,0 +1,6 @@ +thrown = false +try { + ("".x = Object.seal) + "".x.valueOf(); +} catch (e) {thrown = true} +assertEq(thrown, true); diff --git a/js/src/jit-test/tests/jaeger/bug649272.js b/js/src/jit-test/tests/jaeger/bug649272.js new file mode 100644 index 0000000000..b09e324ad1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug649272.js @@ -0,0 +1,4 @@ +function f(x) {return x;} +x = f(/abc/); +eval("this.__defineSetter__(\"x\", function(){}); x = 3;"); +eval("var BUGNUMBER = 233483;"); diff --git a/js/src/jit-test/tests/jaeger/bug649593.js b/js/src/jit-test/tests/jaeger/bug649593.js new file mode 100644 index 0000000000..9d878d4a28 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug649593.js @@ -0,0 +1,10 @@ +function RunSingleBenchmark(data) { + if (data == null) + return { runs: 0, elapsed: 0 }; + data.runs += 10; + return data; +} +var data; +data = RunSingleBenchmark(data); +data = RunSingleBenchmark(data); +assertEq(data.runs, 10);
\ No newline at end of file diff --git a/js/src/jit-test/tests/jaeger/bug649689.js b/js/src/jit-test/tests/jaeger/bug649689.js new file mode 100644 index 0000000000..147197e00f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug649689.js @@ -0,0 +1,6 @@ +function f(x) { + eval("a = 3"); + x.p = x.p = a; + assertEq(x.p, 3); +} +f({p: 2}); diff --git a/js/src/jit-test/tests/jaeger/bug649775.js b/js/src/jit-test/tests/jaeger/bug649775.js new file mode 100644 index 0000000000..abf136f593 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug649775.js @@ -0,0 +1,17 @@ +var x = [, ]; +var n = [, ]; +var np = 18229; +sa = Array; +function copy_(x, y) { + var i; + var k = x < y ? x.length : y.length; + for (i = 0; i < k; i--) { + x[i]; + if (i == -100) + return; + } +} +function mont_(x, y, n, np) { + copy_(x, sa); +} +mont_(x, x, n, np); diff --git a/js/src/jit-test/tests/jaeger/bug649824.js b/js/src/jit-test/tests/jaeger/bug649824.js new file mode 100644 index 0000000000..619641c92e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug649824.js @@ -0,0 +1,6 @@ +var o = { + w: 2, + x: 3 +}; +var o = 430717; +o.x = 4; diff --git a/js/src/jit-test/tests/jaeger/bug649973.js b/js/src/jit-test/tests/jaeger/bug649973.js new file mode 100644 index 0000000000..89b2882235 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug649973.js @@ -0,0 +1,2 @@ +x = 2147483647; +(x+10, false) ? [x % x] : [2 * x]; diff --git a/js/src/jit-test/tests/jaeger/bug650076.js b/js/src/jit-test/tests/jaeger/bug650076.js new file mode 100644 index 0000000000..a72faa0feb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug650076.js @@ -0,0 +1,13 @@ +var v0, v1, v2, v3, v4, v5, v6, v7, v8, v9; +var v10, v11, v12, v13, v14, v15, v16, v17, v18, v19; +var v20, v21, v22, v23, v24, v25, v26, v27, v28, v29; +var v30, v31, v32, v33, v34, v35, v36, v37, v38, v39; +var v40, v41, v42, v43; + +function f() {} + +v1 = new Date(0); +v1.setMilliseconds(12); +v2 = eval("''"); +v3 = ""; +f((v2 + v3).indexOf(v3)); diff --git a/js/src/jit-test/tests/jaeger/bug650662.js b/js/src/jit-test/tests/jaeger/bug650662.js new file mode 100644 index 0000000000..4c4b2bc853 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug650662.js @@ -0,0 +1,6 @@ +test(); +function test() { + var a = []; + a*=3; + a.length; +} diff --git a/js/src/jit-test/tests/jaeger/bug650663.js b/js/src/jit-test/tests/jaeger/bug650663.js new file mode 100644 index 0000000000..786230fb34 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug650663.js @@ -0,0 +1,15 @@ +var cnBadSyntax = '1=2'; +var obj = new testObject; +f.call(obj); +g(); +function testObject() { + this.badSyntax = cnBadSyntax; +} +function f() { + try { + eval(this.badSyntax) + } catch (e) {} +} +function g() { + f.call(); +} diff --git a/js/src/jit-test/tests/jaeger/bug651147.js b/js/src/jit-test/tests/jaeger/bug651147.js new file mode 100644 index 0000000000..08971faa09 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug651147.js @@ -0,0 +1,7 @@ +var BUGNUMBER = 96284; +var BUGNUMBER = "410725"; +function iteratorToArray(iterator) { + var result = []; + for (var i in iterator) BUGNUMBER[result.length]; +} +try { obj = { a: 1, }('["a", "b"]', iteratorToArray(), 'uneval(iteratorToArray(new Iterator(obj,true)))'); } catch (e) { } diff --git a/js/src/jit-test/tests/jaeger/bug652305.js b/js/src/jit-test/tests/jaeger/bug652305.js new file mode 100644 index 0000000000..78df18aadf --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug652305.js @@ -0,0 +1,25 @@ +var sjcl = { + cipher: {}, +}; +var global = 99; +sjcl.cipher.aes = function (a) { + var b, c, d, e, f = this.h[0][4], + g = this.h[1]; + d = a.slice(0); + this.a = [d, []]; + for (a = 8; a < 60; a++) { + c = d[a - 1]; + if (a % 8 === 0) { + c = global; + if (0 === 0) { + h = 2; + } + } + d[a] = c; + } + assertEq(this.a[0][50], 99); +}; +sjcl.cipher.aes.prototype = { + h: [[[], [], [], [], [99, 0]], [[67175681, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 65537], [17039621, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 16777472], [83952641, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 65537], [17105156, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 16777472], []]], +}; +new sjcl.cipher.aes([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff]); diff --git a/js/src/jit-test/tests/jaeger/bug652314.js b/js/src/jit-test/tests/jaeger/bug652314.js new file mode 100644 index 0000000000..80b4a32084 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug652314.js @@ -0,0 +1,7 @@ +(function() { + for (a in [0]) { + try { + return + } catch(e) {} + } +})() diff --git a/js/src/jit-test/tests/jaeger/bug652590.js b/js/src/jit-test/tests/jaeger/bug652590.js new file mode 100644 index 0000000000..5709411a53 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug652590.js @@ -0,0 +1,5 @@ +function f() { + var x = undefined ? 1 : 4294967295; + print(false || x); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug653243.js b/js/src/jit-test/tests/jaeger/bug653243.js new file mode 100644 index 0000000000..53e9302803 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug653243.js @@ -0,0 +1,12 @@ +try { + obj[i] = "a"; +} catch (e) {} +var obj = { + p: 100 +}; +var name = "p"; +var a = []; +for (var i = 0; i < 10; i++) { + a[i] = obj[name]--; +} +assertEq(a.join(), '100,99,98,97,96,95,94,93,92,91'); diff --git a/js/src/jit-test/tests/jaeger/bug653249.js b/js/src/jit-test/tests/jaeger/bug653249.js new file mode 100644 index 0000000000..b85ddd743f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug653249.js @@ -0,0 +1,13 @@ + +function testUnaryImacros() { + function checkArg(x) { + o = { + valueOf: checkArg + } + } + var v = 0; + v += +toString; + for (var i = 0; i;) { + v += [].checkArg.checkArg; + } +}(testUnaryImacros(), "valueOf passed, toString passed"); diff --git a/js/src/jit-test/tests/jaeger/bug653397.js b/js/src/jit-test/tests/jaeger/bug653397.js new file mode 100644 index 0000000000..f17167fac1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug653397.js @@ -0,0 +1,16 @@ +try { + function testSlowArrayPopMultiFrame() { + a = undefined; + function parent(a, i) { i }; + function gramps(a, i) { + return parent; + } + var last; + for (var i = 0; ; gramps++) { + last = gramps(a, i) + } + }(testSlowArrayPopMultiFrame(), 23); + assertEq(0, 1); +} catch(e) { + assertEq(e instanceof TypeError, true); +} diff --git a/js/src/jit-test/tests/jaeger/bug655505.js b/js/src/jit-test/tests/jaeger/bug655505.js new file mode 100644 index 0000000000..4d2e07c668 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug655505.js @@ -0,0 +1,15 @@ +var a = [, , , , , , ]; +var res = 0; +exhaustiveSliceTest("exhaustive slice test 1", a); +function mySlice(a, from, to) { + var to2 = to; + if (to2 > 0) { + res += to2; + to2 = to2.length + to; + } +} +function exhaustiveSliceTest(testname, a) { x = a; } +for (y = a.length; y >= 0; y--) { + mySlice(a, x, y); +} +assertEq(res, 21); diff --git a/js/src/jit-test/tests/jaeger/bug655508.js b/js/src/jit-test/tests/jaeger/bug655508.js new file mode 100644 index 0000000000..712c1c0cf8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug655508.js @@ -0,0 +1,15 @@ +switch (3) { +case + function () { + var x; + (function () {})() && false; + x = undefined; + try { + JSON.parse(x) + } catch (e) {} + }([]): +case + function () { + [typeof loopa1] + }(0): +} diff --git a/js/src/jit-test/tests/jaeger/bug655810.js b/js/src/jit-test/tests/jaeger/bug655810.js new file mode 100644 index 0000000000..e31d56234c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug655810.js @@ -0,0 +1,6 @@ +function f(arr) { + var x = arr[0]; + if (typeof x) {}; + Math.abs(x); +} +f([1.2]); diff --git a/js/src/jit-test/tests/jaeger/bug655990.js b/js/src/jit-test/tests/jaeger/bug655990.js new file mode 100644 index 0000000000..4ca4fd1f6c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug655990.js @@ -0,0 +1,12 @@ +expect = 0; +summary = 0; +test(); +function test() { + function f(a, b, c) { + return c; + } + if (gczeal == 'function') actual = f(1.5, 1.25, 1.125) + else expect; + (expect, actual, summary); + var actual = ''; +} diff --git a/js/src/jit-test/tests/jaeger/bug656096.js b/js/src/jit-test/tests/jaeger/bug656096.js new file mode 100644 index 0000000000..63fdac76ba --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug656096.js @@ -0,0 +1,37 @@ +function aes(a) { + d = a.slice() + for (; a < 28; a++) + d[0] = d[0] ^ undefined +} +var sjcl = {}; +sjcl.bitArray = { + concat: function (a, b) { + return d ? a : []; + }, + clamp: function (a, b) { + return a + } +}; +function G(a, b, c, d, e, f) { + var g = [], + h = sjcl.bitArray, + f = []; + f = h.concat(f, c) + if (c) g = [] + else c = h.concat([], []) + h.concat(g, d) + h.clamp(f, [1,2,3]) +} +function decrypt(a, b, c, d, e) { + G(a, 1, c, d, e, b) + var g = [], + h = sjcl.bitArray, + f = []; + h.concat(f, c) + if (c) g = [] + else c = h.concat([], []) + h.concat(g, d) + h.concat([], c).concat.slice +} +aes(sjcl.bitArray.clamp([])); +decrypt(1, 2, 3); diff --git a/js/src/jit-test/tests/jaeger/bug656252.js b/js/src/jit-test/tests/jaeger/bug656252.js new file mode 100644 index 0000000000..07b0f94f1f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug656252.js @@ -0,0 +1,14 @@ +o14 = [undefined].__proto__ +function f18() { + try { + [] = o[p] + } catch (e) {} +} +for (var i; i < 20; i++) { + ({ + x: function() { + return eval("o14") + } + }.x().__proto__ = null); + f18() +} diff --git a/js/src/jit-test/tests/jaeger/bug656259.js b/js/src/jit-test/tests/jaeger/bug656259.js new file mode 100644 index 0000000000..35de217265 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug656259.js @@ -0,0 +1,11 @@ + +function throwsRangeError(t) { + try { + t: for (t[t++] in object) { + t++ + break t; + } + date(t) + } catch (err) {} +} +throwsRangeError(Infinity); diff --git a/js/src/jit-test/tests/jaeger/bug656591.js b/js/src/jit-test/tests/jaeger/bug656591.js new file mode 100644 index 0000000000..8d86cdf2b5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug656591.js @@ -0,0 +1,9 @@ +// |jit-test| error: TypeError +(function () { + var i = 0; + (function () { + var x; + (x = "3") || 1; + (x = "")(i || x); + })(); +})(); diff --git a/js/src/jit-test/tests/jaeger/bug656748.js b/js/src/jit-test/tests/jaeger/bug656748.js new file mode 100644 index 0000000000..fd0cb2c110 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug656748.js @@ -0,0 +1,8 @@ +function f() { + var x = -0; + x++; + if (3 > 2) {}; + var y = x + 2.14; + assertEq(y, 3.14); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug656914.js b/js/src/jit-test/tests/jaeger/bug656914.js new file mode 100644 index 0000000000..e57e0a9747 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug656914.js @@ -0,0 +1,23 @@ +try { + new MyObject; +} catch (e) {} + +function MyObject() { + return; + return this; +} + +function Foo(x) { + if (x) + this.f = x; +} +var q = new Foo(false); +for (a in q) { assertEq(true, false); } + +function Bar(x, y) { + if (!x) + return; + this.f = y; +} +var q2 = new Bar(false, true); +for (b in q2) { assertEq(true, false); } diff --git a/js/src/jit-test/tests/jaeger/bug657120.js b/js/src/jit-test/tests/jaeger/bug657120.js new file mode 100644 index 0000000000..6e8af1a495 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug657120.js @@ -0,0 +1,6 @@ +function f() { + var x = Object(2); + var y = 3.14; + assertEq(true && x < y, true); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug657247.js b/js/src/jit-test/tests/jaeger/bug657247.js new file mode 100644 index 0000000000..539cdf55c9 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug657247.js @@ -0,0 +1,5 @@ + +a = new Array; +for (var i = 0; i != 1000; ++i) a[i] = 17; +var x = '123' + '\0' + '456'; +(1, a[x], ': 123\\0456'); diff --git a/js/src/jit-test/tests/jaeger/bug657890.js b/js/src/jit-test/tests/jaeger/bug657890.js new file mode 100644 index 0000000000..1d74fc48cb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug657890.js @@ -0,0 +1,6 @@ +function f() {}; +var x; +for(var i=0; i<200; i++) { + x = f.bind(x, x, 2); + gc(); +} diff --git a/js/src/jit-test/tests/jaeger/bug658240.js b/js/src/jit-test/tests/jaeger/bug658240.js new file mode 100644 index 0000000000..033f2fbdab --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug658240.js @@ -0,0 +1,11 @@ +function f() { + var x = 0; + for(var i=0; i<5; i++) { + (function() { + var q = parseFloat("2"); + x += q; + })(); + } + return x; +} +assertEq(f(), 10); diff --git a/js/src/jit-test/tests/jaeger/bug658294.js b/js/src/jit-test/tests/jaeger/bug658294.js new file mode 100644 index 0000000000..e1496b9614 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug658294.js @@ -0,0 +1,15 @@ +test(); +function test() +{ + try { + instances = [] + for (var i = 0; i != 2; ++i) + instances[i]=constructor + var i = 0; + var instance = instances[i]; + var name = instance.name; + for (var j = 1; j != instances; ++j) + if (i != j && instance instanceof name[j].constructor) {} + } catch(ex) {} +} +test(); diff --git a/js/src/jit-test/tests/jaeger/bug658579.js b/js/src/jit-test/tests/jaeger/bug658579.js new file mode 100644 index 0000000000..7affcbd5fb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug658579.js @@ -0,0 +1,5 @@ +(function () { + var x = 1 || 1.2; + true ? ~x : x; + x >> x; +})(); diff --git a/js/src/jit-test/tests/jaeger/bug658968.js b/js/src/jit-test/tests/jaeger/bug658968.js new file mode 100644 index 0000000000..74a15afa19 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug658968.js @@ -0,0 +1,13 @@ +function f(){ + var tarr = []; + var elemArray = [ + {name: "C0", checked: true}, + {name: "C1", checked: false}, + ]; + for (var i = 0; i < elemArray.length; i++) { + var element = elemArray[i]; + tarr[i] = (element.checked == true) ? 1 : 2; + } + assertEq(tarr.join(""), "12"); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug659438.js b/js/src/jit-test/tests/jaeger/bug659438.js new file mode 100644 index 0000000000..fddfe6a026 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug659438.js @@ -0,0 +1,8 @@ +var o1 = {x: {}}; +function f() { + var o = o1; + for(var i=0; i<10; i++) { + o1 = o.x; + } +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug659439.js b/js/src/jit-test/tests/jaeger/bug659439.js new file mode 100644 index 0000000000..e83afebfd1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug659439.js @@ -0,0 +1,16 @@ +function bind(f) { + return f.call.apply(f.bind, arguments); +}; +function h(a, b) { + a.x; +} +function g(a, b) { + a.x = b; + h(a); +} +function f() { + for(var i=0; i<20; i++) { + g.call(this, {}, bind(function(){})); + } +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug659448.js b/js/src/jit-test/tests/jaeger/bug659448.js new file mode 100644 index 0000000000..d9d7c9f16e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug659448.js @@ -0,0 +1,9 @@ +function TestCase(n, d, e, a) { + this.expect = e; + this.passed = getTestCaseResult(this.expect, this.actual); +} +function getTestCaseResult(expect, actual) {} +new TestCase( + TestCase(3000000000.5) +); +new TestCase(null,null, String('Sally and Fred are sure to come'.match(/^[a-z\s]*/i))); diff --git a/js/src/jit-test/tests/jaeger/bug659456.js b/js/src/jit-test/tests/jaeger/bug659456.js new file mode 100644 index 0000000000..b2155f000c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug659456.js @@ -0,0 +1,12 @@ +// |jit-test| error: InternalError +function foo() { return "tracejit,methodjit"; }; +function baz(on) { + foo('bar'); +} +eval("\ +test();\ +function test() {\ + baz(true);\ + test();\ +}\ +"); diff --git a/js/src/jit-test/tests/jaeger/bug660002.js b/js/src/jit-test/tests/jaeger/bug660002.js new file mode 100644 index 0000000000..f1bc7ab737 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug660002.js @@ -0,0 +1,4 @@ +// |jit-test| error: ReferenceError +(function() { + let V = x(x, x = w), x +})() diff --git a/js/src/jit-test/tests/jaeger/bug662072.js b/js/src/jit-test/tests/jaeger/bug662072.js new file mode 100644 index 0000000000..04c198ccdd --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug662072.js @@ -0,0 +1,7 @@ +(function () { + var x; + x = arguments.length; + return function () { + [1][x = arguments.length]; + }; +}).call().apply(); diff --git a/js/src/jit-test/tests/jaeger/bug662082.js b/js/src/jit-test/tests/jaeger/bug662082.js new file mode 100644 index 0000000000..533fee8ba3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug662082.js @@ -0,0 +1,11 @@ + +function foo(z) +{ + var x = 2; + if (z) { + x = 2.5; + } + var y = x * 10; + assertEq(y, 20); +} +foo(false); diff --git a/js/src/jit-test/tests/jaeger/bug663485.js b/js/src/jit-test/tests/jaeger/bug663485.js new file mode 100644 index 0000000000..3e177e406a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug663485.js @@ -0,0 +1,17 @@ +function makeExpectedMatch(arr) { + expectedMatch = { + x: arr.length + } +} +var expected = makeExpectedMatch(new Int32Array); +JSON.stringify(this); + +function testTypedArrayOther() { + var ar = new Int32Array; + for (; i < ar; ++i) { + ar[i] = i; + } + for (var i = 0; i<40; i++) { + } +} +testTypedArrayOther(); diff --git a/js/src/jit-test/tests/jaeger/bug663910.js b/js/src/jit-test/tests/jaeger/bug663910.js new file mode 100644 index 0000000000..33997a3c4c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug663910.js @@ -0,0 +1,22 @@ +var otherGlobalSameCompartment = newGlobal("same-compartment"); +eval = otherGlobalSameCompartment.eval; +doesNotNeedParens(1, "if (xx) { }"); +needParens(2, "if (1, xx) { }"); +function doesNotNeedParens(section, pat) { + try { + f = new Function + } catch (e) {} + roundTripTest(section, f) +} +function needParens(section, pat, exp) { + var f, ft; + roundTripTest(section, f, exp) +} +function roundTripTest(section, f, exp) { + uf = "" + f + var euf; + try { + euf = eval("(" + uf + ")"); + } catch (e) { } + + euf +} diff --git a/js/src/jit-test/tests/jaeger/bug669706.js b/js/src/jit-test/tests/jaeger/bug669706.js new file mode 100644 index 0000000000..a3ddb43588 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug669706.js @@ -0,0 +1,14 @@ +function printStatus(msg) { + msg.toString() + lines = msg + for (var i = 0; i < lines; i++) i +} +var summary = new Float32Array; +try { + printStatus(summary) + x = { + } + toString.__proto__ = x +} catch (e) {} +var summary = 6; +printStatus(summary) diff --git a/js/src/jit-test/tests/jaeger/bug670885.js b/js/src/jit-test/tests/jaeger/bug670885.js new file mode 100644 index 0000000000..a1d8bcbe7b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug670885.js @@ -0,0 +1,16 @@ +// arr is an Int8Array, then changes to Int16Array. +// This should trigger recompilation of f. +var arr = new Int8Array(100); +var arr16 = new Int16Array(100); +arr16[2] = 12345; +function f(a) { + var x; + for(var i=0; i<30; i++) { + x = a[2]; + } + return x; +} +assertEq(f(arr), 0); +assertEq(f(arr), 0); +this.arr = arr16; +assertEq(f(arr), 12345); diff --git a/js/src/jit-test/tests/jaeger/bug672122.js b/js/src/jit-test/tests/jaeger/bug672122.js new file mode 100644 index 0000000000..14802554e2 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug672122.js @@ -0,0 +1,3 @@ +// |jit-test| error: ReferenceError + +if (x) {} else if ((evalcx('lazy'))++) {} diff --git a/js/src/jit-test/tests/jaeger/bug678234.js b/js/src/jit-test/tests/jaeger/bug678234.js new file mode 100644 index 0000000000..52a421553a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug678234.js @@ -0,0 +1,10 @@ +a = {} +function f(o) { + for (x in o) { + print + } +} +for (var i = 0; i < 3; i++) { + new f(a) + a.__proto__ = null +} diff --git a/js/src/jit-test/tests/jaeger/bug678782.js b/js/src/jit-test/tests/jaeger/bug678782.js new file mode 100644 index 0000000000..1549bbe770 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug678782.js @@ -0,0 +1,9 @@ +var i = -1; var j = -1; var s = ''; var f = ''; +var buf = serialize(new Date(NaN)); +var a = [1/0, -1/0, 8.64e15 + 1, -(8.64e15 + 1)]; +for (var i = 0; i < a.length; i++) { + var n = a[i]; + var nbuf = serialize(n); + for (var Number ; j < 8; j++) + buf[j + 8] = nbuf[j]; +} diff --git a/js/src/jit-test/tests/jaeger/bug679666.js b/js/src/jit-test/tests/jaeger/bug679666.js new file mode 100644 index 0000000000..986195ebc3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug679666.js @@ -0,0 +1,22 @@ +var arr = new Int32Array(20); + +function f(a1, a2) { + for (var i=0; i<10; i++) { + g1 = a2; + arr[a1] = a2; + assertEq(g1, a2); + + if ([1].length === 10) { + a1 = {}; + } + } +} + +f(1, eval("{}")); + +for (var i=0; i<5; i++) { + f(2, 3); + f(5, -6.1); +} +assertEq(arr[2], 3); +assertEq(arr[5], -6); diff --git a/js/src/jit-test/tests/jaeger/bug680842.js b/js/src/jit-test/tests/jaeger/bug680842.js new file mode 100644 index 0000000000..016673fb72 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug680842.js @@ -0,0 +1,27 @@ + +var gTestcases = new Array; +var gTc = gTestcases; +var msg = ''; +function TestCase(n, d, e, a) { + gTestcases[gTc++]=this; +} +TestCase.prototype.dump=function () { + lines = msg + for (var i=0; i<lines; ) { } +} +function writeHeaderToLog( string ) { + for (var i = 0; ; i++) { + gTestcases[i].dump(); + } +} +try { + TIME_2000 = 946684800000 +} catch (exc1) {} +addNewTestCase( Date, 999 ); +try { + addNewTestCase( Date,TIME_2000 )( writeHeaderToLog( 2000,0,1,0,0,0,0), 0 ); +} catch (exc2) {} +function addNewTestCase( DateCase, DateString, ResultArray ) { + new TestCase + Date.prototype=new TestCase +} diff --git a/js/src/jit-test/tests/jaeger/bug681006.js b/js/src/jit-test/tests/jaeger/bug681006.js new file mode 100644 index 0000000000..56e6167658 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug681006.js @@ -0,0 +1,10 @@ +// |jit-test| error: ReferenceError +function f0(p0,p1) { + var v3; + do { + p1 > v3 + v3=1.7 + } while (p1 * v0 > p0); + + v3; +} +f0(4105,8307); diff --git a/js/src/jit-test/tests/jaeger/bug682345.js b/js/src/jit-test/tests/jaeger/bug682345.js new file mode 100644 index 0000000000..94d610748d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug682345.js @@ -0,0 +1,16 @@ +// |jit-test| error: TypeError + +for (var i = 0; i <= 0x017f; i++) { + var U = new Unicode(i); +} +function Unicode(c) { + u = GetUnicodeValues(c); + this.upper = u[0]; +} +function GetUnicodeValues(c) { + u = new Array(); + if ((c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178)) try {} finally { + return; + } + return u; +} diff --git a/js/src/jit-test/tests/jaeger/bug684084-2.js b/js/src/jit-test/tests/jaeger/bug684084-2.js new file mode 100644 index 0000000000..34ddae320a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug684084-2.js @@ -0,0 +1,8 @@ +function Function() { + try { + var g = this; + g.c("evil", eval); + } catch(b) {} +} +var o0 = Function.prototype; +var f = new Function( (null ) ); diff --git a/js/src/jit-test/tests/jaeger/bug684084.js b/js/src/jit-test/tests/jaeger/bug684084.js new file mode 100644 index 0000000000..ac2c11a384 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug684084.js @@ -0,0 +1,7 @@ +// |jit-test| error: TypeError +function Integer( value, exception ) { + try { } catch ( e ) { } + new (value = this)( this.value ); + if ( Math.floor(value) != value || isNaN(value) ) { } +} +new Integer( 3, false ); diff --git a/js/src/jit-test/tests/jaeger/bug684576.js b/js/src/jit-test/tests/jaeger/bug684576.js new file mode 100644 index 0000000000..b845d2160d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug684576.js @@ -0,0 +1,10 @@ +// |jit-test| error: TypeError +function f0(p0,p1) { + var v3; + do { + p1 > v3 + v3=1.7 + } while (((p0[p1][5]==1)||(p0[p1][5]==2)||(p0[p1][5] == 3)) + 0 > p0); + + (v3(f0)); +} +f0(4105,8307); diff --git a/js/src/jit-test/tests/jaeger/bug684824.js b/js/src/jit-test/tests/jaeger/bug684824.js new file mode 100644 index 0000000000..9e8ad9c7ee --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug684824.js @@ -0,0 +1,7 @@ + +function X(n) { + while ('' + (n--)) { + break; + } +} +X(); diff --git a/js/src/jit-test/tests/jaeger/bug684943.js b/js/src/jit-test/tests/jaeger/bug684943.js new file mode 100644 index 0000000000..69ec5ca2bd --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug684943.js @@ -0,0 +1,7 @@ + +function foo(x) { + for (var i = 0; i < 100; i++) { + x.f === i; + } +} +foo({f:"three"}); diff --git a/js/src/jit-test/tests/jaeger/bug687768.js b/js/src/jit-test/tests/jaeger/bug687768.js new file mode 100644 index 0000000000..a4b2b4adeb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug687768.js @@ -0,0 +1,17 @@ + +expected = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,'; +function slice(a, b) { + return expected; +} +function f() { + var length = 4; + var index = 0; + function get3() { + if (length - index < 3) + return null; + return slice(index, ++index); + } + var bytes = null; + while (bytes = get3()) { } +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug693311.js b/js/src/jit-test/tests/jaeger/bug693311.js new file mode 100644 index 0000000000..39d69ab257 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug693311.js @@ -0,0 +1,8 @@ +function f(x) { + assertEq("a" !== x, true); + assertEq("b" != x, true); + assertEq("c" === x, false); + assertEq("d" == x, false); +} +f(1); +f(1); diff --git a/js/src/jit-test/tests/jaeger/bug704138.js b/js/src/jit-test/tests/jaeger/bug704138.js new file mode 100644 index 0000000000..71e4958875 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug704138.js @@ -0,0 +1,21 @@ +load(libdir + "immutable-prototype.js"); + +function TestCase(n, d, e, a) { + this.name=n; + return n; +} + +function reportCompare (expected, actual, description) { + new TestCase +} + +reportCompare(true, "isGenerator" in Function, "Function.prototype.isGenerator present"); +var p = new Proxy({}, {}); +function test() { + TestCase.prototype.__proto__=null + if (new TestCase) + TestCase.prototype.__proto__=p +} +test(); +new TestCase; +test() diff --git a/js/src/jit-test/tests/jaeger/bug705873.js b/js/src/jit-test/tests/jaeger/bug705873.js new file mode 100644 index 0000000000..1d4d65246a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug705873.js @@ -0,0 +1,7 @@ +a = [] +function f(o) { + o[5] = {} +} +for (var i = 0; i < 20; i++) { + with(a) f(a) +} diff --git a/js/src/jit-test/tests/jaeger/bug706110.js b/js/src/jit-test/tests/jaeger/bug706110.js new file mode 100644 index 0000000000..ef1e657ca6 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug706110.js @@ -0,0 +1,18 @@ +function test() { + function Bug() { this.prototype } + var actual = (new Bug instanceof Bug); + assertEq(actual, true); +} +test(); +test(); + +function testLambdaCtor() { + var q; + for (var x = 0; x < 2; ++x) { + var f = function(){}; + if (x == 1) gc(); + q = new f; + } + return q.__proto__ === f.prototype; +} +assertEq(testLambdaCtor(), true); diff --git a/js/src/jit-test/tests/jaeger/bug707641.js b/js/src/jit-test/tests/jaeger/bug707641.js new file mode 100644 index 0000000000..3df5893941 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug707641.js @@ -0,0 +1,7 @@ +function a(a, prototype) { + try { + typeof (arguments[a]) in code + } catch(e) {} +} +a(); +a(); diff --git a/js/src/jit-test/tests/jaeger/bug709067.js b/js/src/jit-test/tests/jaeger/bug709067.js new file mode 100644 index 0000000000..3e3bd70b8b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug709067.js @@ -0,0 +1,11 @@ +called = 0; +Object.defineProperty(Object.prototype, 0, {set: function() { called++; }}); +function testInit() +{ + var a = []; + for (var i = 0; i < 5; i++) + a[i] = 0; +} +for (var i = 0; i < 100; i++) + testInit(); +assertEq(called, 100); diff --git a/js/src/jit-test/tests/jaeger/bug710780.js b/js/src/jit-test/tests/jaeger/bug710780.js new file mode 100644 index 0000000000..84d2646921 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug710780.js @@ -0,0 +1,12 @@ + +function foo() { + function bar() { + function baz() { + assertEq(arguments.callee.caller === null, false); + } + for (var i = 0; i < 10; i++) + baz(); + } + bar(); +} +foo(); diff --git a/js/src/jit-test/tests/jaeger/bug714645.js b/js/src/jit-test/tests/jaeger/bug714645.js new file mode 100644 index 0000000000..2bcfa25982 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug714645.js @@ -0,0 +1,12 @@ + +function testAddInconvertibleObjectAny() { + var count = 0; + function toString() { } + try { + for (var i = 0; i < 100; i++) + var q = count[count] && this ? testAddInconvertibleObjectAny : ++toString; + } catch (e) { + var dbg = count(toString); + } +} +testAddInconvertibleObjectAny(); diff --git a/js/src/jit-test/tests/jaeger/bug719918.js b/js/src/jit-test/tests/jaeger/bug719918.js new file mode 100644 index 0000000000..388189269e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug719918.js @@ -0,0 +1,17 @@ +function test(m) { + do { + if (m = arr[0]) break; + m = 0; + } + while (0); + arr[1] = m; +} + +arr = new Float64Array(2); + +// run function a lot to trigger methodjit compile +for(var i=0; i<200; i++) + test(0); + +// should return 0, not NaN +assertEq(arr[1], 0) diff --git a/js/src/jit-test/tests/jaeger/bug732423.js b/js/src/jit-test/tests/jaeger/bug732423.js new file mode 100644 index 0000000000..caf6d116d8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug732423.js @@ -0,0 +1,22 @@ +function testStuff(x, y) { + for (var i = 0; i < 60; i++) { + x[y](); + x[y]; + } +} +testStuff({"elements":function(){}}, "elements"); + +var o = { + res: 0, + f: function() { this.res += 3; }, + __noSuchMethod__: function() { this.res += 5; } +}; + +function testNoSuchMethod(x, y) { + for (var i = 0; i < 60; i++) { + x[y](); + } +} + +testNoSuchMethod(o, "f"); +assertEq(o.res, 180); diff --git a/js/src/jit-test/tests/jaeger/bug735161.js b/js/src/jit-test/tests/jaeger/bug735161.js new file mode 100644 index 0000000000..c127253fa1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug735161.js @@ -0,0 +1,4 @@ +var obj = {valueOf: function() { "use strict"; undeclared = 7; }}; +try { '' + obj; assertEq(true, false); } catch(e) { } +try { '' + obj; assertEq(true, false); } catch(e) { } +assertEq("undeclared" in this, false); diff --git a/js/src/jit-test/tests/jaeger/bug738525.js b/js/src/jit-test/tests/jaeger/bug738525.js new file mode 100644 index 0000000000..0e531fa455 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug738525.js @@ -0,0 +1,37 @@ +// Test IC for getters backed by a JSNative. +function test1() { + for (var i = 0; i < 60; i++) { + assertEq(it.customNative, undefined); + } + + var res = 0; + for (var i = 0; i < 60; i++) { + it.customNative = i; + res += it.customNative; + } + + assertEq(res, 1770); +} +function test2() { + function getValue() { + return it.customNative; + } + + for (var i = 0; i < 60; i++) { + it.customNative = i; + assertEq(getValue(), i); + } + + for (var i = 0; i < 60; i++) { + it.customNative = null; + assertEq(getValue(), null); + + delete it["customNativ" + "e"]; + assertEq(getValue(), undefined); + assertEq(it.customNative, undefined); + } +} +if ("it" in this) { + test1(); + test2(); +} diff --git a/js/src/jit-test/tests/jaeger/bug742393.js b/js/src/jit-test/tests/jaeger/bug742393.js new file mode 100644 index 0000000000..76d7d5f1c7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug742393.js @@ -0,0 +1,11 @@ +var global = 0; +Object.defineProperty(Array.prototype, "2", {get: function() { return global++; }}); + +function f() { + var a = []; + var b = [0, 1, , 3]; + for (var i=0; i<100; i++) + var c = a.concat(b); + assertEq(c[2], 99); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/bug751320.js b/js/src/jit-test/tests/jaeger/bug751320.js new file mode 100644 index 0000000000..2013150aa7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug751320.js @@ -0,0 +1,22 @@ +datediff = function(date1, date2, interval) { + var delta = 1; + switch(interval) { + case "day": + delta /= 24; + case "hour": + delta /= 60; + case "minute": + delta /= 60; + case "second": + delta /= 1000; + case "millisecond": + delta *= date2.getTime() - date1.getTime(); + } + return Math.round(delta); +}; + +var diff = datediff(new Date("2012-04-28T14:30:00Z"), new Date("2012-04-29T14:30:00Z"), "day"); +for (var i = 0; i < 50; i++) { + diff = datediff(new Date("2012-04-28T17:00:00Z"), new Date("2012-04-28T17:30:00Z"), "minute"); + assertEq(diff, 30); +} diff --git a/js/src/jit-test/tests/jaeger/bug767961.js b/js/src/jit-test/tests/jaeger/bug767961.js new file mode 100644 index 0000000000..b5516bd01e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug767961.js @@ -0,0 +1,6 @@ +function C() { + this.x = this[this.y = "foo"]--; +} + +// Don't crash. +new C; diff --git a/js/src/jit-test/tests/jaeger/bug768313.js b/js/src/jit-test/tests/jaeger/bug768313.js new file mode 100644 index 0000000000..1062354879 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug768313.js @@ -0,0 +1,6 @@ +// |jit-test| --dump-bytecode + +function f() { } +evaluate('function g() { f(); }'); +for (var i = 0; i < 2; i++) + g(0); diff --git a/js/src/jit-test/tests/jaeger/bug769985.js b/js/src/jit-test/tests/jaeger/bug769985.js new file mode 100644 index 0000000000..39c6a056b4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug769985.js @@ -0,0 +1,19 @@ + +/* Make sure ints are converted to doubles as needed at the head of loops which modify those ints. */ + +function bar() {} + +function foo() { + var n = 0.5; + n -= 0.5; + var iters = 0; + for (var i = n;; ) { + bar(); + iters++; + if (i == 100) + break; + i = (i + 1) | 0; + } + assertEq(iters, 101); +} +foo(); diff --git a/js/src/jit-test/tests/jaeger/bug771871.js b/js/src/jit-test/tests/jaeger/bug771871.js new file mode 100644 index 0000000000..23d91aab26 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug771871.js @@ -0,0 +1,7 @@ +function test() { + var box = { call: function () { return 42.1; } }; + for (var i = 0; i < 50; i++) { + assertEq(box.call(undefined, 42.1), 42.1); + } +} +test(); diff --git a/js/src/jit-test/tests/jaeger/bug781859-1.js b/js/src/jit-test/tests/jaeger/bug781859-1.js new file mode 100644 index 0000000000..7a28c02b77 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug781859-1.js @@ -0,0 +1,25 @@ +// |jit-test| error:ReferenceError +function e() { + try {} catch (e) { + return (actual = "FAIL"); + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + a.x + } + while (t) continue; +} +e(); diff --git a/js/src/jit-test/tests/jaeger/bug781859-2.js b/js/src/jit-test/tests/jaeger/bug781859-2.js new file mode 100644 index 0000000000..e738bc0883 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug781859-2.js @@ -0,0 +1,8 @@ +Function("\ + switch (/x/) {\ + case 8:\ + break;\ + t(function(){})\ + }\ + while (false)(function(){})\ +")() diff --git a/js/src/jit-test/tests/jaeger/bug781859-3.js b/js/src/jit-test/tests/jaeger/bug781859-3.js new file mode 100644 index 0000000000..ab3f39b289 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug781859-3.js @@ -0,0 +1,9 @@ +function e() { + try { + var t = undefined; + } catch (e) { } + while (t) + continue; +} +for (var i = 0; i < 20; i++) + e(); diff --git a/js/src/jit-test/tests/jaeger/bug819035.js b/js/src/jit-test/tests/jaeger/bug819035.js new file mode 100644 index 0000000000..846310b2a2 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug819035.js @@ -0,0 +1,38 @@ +// This test case check the difference between fp->callee() and fp->fun() on +// lambdas. +(function (a, u) { + var sum = function (array, callback) { + for (var i = 0; i < array.length; i++) + callback(array[i]); + }; + (function () { + (function r(t) { + t !== u, + sum(t, function (v) { return r(v); } ); + })(arguments); + })(a); +}) ( + [ + [ + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1] + ], [ + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1] + ] + ] +); diff --git a/js/src/jit-test/tests/jaeger/bug825966.js b/js/src/jit-test/tests/jaeger/bug825966.js new file mode 100644 index 0000000000..44e165d333 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/bug825966.js @@ -0,0 +1,18 @@ +datediff = function(date1, date2, interval) { + var delta = 1; + switch(interval) { + case "day": + delta /= 24; + case "minute": + delta /= 60; + case Math: + break; + } + return delta; +}; + +var diff = datediff(new Date("2012-04-28T14:30:00Z"), new Date("2012-04-29T14:30:00Z"), "day"); +for (var i = 0; i < 50; i++) { + diff = datediff(new Date("2012-04-28T17:00:00Z"), new Date("2012-04-28T17:30:00Z"), "minute"); + assertEq(diff, 1/60); +} diff --git a/js/src/jit-test/tests/jaeger/chunk/bug712267.js b/js/src/jit-test/tests/jaeger/chunk/bug712267.js new file mode 100644 index 0000000000..929d4d5b73 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/chunk/bug712267.js @@ -0,0 +1,14 @@ +expected = 100; +function slice(a, b) { + return expected--; +} +function f() { + var length = 8.724e02 ; + var index = 0; + function get3() { + return slice(index, ++index); + } + var bytes = null; + while (bytes = get3()) { } +} +f(); diff --git a/js/src/jit-test/tests/jaeger/clonefun.js b/js/src/jit-test/tests/jaeger/clonefun.js new file mode 100644 index 0000000000..950ae39227 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/clonefun.js @@ -0,0 +1,17 @@ + +// Functions which have been marked as singletons should not be cloned. + +BeatDetektor = function() +{ + this.config = BeatDetektor.config; + + assertEq(this.config.a, 0); + assertEq(this.config.b, 1); +} + +BeatDetektor.config_default = { a:0, b:1 }; +BeatDetektor.config = BeatDetektor.config_default; + +var bd = new BeatDetektor(); + +assertEq(bd.config === BeatDetektor.config, true); diff --git a/js/src/jit-test/tests/jaeger/closure-01.js b/js/src/jit-test/tests/jaeger/closure-01.js new file mode 100644 index 0000000000..4c82b6fd35 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/closure-01.js @@ -0,0 +1,18 @@ + +/* Non-reentrant call on an inner and outer closure. */ + +function foo() { + var x = 0; + function bar() { + var y = 0; + function baz() { + return ++x + ++y; + } + return baz; + } + return bar(); +} + +var a = foo(); +var b = foo(); +assertEq(a() + a() + b() + b(), 12); diff --git a/js/src/jit-test/tests/jaeger/closure-02.js b/js/src/jit-test/tests/jaeger/closure-02.js new file mode 100644 index 0000000000..902c8f5ae7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/closure-02.js @@ -0,0 +1,14 @@ + +/* Non-reentrant closure used in an invoke session. */ + +var last = null; + +var a = [1,2,3,4,5,6,7,8]; +var b = a.map(function(x) { + x++; + var res = last ? last() : 0; + last = function() { return x; }; + return res; + }); + +assertEq("" + b, "0,2,3,4,5,6,7,8"); diff --git a/js/src/jit-test/tests/jaeger/closure-03.js b/js/src/jit-test/tests/jaeger/closure-03.js new file mode 100644 index 0000000000..e2d1ebe3f8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/closure-03.js @@ -0,0 +1,15 @@ + +/* Recovering non-reentrant information on singletons after a GC. */ + +function foo(a) { + return function() { + gc(); + var n = 0; + for (var i = 0; i < 20; i++) + n = a++; + assertEq(n, 29); + }; +} +var a = foo(10); +var b = foo(20); +a(); diff --git a/js/src/jit-test/tests/jaeger/closure-04.js b/js/src/jit-test/tests/jaeger/closure-04.js new file mode 100644 index 0000000000..10f8e447a1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/closure-04.js @@ -0,0 +1,30 @@ +var depth = 0; +test(); +function test() { + // |test()| is called recursively. When the generator runs in the JIT, the + // recursion limit is ~20x higher than in the interpreter. Limit the depth + // here so that the test doesn't timeout or becomes extremely slow. + if (++depth > 400) + return; + + var catch1, catch2, catch3, finally1, finally2, finally3; + function* gen() { + yield 1; + try { + try { + try { + yield 1; + } finally { + test(); + } + } catch (e) { + finally2 = true; + } + } catch (e) { } + } + iter = gen(); + iter.next(); + iter.next(); + iter.return(); + gc(); +} diff --git a/js/src/jit-test/tests/jaeger/closure-05.js b/js/src/jit-test/tests/jaeger/closure-05.js new file mode 100644 index 0000000000..b2aeffa365 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/closure-05.js @@ -0,0 +1,17 @@ +var gTestcases = new Array(); +var gTc = gTestcases.length; +function TestCase(n, d, e, a) { + gTestcases[gTc++] = this; +} +new TestCase("SECTION", "with MyObject, eval should return square of "); +test(); +function test() { + for (gTc = 0; gTc < gTestcases.length; gTc++) { + var MYOBJECT = (function isPrototypeOf(message) { + delete input; + })(); + with({}) { + gTestcases[gTc].actual = eval(""); + } + } +} diff --git a/js/src/jit-test/tests/jaeger/compare-wrong-1.js b/js/src/jit-test/tests/jaeger/compare-wrong-1.js new file mode 100644 index 0000000000..dec3ada457 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/compare-wrong-1.js @@ -0,0 +1,4 @@ +function f(a) { return a; } +assertEq(print < f, false); +assertEq(print > f, true); + diff --git a/js/src/jit-test/tests/jaeger/crash-on-compare.js b/js/src/jit-test/tests/jaeger/crash-on-compare.js new file mode 100644 index 0000000000..5abd7aa045 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/crash-on-compare.js @@ -0,0 +1 @@ +assertEq(Infinity >= Infinity ? true : false, true); diff --git a/js/src/jit-test/tests/jaeger/deepBailAfterRunTracer.js b/js/src/jit-test/tests/jaeger/deepBailAfterRunTracer.js new file mode 100644 index 0000000000..63399a4743 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/deepBailAfterRunTracer.js @@ -0,0 +1,25 @@ +var o = { }; +for (var i = 0; i <= 50; i++) + o[i] = i; + +Object.defineProperty(o, "51", { get: assertEq }); + +var threw = 0; +function g(o, i) { + try { + assertEq(o[i], i); + } catch (e) { + threw++; + } +} + +function f() { + for (var i = 0; i <= 51; i++) + g(o, i); +} + +f(); +f(); +f(); +assertEq(threw, 3); + diff --git a/js/src/jit-test/tests/jaeger/floatTypedArrays.js b/js/src/jit-test/tests/jaeger/floatTypedArrays.js new file mode 100644 index 0000000000..51ea7c0a16 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/floatTypedArrays.js @@ -0,0 +1,64 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function testFloat32Array(L) { + var f = new Float32Array(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13.5; + f[2] = f[1]; + f[L+3] = 4294967295; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13.5); + assertEq(f[2], 13.5); + assertEq(f[3], 4294967296); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +function testFloat64Array(L) { + var f = new Float64Array(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13.5; + f[2] = f[1]; + f[L+3] = 4294967295; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13.5); + assertEq(f[2], 13.5); + assertEq(f[3], 4294967295); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +function testNaNCanonicalization() { + var buf = new ArrayBuffer(128); + + var u8 = new Uint8Array(buf); + for (var i = 0; i < 128; i++) + u8[i] = 0xFF; + + var dblarr = new Float64Array(buf); + var asstr = dblarr[0] + ""; + var asnum = dblarr[0] + 0.0; + assertEq(asstr, "NaN"); + assertEq(asnum, NaN); +} + +for (var i = 0; i < 10; i++) { + //testFloat32Array(0); + //testFloat64Array(0); + testNaNCanonicalization(); + if (i == 5) + gc(); +} + diff --git a/js/src/jit-test/tests/jaeger/fromCharCode.js b/js/src/jit-test/tests/jaeger/fromCharCode.js new file mode 100644 index 0000000000..971878372d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/fromCharCode.js @@ -0,0 +1,8 @@ +/* +* Any copyright is dedicated to the Public Domain. +* http://creativecommons.org/licenses/publicdomain/ +*/ + +for (var i = 0; i <= 0xFFFF; i++) { + assertEq(String.fromCharCode(i).charCodeAt(0), i); +} diff --git a/js/src/jit-test/tests/jaeger/fused-eq-ifeq.js b/js/src/jit-test/tests/jaeger/fused-eq-ifeq.js new file mode 100644 index 0000000000..b5d2bf2f61 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/fused-eq-ifeq.js @@ -0,0 +1,6 @@ +function ack(m,n){ + if (m==0) { return n+1; } + if (n==0) { return ack(m-1,1); } + return ack(m-1, ack(m,n-1) ); +} +assertEq(ack(3, 3), 61); diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-1.js b/js/src/jit-test/tests/jaeger/getelem-sanity-1.js new file mode 100644 index 0000000000..4bad91eccb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-1.js @@ -0,0 +1,9 @@ +var obj = {attr: 'value'}; + +(function() { + var name = 'attr'; + for (var i = 0; i < 10; ++i) + assertEq(obj[name], 'value'); +})(); + +/* Look up a string id. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-2.js b/js/src/jit-test/tests/jaeger/getelem-sanity-2.js new file mode 100644 index 0000000000..399219b482 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-2.js @@ -0,0 +1,22 @@ +var obj = {firstAttr: 'value', secondAttr: 'another value'}; + +(function() { + for (var i = 0; i < 12; ++i) { + var name; + if (i < 4) + name = 'firstAttr'; + else if (i < 8) + name = 'secondAttr'; + else + name = 'firstAttr'; + + var result = obj[name]; + + switch (name) { + case 'firstAttr': assertEq(result, 'value'); break; + case 'secondAttr': assertEq(result, 'another value'); break; + } + } +})(); + +/* Toggle lookup between two ids. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-3.js b/js/src/jit-test/tests/jaeger/getelem-sanity-3.js new file mode 100644 index 0000000000..4b5b879001 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-3.js @@ -0,0 +1,22 @@ +var obj = {firstAttr: 'value', secondAttr: 'another value', thirdAttr: 'the last value'}; + +(function() { + for (var i = 0; i < 64; ++i) { + var name; + switch (~~(i / 4) % 3) { + case 0: name = 'firstAttr'; break; + case 1: name = 'secondAttr'; break; + case 2: name = 'thirdAttr'; break; + } + + var result = obj[name]; + + switch (name) { + case 'firstAttr': assertEq(result, 'value'); break; + case 'secondAttr': assertEq(result, 'another value'); break; + case 'thirdAttr': assertEq(result, 'the last value'); break; + } + } +})(); + +/* Rotate lookup between three ids. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-4.js b/js/src/jit-test/tests/jaeger/getelem-sanity-4.js new file mode 100644 index 0000000000..983713376e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-4.js @@ -0,0 +1,51 @@ +var obj = { + attr0: 'val0', + attr1: 'val1', + attr2: 'val2', + attr3: 'val3', + attr4: 'val4', + attr5: 'val5', + attr6: 'val6', + attr7: 'val7', + attr8: 'val8', + attr9: 'val9', + attr10: 'val10', + attr11: 'val11', + attr12: 'val12', + attr13: 'val13', + attr14: 'val14', + attr15: 'val15', + attr16: 'val16', + attr17: 'val17', +} + +var baseName = 'attr'; + +(function() { + for (var i = 0; i < 128; ++i) { + var name = baseName + (i % 18); + var result = obj[name]; + switch (i) { + case 0: assertEq('val0', result); break; + case 1: assertEq('val1', result); break; + case 2: assertEq('val2', result); break; + case 3: assertEq('val3', result); break; + case 4: assertEq('val4', result); break; + case 5: assertEq('val5', result); break; + case 6: assertEq('val6', result); break; + case 7: assertEq('val7', result); break; + case 8: assertEq('val8', result); break; + case 9: assertEq('val9', result); break; + case 10: assertEq('val10', result); break; + case 11: assertEq('val11', result); break; + case 12: assertEq('val12', result); break; + case 13: assertEq('val13', result); break; + case 14: assertEq('val14', result); break; + case 15: assertEq('val15', result); break; + case 16: assertEq('val16', result); break; + case 17: assertEq('val17', result); break; + } + } +})(); + +/* Megamorphic index atom. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-5.js b/js/src/jit-test/tests/jaeger/getelem-sanity-5.js new file mode 100644 index 0000000000..e825471530 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-5.js @@ -0,0 +1,4 @@ +var x = { 0: 5, 1: 5 }; +assertEq(x[0] + x[1], 10); + +/* int32_t getelem on object. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-6.js b/js/src/jit-test/tests/jaeger/getelem-sanity-6.js new file mode 100644 index 0000000000..693453d69b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-6.js @@ -0,0 +1,4 @@ +var x = {1: 2, 3: 4}; +assertEq(x[1], 2); + +/* getelem with non-dense array and known type int32. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-7.js b/js/src/jit-test/tests/jaeger/getelem-sanity-7.js new file mode 100644 index 0000000000..483d8b5584 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-7.js @@ -0,0 +1,10 @@ +var obj = {count: 24}; +var key = 'count'; + +for (var i = 0; i < 1024; ++i) { + var result = obj[key]; + if (i === 2) + obj.newAttr = 42; +} + +/* Perform getelem across shape change. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-8.js b/js/src/jit-test/tests/jaeger/getelem-sanity-8.js new file mode 100644 index 0000000000..f203216ac2 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-8.js @@ -0,0 +1,13 @@ + +// TI does not account for GETELEM accessing strings, so the GETELEM PIC must +// update type constraints according to generated stubs. +function foo(a, b) { + for (var j = 0; j < 5; j++) + a[b[j]] + " what"; +} +var a = {a:"zero", b:"one", c:"two", d:"three", e:"four"}; +var b = ["a", "b", "c", "d", "e"]; +foo(a, b); +foo(a, b); +a.e = 4; +foo(a, b); diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-int-1.js b/js/src/jit-test/tests/jaeger/getelem-sanity-int-1.js new file mode 100644 index 0000000000..d278a97dc4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-int-1.js @@ -0,0 +1,7 @@ +var arr = ['this', 'works', 'for', 'me']; +assertEq('this', arr[0]); +assertEq('works', arr[1]); +assertEq('for', arr[2]); +assertEq('me', arr[3]); + +/* Multiple int32_t getelem for dense array. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-int-2.js b/js/src/jit-test/tests/jaeger/getelem-sanity-int-2.js new file mode 100644 index 0000000000..add4568ef7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-int-2.js @@ -0,0 +1,12 @@ +var arr = ['this', 'works', 'for', 'me']; +for (var i = 0; i < arr.length; ++i) { + var result = arr[i]; + switch (i) { + case 0: assertEq('this', result); break; + case 1: assertEq('works', result); break; + case 2: assertEq('for', result); break; + case 3: assertEq('me', result); break; + } +} + +/* int32_t getelem for dense array. */ diff --git a/js/src/jit-test/tests/jaeger/getelem-sanity-int-3.js b/js/src/jit-test/tests/jaeger/getelem-sanity-int-3.js new file mode 100644 index 0000000000..91fb50f50e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getelem-sanity-int-3.js @@ -0,0 +1,19 @@ +var a = [1, 2]; +a[3.1415926535] = 'value'; + +for (var i = 0; i < 3; i++) { + var attr; + switch (i) { + case 0: attr = 0; break; + case 1: attr = 1; break; + case 2: attr = 3.1415926535; break; + } + var result = a[attr]; + switch (i) { + case 0: assertEq(result, 1); break; + case 1: assertEq(result, 2); break; + case 2: assertEq(result, 'value'); break; + } +} + +/* int32_t and string getelem for non-dense array. */ diff --git a/js/src/jit-test/tests/jaeger/getter-hook-1.js b/js/src/jit-test/tests/jaeger/getter-hook-1.js new file mode 100644 index 0000000000..29ab9552eb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getter-hook-1.js @@ -0,0 +1,18 @@ +// GETPROP PIC with multiple stubs containing getter hooks. + +function foo(arr) { + for (var i = 0; i < 100; i++) + arr[i].caller; +} +arr = Object.create(Object.prototype); +first = Object.create({}); +first.caller = null; +second = Object.create({}); +second.caller = null; +for (var i = 0; i < 100; ) { + arr[i++] = first; + arr[i++] = foo; + arr[i++] = second; +} +foo.caller; +foo(arr); diff --git a/js/src/jit-test/tests/jaeger/getter-hook-2.js b/js/src/jit-test/tests/jaeger/getter-hook-2.js new file mode 100644 index 0000000000..4361ce1262 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/getter-hook-2.js @@ -0,0 +1,19 @@ +// PIC on CALLPROP invoking getter hook. + +function foo(arr) { + for (var i = 0; i < 100; i++) + arr[i].caller(false); +} +arr = Object.create(Object.prototype); +first = Object.create({}); +first.caller = bar; +second = Object.create({}); +second.caller = bar; +for (var i = 0; i < 100; ) + arr[i++] = foo; +foo.caller; +function bar(x) { + if (x) + foo(arr); +} +bar(true); diff --git a/js/src/jit-test/tests/jaeger/globalOptimize-1.js b/js/src/jit-test/tests/jaeger/globalOptimize-1.js new file mode 100644 index 0000000000..f90114c334 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/globalOptimize-1.js @@ -0,0 +1,5 @@ +/* Test that NaN does not trigger js_InitMathClass & constants while parsing. */ +var NaN + +var x = 2; + diff --git a/js/src/jit-test/tests/jaeger/globalOptimize-2.js b/js/src/jit-test/tests/jaeger/globalOptimize-2.js new file mode 100644 index 0000000000..2756ec5a36 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/globalOptimize-2.js @@ -0,0 +1,10 @@ + +x = 30; +function foo() { + assertEq(x, 30); + delete x; + y = 20; + Object.defineProperty(this, 'x', {value:10}); + assertEq(x, 10); +} +foo(); diff --git a/js/src/jit-test/tests/jaeger/globalOptimize-4.js b/js/src/jit-test/tests/jaeger/globalOptimize-4.js new file mode 100644 index 0000000000..5df15f55a5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/globalOptimize-4.js @@ -0,0 +1,8 @@ + +x = 30; +assertEq(x, 30); + +for (var i = 0; i < 10000; i++) + this[i] = 0; + +assertEq(x, 30); diff --git a/js/src/jit-test/tests/jaeger/in.js b/js/src/jit-test/tests/jaeger/in.js new file mode 100644 index 0000000000..a179d60ecb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/in.js @@ -0,0 +1,21 @@ +function f(arr, b) { + var res = ""; + var a; + if (b) + a = arr; + for (var i=100; i>-200; i--) { + if (i in a) { + res += i; + } + } + return res; +} + +assertEq(f([1, , 2, 3], true), "320"); + +try { + f([1, , 2, 3], false); + assertEq(0, 1); +} catch(e) { + assertEq(e instanceof TypeError, true); +} diff --git a/js/src/jit-test/tests/jaeger/inline/bug645645.js b/js/src/jit-test/tests/jaeger/inline/bug645645.js new file mode 100644 index 0000000000..6649b559ed --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug645645.js @@ -0,0 +1,4 @@ +function f() { + f = Math.x; +} +f(); diff --git a/js/src/jit-test/tests/jaeger/inline/bug645666.js b/js/src/jit-test/tests/jaeger/inline/bug645666.js new file mode 100644 index 0000000000..34fd6822ab --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug645666.js @@ -0,0 +1,16 @@ +function f1() { + gc(); +} +function f2() { + with(this) {}; + f1(); +} +function f3() { + f2(); +} +function f4() { + f3(); +} +f3(); +f3(); +f4(); diff --git a/js/src/jit-test/tests/jaeger/inline/bug646004.js b/js/src/jit-test/tests/jaeger/inline/bug646004.js new file mode 100644 index 0000000000..8ffb4bd55a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug646004.js @@ -0,0 +1,9 @@ +function reportCompare (expected, actual, description) {} +function f() +{ + f(f, 0x09AA, 0x09B0, f); +} +try { + reportCompare ("outer", f(), + "Inner function statement should not have been called."); +} catch (e) {} diff --git a/js/src/jit-test/tests/jaeger/inline/bug646480.js b/js/src/jit-test/tests/jaeger/inline/bug646480.js new file mode 100644 index 0000000000..e870e33efe --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug646480.js @@ -0,0 +1,7 @@ +if (true) + function f1() {}; +function f2() { + var y = -8; + return y % 2; +} +f2() / 3; diff --git a/js/src/jit-test/tests/jaeger/inline/bug647973.js b/js/src/jit-test/tests/jaeger/inline/bug647973.js new file mode 100644 index 0000000000..c19797a242 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug647973.js @@ -0,0 +1,11 @@ +function f(a1, a2, a3, a4) { +} +function g(a1, a2) { + var d = new Date(0); + f(); + assertEq(typeof d, 'object'); +} +g(); +gc(); +f(2, 2, 2, f(2, 2, 2, 12 === 12)); +g(false, false); diff --git a/js/src/jit-test/tests/jaeger/inline/bug651209.js b/js/src/jit-test/tests/jaeger/inline/bug651209.js new file mode 100644 index 0000000000..27e14a17b1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug651209.js @@ -0,0 +1,11 @@ +var i = 0; +try { test(); } catch (e) { } +function test() { + var jstop = 900; + var code = ''; + code+=createCode(i); + eval(); +} +function createCode(i) { + jstop+= + + + i + " string.';"; +} diff --git a/js/src/jit-test/tests/jaeger/inline/bug655954.js b/js/src/jit-test/tests/jaeger/inline/bug655954.js new file mode 100644 index 0000000000..f57488b959 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug655954.js @@ -0,0 +1,5 @@ +// |jit-test| error: TypeError +foo(); +function foo() { + this(); +} diff --git a/js/src/jit-test/tests/jaeger/inline/bug656221.js b/js/src/jit-test/tests/jaeger/inline/bug656221.js new file mode 100644 index 0000000000..8319bcf838 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug656221.js @@ -0,0 +1,5 @@ +function f() { + var a = []; + a.push(a); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/inline/bug676491.js b/js/src/jit-test/tests/jaeger/inline/bug676491.js new file mode 100644 index 0000000000..82e6095a0c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug676491.js @@ -0,0 +1,14 @@ +Array.prototype.__defineSetter__(32, function() { print("Hello from arbitrary JS");}); +var UBound = 0; +var expect= ''; +var expectedvalues = []; +for (var j=0; j < 10; j++) { + addThis(); + addThis(); + addThis(); + addThis(); +} +function addThis() { + expectedvalues[UBound] = expect; + UBound++; +} diff --git a/js/src/jit-test/tests/jaeger/inline/bug680759.js b/js/src/jit-test/tests/jaeger/inline/bug680759.js new file mode 100644 index 0000000000..975f9e3b76 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/bug680759.js @@ -0,0 +1,14 @@ + +TryToCatch(); +TryToCatch(); +function Thrower( v ) { + throw "Caught"; +} +function Eval( v ) { + SECTION : Thrower(TryToCatch, v, ': 3') +} +function TryToCatch( value, expect ) { + try { + Eval( value ) + } catch (e) { } +} diff --git a/js/src/jit-test/tests/jaeger/inline/doubleArg.js b/js/src/jit-test/tests/jaeger/inline/doubleArg.js new file mode 100644 index 0000000000..bd44225998 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/doubleArg.js @@ -0,0 +1,10 @@ +function foo(x, y) { + if (y < 0) {} + return x * 1000; +} +function bar(x, y) { + while (false) {} + assertEq(foo(x, false), 10500); + assertEq(foo(y, false), 11000); +} +bar(10.5, 11); diff --git a/js/src/jit-test/tests/jaeger/inline/mathAbs.js b/js/src/jit-test/tests/jaeger/inline/mathAbs.js new file mode 100644 index 0000000000..b1d077add1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/mathAbs.js @@ -0,0 +1,31 @@ + +assertEq(Math.abs(-10), 10); +assertEq(Math.abs(-2147483648), 2147483648); +assertEq(Math.abs(2147483648), 2147483648); +assertEq(Math.abs(-0), 0); +assertEq(Math.abs(0), 0); +assertEq(Math.abs(-3.14), 3.14); +assertEq(Math.abs(NaN), NaN); + +/* Inferred as abs(int). */ +function abs1(x) { + return Math.abs(x); +} +assertEq(abs1(1), 1); +assertEq(abs1(-1), 1); +assertEq(abs1(0), 0); +assertEq(abs1(-123) + abs1(234), 357); +assertEq(abs1(-2147483648), 2147483648); // recompile to return double +assertEq(abs1(-2), 2); + +/* Inferred as abs(double). */ +function abs2(x) { + return Math.abs(x); +} +assertEq(abs2(-2.2), 2.2); +assertEq(abs2(123), 123); +assertEq(abs2(-456), 456); +assertEq(abs2(-0), 0); +assertEq(abs2(1.3), 1.3); +assertEq(abs2(NaN), NaN); + diff --git a/js/src/jit-test/tests/jaeger/inline/mathFloor.js b/js/src/jit-test/tests/jaeger/inline/mathFloor.js new file mode 100644 index 0000000000..1419beb9f3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/mathFloor.js @@ -0,0 +1,34 @@ + +assertEq(Math.floor(3.14), 3); +assertEq(Math.floor(-0), -0); +assertEq(Math.floor(0), 0); +assertEq(Math.floor(-1.23), -2); +assertEq(Math.floor(2147483649), 2147483649); +assertEq(Math.floor(2147483648.5), 2147483648); +assertEq(Math.floor(2147483647.1), 2147483647); + +/* Inferred as floor(double). */ +function floor1(x) { + return Math.floor(x); +} +assertEq(floor1(10.3), 10); +assertEq(floor1(-3.14), -4); +assertEq(floor1(-0), -0); // recompile to return double +assertEq(floor1(678.3), 678); + +/* Inferred as floor(double). */ +function floor2(x) { + return Math.floor(x); +} +assertEq(floor2(3.4), 3); +assertEq(floor2(NaN), NaN); // recompile to return double +assertEq(floor2(-4.4), -5); + +/* Inferred as floor(int). */ +function floor3(x) { + return Math.floor(x); +} +assertEq(floor3(4), 4); +assertEq(floor3(-5), -5); +assertEq(floor3(0), 0); + diff --git a/js/src/jit-test/tests/jaeger/inline/mathPow.js b/js/src/jit-test/tests/jaeger/inline/mathPow.js new file mode 100644 index 0000000000..717e087c96 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/mathPow.js @@ -0,0 +1,35 @@ + +assertEq(Math.pow(100, 2), 10000); +assertEq(Math.pow(-Infinity, -0.5), 0); +assertEq(Math.pow(-Infinity, 0.5), Infinity); +assertEq(Math.pow(Infinity, -0.5), 0); +assertEq(Math.pow(Infinity, 0.5), Infinity); +assertEq(Math.pow(NaN, -0.5), NaN); +assertEq(Math.pow(NaN, 0.5), NaN); +assertEq(Math.pow(-3.14, -0.5), NaN); +assertEq(Math.pow(-1.23, 0.5), NaN); +assertEq(Math.pow(-0, -0.5), Infinity); +assertEq(Math.pow(-0, 0.5), 0); +assertEq(Math.pow(-1, -0.5), NaN); +assertEq(Math.pow(-1, 0.5), NaN); +assertEq(Math.pow(0, -0.5), Infinity); +assertEq(Math.pow(0, 0.5), 0); +assertEq(Math.pow(1, -0.5), 1); +assertEq(Math.pow(1, 0.5), 1); +assertEq(Math.pow(100, -0.5), 0.1); +assertEq(Math.pow(100, 0.5), 10); + +/* Inferred as pow(double, double). */ +function pow1(x) { + return Math.pow(x, 0.5); +} +assertEq(pow1(100), 10); +assertEq(pow1(144), 12); +assertEq(pow1(-0), 0); +assertEq(pow1(0), 0); +assertEq(pow1(1), 1); +assertEq(pow1(-1), NaN); +assertEq(pow1(NaN), NaN); +assertEq(pow1(-Infinity), Infinity); +assertEq(pow1(Infinity), Infinity); + diff --git a/js/src/jit-test/tests/jaeger/inline/mathRound.js b/js/src/jit-test/tests/jaeger/inline/mathRound.js new file mode 100644 index 0000000000..60a59e2020 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/mathRound.js @@ -0,0 +1,41 @@ + +assertEq(Math.round(3.14), 3); +assertEq(Math.round(0.5), 1); +assertEq(Math.round(-0), -0); +assertEq(Math.round(0), 0); +assertEq(Math.round(-1.03), -1); +assertEq(Math.round(2147483649), 2147483649); +assertEq(Math.round(2147483647.5), 2147483648); +assertEq(Math.floor(2147483647.1), 2147483647); + +/* Inferred as round(double). */ +function round1(x) { + return Math.round(x); +} +assertEq(round1(10.3), 10); +assertEq(round1(-3.14), -3); +assertEq(round1(-3.5), -3); +assertEq(round1(-3.6), -4); +assertEq(round1(3.5), 4); +assertEq(round1(3.6), 4); +assertEq(round1(0), 0); +assertEq(round1(-0), -0); // recompile to return double +assertEq(round1(12345), 12345); +assertEq(round1(654.6), 655); + +/* Inferred as round(double). */ +function round2(x) { + return Math.round(x); +} +assertEq(round2(1234.5), 1235); +assertEq(round2(NaN), NaN); // recompile to return double +assertEq(round2(4.6), 5); + +/* Inferred as round(int). */ +function round3(x) { + return Math.round(x); +} +assertEq(round3(4), 4); +assertEq(round3(-5), -5); +assertEq(round3(0), 0); + diff --git a/js/src/jit-test/tests/jaeger/inline/mathSqrt.js b/js/src/jit-test/tests/jaeger/inline/mathSqrt.js new file mode 100644 index 0000000000..3401499427 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/mathSqrt.js @@ -0,0 +1,29 @@ + +assertEq(Math.sqrt(-Infinity), NaN); +assertEq(Math.sqrt(-3.14), NaN); +assertEq(Math.sqrt(-2), NaN); +assertEq(Math.sqrt(-0), -0); +assertEq(Math.sqrt(0), 0); +assertEq(Math.sqrt(2), Math.SQRT2); +assertEq(Math.sqrt(49), 7); +assertEq(Math.sqrt(Infinity), Infinity); + +/* Inferred as sqrt(double). */ +function sqrt1(x) { + return Math.sqrt(x); +} +assertEq(sqrt1(NaN), NaN); +assertEq(sqrt1(-Infinity), NaN); +assertEq(sqrt1(Infinity), Infinity); +assertEq(sqrt1(-0), -0); +assertEq(sqrt1(2), Math.SQRT2); +assertEq(sqrt1(16), 4); + +/* Inferred as sqrt(int). */ +function sqrt2(x) { + return Math.sqrt(x); +} +assertEq(sqrt2(4), 2); +assertEq(sqrt2(169), 13); +assertEq(sqrt2(0), 0); + diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-01.js b/js/src/jit-test/tests/jaeger/inline/scripted-01.js new file mode 100644 index 0000000000..f6a585d054 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-01.js @@ -0,0 +1,17 @@ +function bar(x, y) { + return x + y; +} + +function foo(x, y) { + var a = 0; + for (var i = 0; i < 1000; i++) { + a += bar(x, y); + a += bar(x, y); + a += bar(x, y); + a += bar(x, y); + } + return a; +} + +var q = foo(0, 1); +assertEq(q, 4000); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-02.js b/js/src/jit-test/tests/jaeger/inline/scripted-02.js new file mode 100644 index 0000000000..fede7f4943 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-02.js @@ -0,0 +1,22 @@ +function getter(a, i) { + return a[i]; +} + +function foo(a, n) { + var res = 0; + for (var i = 0; i < 10; i++) { + res = 0; + for (var j = 0; j < n; j++) { + res += getter(a, j); + } + } + return res; +} + +var n = 100; +var a = Array(n); +for (var i = 0; i < n; i++) + a[i] = i; + +var q = foo(a, n); +assertEq(q, 4950); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-03.js b/js/src/jit-test/tests/jaeger/inline/scripted-03.js new file mode 100644 index 0000000000..f54c1c66da --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-03.js @@ -0,0 +1,14 @@ +function choose(x, y, z) { + return x ? y : z; +} + +function foo(x, y, z) { + var a = 0; + for (var i = 0; i < 100; i++) { + a += choose(x, y, z); + } + return a; +} + +var q = foo(true, 10, 0); +assertEq(q, 1000); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-04.js b/js/src/jit-test/tests/jaeger/inline/scripted-04.js new file mode 100644 index 0000000000..d2f8535bcf --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-04.js @@ -0,0 +1,12 @@ +function adder(x, y) { + return x + y; +} + +function foo(x) { + for (var i = 0; i < 100; i++) + var a = adder(x, i); + return a; +} + +var q = foo(0x7ffffff0); +assertEq(q, 2147483731); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-05.js b/js/src/jit-test/tests/jaeger/inline/scripted-05.js new file mode 100644 index 0000000000..b763fb3649 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-05.js @@ -0,0 +1,13 @@ +function adder(x, y) { + return Math.floor(x + y); +} + +function foo(x) { + for (var i = 0; i < 100; i++) { + var a = adder(x, i); + } + return a; +} + +var q = foo(0x7ffffff0 + .5); +assertEq(q, 2147483731); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-06.js b/js/src/jit-test/tests/jaeger/inline/scripted-06.js new file mode 100644 index 0000000000..074bb52017 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-06.js @@ -0,0 +1,17 @@ +function popper(a) { + return a.pop(); +} + +function foo(x) { + for (var i = 0; i < 10; i++) { + var q = popper(x); + if (i < 5) + assertEq(q, 5 - i); + else + assertEq(q, undefined); + } + return q; +} + +var q = foo([1,2,3,4,5]); +assertEq(q, undefined); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-07.js b/js/src/jit-test/tests/jaeger/inline/scripted-07.js new file mode 100644 index 0000000000..dfe076a656 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-07.js @@ -0,0 +1,15 @@ +function multiple(a) { + if (a > 10) + return 1; + return 0; +} + +function foo(x) { + var a = 0; + for (var i = 0; i < 100; i++) + a += multiple(i); + return a; +} + +var q = foo([1,2,3,4,5]); +assertEq(q, 89); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-08.js b/js/src/jit-test/tests/jaeger/inline/scripted-08.js new file mode 100644 index 0000000000..22198388ef --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-08.js @@ -0,0 +1,21 @@ +function first(a, b) { + return second(a, b); +} + +function second(a, b) { + return third(a, b, a + b); +} + +function third(a, b, c) { + return a + b + c; +} + +function foo(x) { + var a = 0; + for (var i = 0; i < 100; i++) + a += first(x, i); + return a; +} + +var q = foo(10); +assertEq(q, 11900); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-09.js b/js/src/jit-test/tests/jaeger/inline/scripted-09.js new file mode 100644 index 0000000000..e970b77e43 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-09.js @@ -0,0 +1,19 @@ +function multiple(a) { + if (a > 10) + return a * 20; + return 0; +} + +function deeper(a, b) { + return multiple(a + b); +} + +function foo() { + var a = 0; + for (var i = 0; i < 10; i++) + a += deeper(0x7ffffff0, i); + return a; +} + +var q = foo(); +assertEq(q, 429496727300); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-10.js b/js/src/jit-test/tests/jaeger/inline/scripted-10.js new file mode 100644 index 0000000000..492d055e84 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-10.js @@ -0,0 +1,13 @@ +function copied(x, y) { + return x + y; +} + +function foo(x) { + var a = 0; + for (var i = 0; i < 100; i++) + a += copied(x, x); + return a; +} + +var q = foo(5); +assertEq(q, 1000); diff --git a/js/src/jit-test/tests/jaeger/inline/scripted-11.js b/js/src/jit-test/tests/jaeger/inline/scripted-11.js new file mode 100644 index 0000000000..750add3980 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/scripted-11.js @@ -0,0 +1,12 @@ +what = 0; + +function f(x) { + g(x); +} + +function g(x) { + eval("what = true"); +} + +f(10); +assertEq(what, true); diff --git a/js/src/jit-test/tests/jaeger/inline/stringCharAt.js b/js/src/jit-test/tests/jaeger/inline/stringCharAt.js new file mode 100644 index 0000000000..bf2bbbd67f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/stringCharAt.js @@ -0,0 +1,49 @@ + +assertEq("foo".charAt(-123), ""); +assertEq("foo".charAt(-1), ""); +assertEq("foo".charAt(0), "f"); +assertEq("foo".charAt(1), "o"); +assertEq("foo".charAt(2), "o"); +assertEq("foo".charAt(3.4), ""); +assertEq("foo".charAt(), "f"); +assertEq("".charAt(), ""); +assertEq("".charAt(0), ""); +assertEq("abc\u9123".charAt(3), "\u9123"); // char without unit string + +/* Inferred as string.charAt(int). */ +function charAt1(x) { + return "abc".charAt(x); +} +assertEq(charAt1(-1), ""); +assertEq(charAt1(0), "a"); +assertEq(charAt1(1), "b"); +assertEq(charAt1(2), "c"); +assertEq(charAt1(3), ""); +assertEq(charAt1(1234), ""); + +/* Inferred as string.charAt(double). */ +function charAt2(x) { + return "abc".charAt(x); +} +assertEq(charAt2(-1.3), ""); +assertEq(charAt2(-0), "a"); +assertEq(charAt2(2), "c"); +assertEq(charAt2(2.3), "c"); +assertEq(charAt2(3.14), ""); +assertEq(charAt2(NaN), "a"); + +/* Test ropes. */ +function charAt3(s, i) { + var s2 = "abcdef" + s + "12345"; + return s2.charAt(i); +} +assertEq(charAt3("abcdef", 14), "3"); +assertEq(charAt3("a" + "b", 1), "b"); +assertEq(charAt3("abcdefg" + "hijklmnop", 10), "e"); + +/* Other 'this'. */ +var arr = [1, 2]; +arr.charAt = String.prototype.charAt; +assertEq(arr.charAt(1), ","); + + diff --git a/js/src/jit-test/tests/jaeger/inline/stringCharCodeAt.js b/js/src/jit-test/tests/jaeger/inline/stringCharCodeAt.js new file mode 100644 index 0000000000..3f0bfe2cfd --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/stringCharCodeAt.js @@ -0,0 +1,47 @@ + +assertEq("foo".charCodeAt(-123), NaN); +assertEq("foo".charCodeAt(-0), 102); +assertEq("foo".charCodeAt(0), 102); +assertEq("foo".charCodeAt(2), 111); +assertEq("foo".charCodeAt(3.4), NaN); +assertEq("foo".charCodeAt(), 102); +assertEq("".charCodeAt(), NaN); +assertEq("".charCodeAt(0), NaN); + +/* Inferred as string.charCodeAt(int). */ +function charCodeAt1(x) { + return "abc".charCodeAt(x); +} +assertEq(charCodeAt1(-1), NaN); +assertEq(charCodeAt1(0), 97); +assertEq(charCodeAt1(1), 98); +assertEq(charCodeAt1(2), 99); +assertEq(charCodeAt1(3), NaN); +assertEq(charCodeAt1(1234), NaN); + +/* Inferred as string.charCodeAt(double). */ +function charCodeAt2(x) { + return "abc".charCodeAt(x); +} +assertEq(charCodeAt2(-1.3), NaN); +assertEq(charCodeAt2(-0), 97); +assertEq(charCodeAt2(2), 99); +assertEq(charCodeAt2(2.3), 99); +assertEq(charCodeAt2(3.14), NaN); +assertEq(charCodeAt2(NaN), 97); + +/* Test ropes. */ +function charCodeAt3(s, i) { + var s2 = "abcdef" + s + "12345"; + return s2.charCodeAt(i); +} +assertEq(charCodeAt3("abcdef", 14), 51); +assertEq(charCodeAt3("a" + "b", 1), 98); +assertEq(charCodeAt3("abcdefg" + "hijklmnop", 10), 101); + +/* Other 'this'. */ +var n = new Number(123); +n.charCodeAt = String.prototype.charCodeAt; +assertEq(n.charCodeAt(1), 50); + + diff --git a/js/src/jit-test/tests/jaeger/inline/undefinedLocal.js b/js/src/jit-test/tests/jaeger/inline/undefinedLocal.js new file mode 100644 index 0000000000..f6fb129966 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/inline/undefinedLocal.js @@ -0,0 +1,19 @@ + +function bar(n) { + var a; + if (n < 50) + a = n; + return a; +} + +function foo() { + for (var i = 0; i < 100; i++) { + var q = bar(i); + if (i < 50) + assertEq(q, i); + else + assertEq(q, undefined); + } +} + +foo(); diff --git a/js/src/jit-test/tests/jaeger/instanceOfWithKnownTypes.js b/js/src/jit-test/tests/jaeger/instanceOfWithKnownTypes.js new file mode 100644 index 0000000000..0ca3dc8d94 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/instanceOfWithKnownTypes.js @@ -0,0 +1,13 @@ +// |jit-test| error: TypeError
+
+// Verify that the compiler doesn't assert.
+
+function f() {
+ var o = {}, p = {};
+ z = o instanceof p;
+ z = 3 instanceof p;
+ z = p instanceof 3;
+ z = 3 instanceof 4;
+}
+
+f();
diff --git a/js/src/jit-test/tests/jaeger/invokeSessionGuard.js b/js/src/jit-test/tests/jaeger/invokeSessionGuard.js new file mode 100644 index 0000000000..53bdbe5d6e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/invokeSessionGuard.js @@ -0,0 +1,8 @@ +load(libdir + "evalInFrame.js"); + +[1,2,3,4,5,6,7,8].forEach( + function(x) { + // evalInFrame means lightweight gets call obj + assertEq(evalInFrame(0, "x"), x); + } +); diff --git a/js/src/jit-test/tests/jaeger/loops/bug651155.js b/js/src/jit-test/tests/jaeger/loops/bug651155.js new file mode 100644 index 0000000000..37c16fff19 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug651155.js @@ -0,0 +1,6 @@ +ForIn_2(); +function ForIn_2( object ) { + PropertyArray=new Array; + var PropertyArray = 'Do not assert: !cx->throwing'; + for ( i in object ) PropertyArray.length-1; +} diff --git a/js/src/jit-test/tests/jaeger/loops/bug654393.js b/js/src/jit-test/tests/jaeger/loops/bug654393.js new file mode 100644 index 0000000000..e603392a40 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug654393.js @@ -0,0 +1,12 @@ +var VERSION = "ECMA_2"; +DoWhile( + new DoWhileObject(false, false, false, VERSION) +); +function DoWhileObject( out1, out2, out3, in1 ) { + this.breakIn = in1 +} +function DoWhile(object) { + do { + if (object.breakIn) {} + } while(false); +} diff --git a/js/src/jit-test/tests/jaeger/loops/bug655854.js b/js/src/jit-test/tests/jaeger/loops/bug655854.js new file mode 100644 index 0000000000..81c7194314 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug655854.js @@ -0,0 +1,8 @@ + +function foo(a, b, c) { + var res = 0; + for (var b = 0; b < c; b++) + res += a[b]; + return res; +} +assertEq(foo([1,2,3], 0, 10), NaN); diff --git a/js/src/jit-test/tests/jaeger/loops/bug658290.js b/js/src/jit-test/tests/jaeger/loops/bug658290.js new file mode 100644 index 0000000000..cfb42066af --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug658290.js @@ -0,0 +1,8 @@ +var SECTION = "15.4.5.2-2"; +addCase(new Array, 0, Math, Math.pow(2, SECTION)); +var arg = "", i = 0; +var a = eval("new Array(" + arg + ")"); +addCase(a, i, +i + 1, Math.pow(2, 12) + i + 1, true); +function addCase(object, old_len, set_len, new_len, checkitems) { + for (var i = old_len; i < new_len; i++) if (object[i] != 0) {} +} diff --git a/js/src/jit-test/tests/jaeger/loops/bug659452.js b/js/src/jit-test/tests/jaeger/loops/bug659452.js new file mode 100644 index 0000000000..6cc3f4d465 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug659452.js @@ -0,0 +1,5 @@ +test(); +function test() { + var t = function () { return function printStatus() {}; }; + for (var j = 0; j < 10; j++) t["-1"] +} diff --git a/js/src/jit-test/tests/jaeger/loops/bug668643.js b/js/src/jit-test/tests/jaeger/loops/bug668643.js new file mode 100644 index 0000000000..fe41c7ffc7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug668643.js @@ -0,0 +1,12 @@ + +function foo(a,n) { + var x = {a:[]}; + for (var i = 0; i < n; ) { + a[i]; + x.a[i]; + a[++i]; + } +} +var a = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0]; +var n = a.length; +foo(a,n); diff --git a/js/src/jit-test/tests/jaeger/loops/bug671814.js b/js/src/jit-test/tests/jaeger/loops/bug671814.js new file mode 100644 index 0000000000..69b581f772 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug671814.js @@ -0,0 +1,12 @@ +var ta = Int8Array([]); +function Int8Array(summary) { + summary.length; +} +function test() { + ctors = [ Int8Array ] + for (var i = 0; i < 10; i++) { + ctor = ctors[0] + b = ctor(0) + } +} +test(); diff --git a/js/src/jit-test/tests/jaeger/loops/bug680809.js b/js/src/jit-test/tests/jaeger/loops/bug680809.js new file mode 100644 index 0000000000..22bcbf3c46 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug680809.js @@ -0,0 +1,8 @@ +function f0(p0) { + var v0; + v0 = 1.7; + loop0: while (v0) { + v0 = p0; + } +} +f0(0); diff --git a/js/src/jit-test/tests/jaeger/loops/bug684621.js b/js/src/jit-test/tests/jaeger/loops/bug684621.js new file mode 100644 index 0000000000..9ca13bc7f4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/bug684621.js @@ -0,0 +1,15 @@ +function runRichards() { + queue = new Packet; + Packet(queue, ID_DEVICE_A, KIND_DEVICE); + new Packet; +} +var ID_DEVICE_A = 4; +var KIND_DEVICE = 0; +Packet = function (queue) { + this.link = null + if (queue == null) return; + var peek, next = queue; + while ((peek = next.link) != null) + ID_HANDLER_B +}; +runRichards() diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-01.js b/js/src/jit-test/tests/jaeger/loops/hoist-01.js new file mode 100644 index 0000000000..0c0f12357a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-01.js @@ -0,0 +1,35 @@ +function foo(x, n) { + for (var i = 0; i < n; i++) + x[i] = i; + var q = 0; + for (var i = 0; i < 10; i++) { + for (var j = 0; j < n; j++) + q += x[j]; + } + return q; +} + +var a = foo([], 100); +assertEq(a, 49500); + +function basic1(x) { + var q = 0; + for (var i = 0; i < 4; i++) + q += x[i]; + return q; +} + +var b = basic1([1,2,3,4]); +assertEq(b, 10); + +ARRAY = [1,2,3,4]; + +function basic2() { + var q = 0; + for (var i = 0; i < 4; i++) + q += ARRAY[i]; + return q; +} + +var c = basic2(); +assertEq(c, 10); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-02.js b/js/src/jit-test/tests/jaeger/loops/hoist-02.js new file mode 100644 index 0000000000..79c3f11952 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-02.js @@ -0,0 +1,12 @@ +function foo(x, n) { + var a = 0; + for (var i = 0; i < n; i++) + a += x[3]; + return a; +} + +var a = foo([1,2,3,4], 100); +assertEq(a, 400); + +var b = foo([1,2], 100); +assertEq(b, NaN); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-03.js b/js/src/jit-test/tests/jaeger/loops/hoist-03.js new file mode 100644 index 0000000000..c5c2ba6190 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-03.js @@ -0,0 +1,12 @@ +function foo(x, j, n) { + var a = 0; + for (var i = 0; i < n; i++) + a += x[j]; + return a; +} + +var a = foo([1,2,3,4], 3, 100); +assertEq(a, 400); + +var b = foo([1,2,3,4], 5, 100); +assertEq(b, NaN); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-04.js b/js/src/jit-test/tests/jaeger/loops/hoist-04.js new file mode 100644 index 0000000000..f17bd7f737 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-04.js @@ -0,0 +1,18 @@ +function bar(x, i) { + if (i == 50) + x.length = 0; +} + +function foo(x, j, n) { + var a = 0; + for (var i = 0; i < n; i++) { + var q = x[j]; + bar(x, i); + if (typeof q == 'undefined') + a++; + } + return a; +} + +var a = foo([1,2,3,4], 3, 100); +assertEq(a, 49); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-05.js b/js/src/jit-test/tests/jaeger/loops/hoist-05.js new file mode 100644 index 0000000000..b99b07893b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-05.js @@ -0,0 +1,19 @@ +function bar(x, i) { + if (i == 50) + foo.arguments[1] = 20; +} + +function foo(x, j, n) { + var a = 0; + arguments; + for (var i = 0; i < n; i++) { + var q = x[j]; + bar(x, i); + if (typeof q == 'undefined') + a++; + } + return a; +} + +var a = foo([1,2,3,4], 3, 100); +assertEq(a, 0); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-06.js b/js/src/jit-test/tests/jaeger/loops/hoist-06.js new file mode 100644 index 0000000000..fc2919cda2 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-06.js @@ -0,0 +1,14 @@ + +function foo(x, n, y) { + var q = 0; + for (var j = 0; j < n; j++) { + if (x[j] < y) + q++; + } + assertEq(q, 1); +} + +var x = [1,2,3,4,5]; +var y = { valueOf: function() { x.length = 0; return 6; } }; + +var a = foo(x, 5, y); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-07.js b/js/src/jit-test/tests/jaeger/loops/hoist-07.js new file mode 100644 index 0000000000..a409f70559 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-07.js @@ -0,0 +1,17 @@ + +var res = 0; + +function foo(x, n, y) { + for (var j = 0; j < n; j++) { + x[j]; + y.f; + } +} + +var x = [1,2,3,4,5]; +var y = {}; +Object.defineProperty(y, 'f', {get:function() { res++; x.length = 2; }}); + +var a = foo(x, 5, y); + +assertEq(res, 5); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-08.js b/js/src/jit-test/tests/jaeger/loops/hoist-08.js new file mode 100644 index 0000000000..a695dd1a76 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-08.js @@ -0,0 +1,7 @@ + +function foo(x,n) { + for (var i = -5; i < n; i++) { + x[i] = 10; + } +} +foo([1,2,3,4,5],5); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-09.js b/js/src/jit-test/tests/jaeger/loops/hoist-09.js new file mode 100644 index 0000000000..1b398c7c26 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-09.js @@ -0,0 +1,11 @@ + +function foo(x, y) { + for (var i = 0; i < x.length; i++) { + x[i]; + if (i < 20) + y[i + 1] = 0; + } +} + +var q = Array(1,2,3,4,5); +foo(q, []); diff --git a/js/src/jit-test/tests/jaeger/loops/hoist-10.js b/js/src/jit-test/tests/jaeger/loops/hoist-10.js new file mode 100644 index 0000000000..43a3084c9d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/hoist-10.js @@ -0,0 +1,39 @@ +function foo1(x, n) { + var i = 0; + while (--n >= 0) { + x[i++] = 0; + } +} +foo1([1,2,3,4,5],5); + +function foo2(x, n) { + var i = 0; + while (--n >= 0) { + x[i++] = 0; + } +} +foo2([1,2,3,4,5],6); + +function foo3(x, n) { + var i = 0; + while (n-- >= 0) { + x[i++] = 0; + } +} +foo3([1,2,3,4,5],5); + +function foo4(x, n) { + var i = 0; + while (--n >= 0) { + x[++i] = 0; + } +} +foo4([1,2,3,4,5],5); + +function foo5(x, n) { + var i = 0; + while (--n >= 0) { + x[++i] = 0; + } +} +foo5([1,2,3,4,5,6],5); diff --git a/js/src/jit-test/tests/jaeger/loops/integer-1.js b/js/src/jit-test/tests/jaeger/loops/integer-1.js new file mode 100644 index 0000000000..f0ef122f3c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/integer-1.js @@ -0,0 +1,7 @@ +function foo(x) { + for (var i = 0x7ffffff0; i <= x; i++) { + var y = i; + } + return y; +} +assertEq(foo(0x7fffffff), 0x7fffffff); diff --git a/js/src/jit-test/tests/jaeger/loops/integer-2.js b/js/src/jit-test/tests/jaeger/loops/integer-2.js new file mode 100644 index 0000000000..129c92f1fe --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/integer-2.js @@ -0,0 +1,10 @@ +function foo(x, y, z, a) { + for (var i = 0x7fff; i < 0xffff; i++) { + var y = ((x + y) + (z + a[0])) | 0; + } + return y; +} +assertEq(foo(0x7fffffff, 0x7fffffff, 0x7fffffff, [0x7fffffff]), 2147385343); + +var q = [0x7fffffff]; +assertEq(eval("foo(0x7fffffff, 0x7fffffff, {valueOf:function() {q[0] = 'e4'; return 0;}}, q)"), 438048096); diff --git a/js/src/jit-test/tests/jaeger/loops/integer-3.js b/js/src/jit-test/tests/jaeger/loops/integer-3.js new file mode 100644 index 0000000000..26c7b76a8f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/integer-3.js @@ -0,0 +1,7 @@ +function foo(x) { + for (var i = 0x7ffffff0; i <= x; i++) { + var y = (i % -2147483648); + } + return y + 5; +} +assertEq(foo(0x7fffffff), 0x7fffffff + 5); diff --git a/js/src/jit-test/tests/jaeger/loops/multiply-by-int32min.js b/js/src/jit-test/tests/jaeger/loops/multiply-by-int32min.js new file mode 100644 index 0000000000..bc692f1480 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/multiply-by-int32min.js @@ -0,0 +1,59 @@ +function foo() +{ + // Range analysis incorrectly computes a range for the multiplication. Once + // that incorrect range is computed, the goal is to compute a new value whose + // range analysis *thinks* is in int32_t range, but which goes past it using + // JS semantics. + // + // On the final iteration, in JS semantics, the multiplication produces 0, and + // the next addition 0x7fffffff. Adding any positive integer to that goes + // past int32_t range: here, (0x7fffffff + 5) or 2147483652. + // + // Range analysis instead thinks the multiplication produces a value in the + // range [INT32_MIN, INT32_MIN], and the next addition a value in the range + // [-1, -1]. Adding any positive value to that doesn't overflow int32_t range + // but *does* overflow the actual range in JS semantics. Thus omitting + // overflow checks produces the value 0x80000004, which interpreting as signed + // is (INT32_MIN + 4) or -2147483644. + // + // For this test to trigger the bug it was supposed to trigger: + // + // * 0x7fffffff must be the LHS, not RHS, of the addition in the loop, and + // * i must not be incremented using ++ + // + // The first is required because JM LoopState doesn't treat *both* V + mul and + // mul + V as not overflowing, when V is known to be int32_t -- only V + mul. + // (JM pessimally assumes V's type might change before it's evaluated. This + // obviously can't happen if V is a constant, but JM's puny little mind + // doesn't detect this possibility now.) + // + // The second is required because JM LoopState only ignores integer overflow + // on multiplications if the enclosing loop is a "constrainedLoop" (the name + // of the relevant field). Loops become unconstrained when unhandled ops are + // found in the loop. Increment operators generate a DUP op, which is not + // presently a handled op, causing the loop to become unconstrained. + for (var i = 0; i < 15; i = i + 1) { + var y = (0x7fffffff + ((i & 1) * -2147483648)) + 5; + } + return y; +} +assertEq(foo(), (0x7fffffff + ((14 & 1) * -2147483648)) + 5); + +function bar() +{ + // Variation on the theme of the above test with -1 as the other half of the + // INT32_MIN multiplication, which *should* result in -INT32_MIN on multiply + // (exceeding int32_t range). + // + // Here, range analysis again thinks the range of the multiplication is + // INT32_MIN. We'd overflow-check except that adding zero (on the LHS, see + // above) prevents overflow checking, so range analysis thinks the range is + // [INT32_MIN, INT32_MIN] when -INT32_MIN is actually possible. This direct + // result of the multiplication is already out of int32_t range, so no need to + // add anything to bias it outside int32_t range to get a wrong result. + for (var i = 0; i < 17; i = i + 1) { + var y = (0 + ((-1 + (i & 1)) * -2147483648)); + } + return y; +} +assertEq(bar(), (0 + ((-1 + (16 & 1)) * -2147483648))); diff --git a/js/src/jit-test/tests/jaeger/loops/property-1.js b/js/src/jit-test/tests/jaeger/loops/property-1.js new file mode 100644 index 0000000000..81a6b3c360 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/loops/property-1.js @@ -0,0 +1,19 @@ + +function foo(x, y) { + var res = 0; + for (var i = 0; i < 10; i++) { + res += x.f + y[i]; + } + return res; +} + +var x = {f:0}; +var y = Array(10); +for (var i = 0; i < 10; i++) { + if (i == 5) + Object.defineProperty(Object.prototype, 5, {get: function() { x.f = 10; return 5}}); + else + y[i] = i; +} + +assertEq(foo(x, y), 85); diff --git a/js/src/jit-test/tests/jaeger/modConstDoubles.js b/js/src/jit-test/tests/jaeger/modConstDoubles.js new file mode 100644 index 0000000000..807782ce6e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/modConstDoubles.js @@ -0,0 +1,8 @@ + +function f() { + var x = 2.6; + var y = 2.1; + return x % y; +} +assertEq(f(), 0.5); + diff --git a/js/src/jit-test/tests/jaeger/modConstInt.js b/js/src/jit-test/tests/jaeger/modConstInt.js new file mode 100644 index 0000000000..cdb0711da3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/modConstInt.js @@ -0,0 +1,8 @@ + +function f() { + var i = 1000; + var rest = i % 3; + var div = (i - rest) / 3; + assertEq(div, 333); +} +f();
\ No newline at end of file diff --git a/js/src/jit-test/tests/jaeger/modConstZeroRhs.js b/js/src/jit-test/tests/jaeger/modConstZeroRhs.js new file mode 100644 index 0000000000..75ef884100 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/modConstZeroRhs.js @@ -0,0 +1,8 @@ + +function f() { + var x = 5; + var y = 0; + return x % y; +} +assertEq(f(), NaN); + diff --git a/js/src/jit-test/tests/jaeger/modWithConstLhs.js b/js/src/jit-test/tests/jaeger/modWithConstLhs.js new file mode 100644 index 0000000000..67bf398b00 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/modWithConstLhs.js @@ -0,0 +1,2 @@ +// |jit-test| error: ReferenceError;
+7%s;
diff --git a/js/src/jit-test/tests/jaeger/mulNegZero.js b/js/src/jit-test/tests/jaeger/mulNegZero.js new file mode 100644 index 0000000000..6758dab7c4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/mulNegZero.js @@ -0,0 +1,31 @@ + +function mul(x, y) { return x * y; }; +function mulConst0(x) { return x * 0; }; +function mulConst1(x) { return -5 * x; }; +function mulConst2(x) { return x * -5; }; + +function f() { + assertEq(mulConst0(7), 0); + assertEq(mulConst0(-5), -0); + assertEq(mulConst0(0), 0); + assertEq(mulConst0(-0), -0); + + assertEq(mulConst1(7), -35); + assertEq(mulConst1(-8), 40); + assertEq(mulConst1(0), -0); + assertEq(mulConst1(-0), 0); + + assertEq(mulConst2(7), -35); + assertEq(mulConst2(-8), 40); + assertEq(mulConst2(0), -0); + assertEq(mulConst2(-0), 0); + + assertEq(mul(55, 2), 110); + assertEq(mul(0, -10), -0); + assertEq(mul(-5, 0), -0); + assertEq(mul(-0, 0), -0); + assertEq(mul(0, -0), -0); + assertEq(mul(0, 0), 0); + assertEq(mul(-0, -0), 0); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/negation.js b/js/src/jit-test/tests/jaeger/negation.js new file mode 100644 index 0000000000..f0f3e51853 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/negation.js @@ -0,0 +1,2 @@ +var n = -2147483648;
+assertEq(-n, 2147483648);
diff --git a/js/src/jit-test/tests/jaeger/normalIntTypedArrays.js b/js/src/jit-test/tests/jaeger/normalIntTypedArrays.js new file mode 100644 index 0000000000..8bb4627fa6 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/normalIntTypedArrays.js @@ -0,0 +1,49 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function testInt32Array(L) { + var f = new Int32Array(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13; + f[2] = f[1]; + f[L+3] = 4294967295; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13); + assertEq(f[2], 13); + assertEq(f[3], -1); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +function testUint32Array(L) { + var f = new Uint32Array(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13; + f[2] = f[1]; + f[L+3] = 4294967295; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13); + assertEq(f[2], 13); + assertEq(f[3], 4294967295); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +for (var i = 0; i < 10; i++) { + //testInt32Array(0); + testUint32Array(0); + if (i == 5) + gc(); +} + diff --git a/js/src/jit-test/tests/jaeger/optimize-globals-1.js b/js/src/jit-test/tests/jaeger/optimize-globals-1.js new file mode 100644 index 0000000000..4197a27174 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/optimize-globals-1.js @@ -0,0 +1,9 @@ + +function testLocalNames() { + var NaN = 4; + var undefined = 5; + var Infinity = 6; + return NaN + undefined + Infinity; +} +assertEq(testLocalNames(), 15); + diff --git a/js/src/jit-test/tests/jaeger/optimize-globals-2.js b/js/src/jit-test/tests/jaeger/optimize-globals-2.js new file mode 100644 index 0000000000..2e01cdcb04 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/optimize-globals-2.js @@ -0,0 +1,20 @@ + +function testNaN(x) { + var x = NaN; + assertEq(isNaN(x), true); +} +testNaN(); + +function testInfinity(x) { + return (x === Infinity); +} +assertEq(testInfinity(Infinity), true); +assertEq(testInfinity(6), false); +assertEq(testInfinity(-Infinity), false); + +function testUndefined(x) { + return (x === undefined); +} +assertEq(testUndefined(undefined), true); +assertEq(testUndefined(), true); +assertEq(testUndefined(5), false); diff --git a/js/src/jit-test/tests/jaeger/optimize-globals-3.js b/js/src/jit-test/tests/jaeger/optimize-globals-3.js new file mode 100644 index 0000000000..eb2474c45b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/optimize-globals-3.js @@ -0,0 +1,9 @@ + +NaN = 4; +undefined = 5; +Infinity = 6; + +assertEq(isNaN(NaN), true); +assertEq(Infinity > 100, true); +assertEq(undefined != 5, true); + diff --git a/js/src/jit-test/tests/jaeger/propertyOptimize-1.js b/js/src/jit-test/tests/jaeger/propertyOptimize-1.js new file mode 100644 index 0000000000..47ac2fc6ef --- /dev/null +++ b/js/src/jit-test/tests/jaeger/propertyOptimize-1.js @@ -0,0 +1,29 @@ + +function Foo(x) +{ + this.f = x + 10; +} + +function Bar() +{ + this.g = 0; +} + +Bar.prototype = Foo.prototype; + +var x = new Foo(0); +var y = new Bar(); + +assertEq(10, eval("x.f")); +assertEq(undefined, eval("y.f")); + +function Other(x) +{ + this.f = x + 10; +} + +var a = new Other(0); +var b = Object.create(Other.prototype); + +assertEq(10, eval("a.f")); +assertEq(undefined, eval("b.f")); diff --git a/js/src/jit-test/tests/jaeger/propertyOptimize-2.js b/js/src/jit-test/tests/jaeger/propertyOptimize-2.js new file mode 100644 index 0000000000..88df13e2c7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/propertyOptimize-2.js @@ -0,0 +1,16 @@ + +function Foo(x) +{ + this.f = x + 10; +} + +var x = new Foo(0); +assertEq(10, eval("x.f")); + +called = false; +Object.defineProperty(Foo.prototype, 'f', {set: function() { called = true; }}); + +var y = new Foo(0); +assertEq(10, eval("x.f")); +assertEq(undefined, eval("y.f")); +assertEq(called, true); diff --git a/js/src/jit-test/tests/jaeger/propertyOptimize-3.js b/js/src/jit-test/tests/jaeger/propertyOptimize-3.js new file mode 100644 index 0000000000..90327e47a3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/propertyOptimize-3.js @@ -0,0 +1,67 @@ + +// Properties cleared in the middle of a single function constructor. + +function foo(x, y) { + this.f = 0; + this.g = x + y; + this.h = 2; +} + +var called = false; +var a = 0; +var b = {valueOf: function() { Object.defineProperty(Object.prototype, 'g', {set: function() { called = true }}) }}; +var c = new foo(a, b); + +assertEq(called, true); +assertEq(c.g, undefined); + +// Properties cleared in the middle of a constructor callee. + +function foo2(x, y) { + this.a = 0; + this.b = 1; + bar2.call(this, x, y); + this.c = 2; +} +function bar2(x, y) { + this.d = x + y; + this.e = 3; +} + +var called2 = false; +var xa = 0; +var xb = {valueOf: function() { Object.defineProperty(Object.prototype, 'e', {set: function() { called2 = true }}) }}; +var xc = new foo2(xa, xb); + +assertEq(called2, true); +assertEq(xc.e, undefined); +assertEq(xc.c, 2); + +// Properties cleared after a constructor callee. + +function foo3() { + this.aa = 0; + this.bb = 1; + bar3.call(this); + this.cc = 2; + baz(); + xbar3.call(this); + this.dd = 3; +} +function bar3() { + this.ee = 4; +} +function xbar3() { + this.ff = 5; +} +function baz() { + eval("xbar3.call = function() { called3 = true }"); +} + +var called3 = false; +var c3 = new foo3(); +assertEq(c3.cc, 2); +assertEq(c3.ee, 4); +assertEq(c3.ff, undefined); +assertEq(c3.dd, 3); +assertEq(called3, true); diff --git a/js/src/jit-test/tests/jaeger/propertyOptimize-4.js b/js/src/jit-test/tests/jaeger/propertyOptimize-4.js new file mode 100644 index 0000000000..942474875a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/propertyOptimize-4.js @@ -0,0 +1,17 @@ +// Make sure new script properties can be invalidated on specialized prototype +// types while they are still being constructed. + +function Foo(a, b, c) { + this.x = a + b; + this.y = c; +} + +updated = false; +var o = {valueOf: function() { + Object.defineProperty(Object.prototype, 'y', {set:function() { updated = true; }}) + }}; + +function Bar() {} +Bar.prototype = new Foo(o, 1, 2); +assertEq(updated, true); +assertEq(Bar.prototype.y, undefined); diff --git a/js/src/jit-test/tests/jaeger/recompile/arith.js b/js/src/jit-test/tests/jaeger/recompile/arith.js new file mode 100644 index 0000000000..a705a2937b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/arith.js @@ -0,0 +1,49 @@ + +/* Handle recompilation of arithmetic operations, and on-stack int -> double conversion. */ + +function add(x, y) +{ + var z = x + y; + assertEq(z, 2147483732); + assertEq(z - 10, 2147483722); +} +add(0x7ffffff0, 100); + +function mul(x, y) +{ + var z = x * y; + assertEq(z, 4294967264); +} +mul(0x7ffffff0, 2); + +function div1(x, y) +{ + var z = x / y; + assertEq(z + 10, 20); +} +div1(100, 10); + +function div2(x, y) +{ + var z = x / y; + assertEq(z + 10, 20.5); +} +div2(105, 10); + +function uncopy(x, y) +{ + var q = x; + x += y; + q++; + assertEq(q, 2147483633); + assertEq(x, 2147483732); +} +uncopy(0x7ffffff0, 100); + +function addmore(x, y) +{ + var q = (x + 10) + (x + y); + assertEq(q, 4294967374); + x = q; +} +addmore(0x7ffffff0, 100); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug617592.js b/js/src/jit-test/tests/jaeger/recompile/bug617592.js new file mode 100644 index 0000000000..cec1774803 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug617592.js @@ -0,0 +1,3 @@ + +var x; +-(x === null); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug621292.js b/js/src/jit-test/tests/jaeger/recompile/bug621292.js new file mode 100644 index 0000000000..11dca94710 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug621292.js @@ -0,0 +1,24 @@ + +/* Don't crash. */ + +var count = 0; + +function callbackfn(v) { + if (++count == 98) + count = 0x7ffffff0; + return arr[0] + count; +} + +function foo() { + arr = [1,2,3,4,5]; + for (var i = 0; i < 50; i++) + arr = arr.map(callbackfn); +} +foo(); + +function f(a,b,c) { + a = 1; b = 'str'; c = 2.1; + return arguments[0]; +} +for (var i = 0; i < 20; i++) + assertEq(f(10,'sss',1), 1); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug621328.js b/js/src/jit-test/tests/jaeger/recompile/bug621328.js new file mode 100644 index 0000000000..f755549c96 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug621328.js @@ -0,0 +1,9 @@ +function foo() { +}; +function f() { + var e = foo; + a = new e(); + assertEq(typeof(a), "object"); + e=a; +} +f(); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug638977.js b/js/src/jit-test/tests/jaeger/recompile/bug638977.js new file mode 100644 index 0000000000..0fac782249 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug638977.js @@ -0,0 +1,6 @@ +function f() { + gc(); + [].unshift(false); +} +f(); +f(); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug639508.js b/js/src/jit-test/tests/jaeger/recompile/bug639508.js new file mode 100644 index 0000000000..a25a70c601 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug639508.js @@ -0,0 +1,2 @@ +var o = 2; +o = o.p; diff --git a/js/src/jit-test/tests/jaeger/recompile/bug639882.js b/js/src/jit-test/tests/jaeger/recompile/bug639882.js new file mode 100644 index 0000000000..3f9f898a29 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug639882.js @@ -0,0 +1,5 @@ +var x = 2; +x = -(x == 3); + +var y = ""; +typeof(z) + typeof(eval("z = y")); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug640608.js b/js/src/jit-test/tests/jaeger/recompile/bug640608.js new file mode 100644 index 0000000000..1c5c3c8106 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug640608.js @@ -0,0 +1,10 @@ +try { +{ + function x() {} +} +o = (0).__proto__; +function f(o) { + o._("", function() {}) +} +f(o) +} catch (e) {} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug641225.js b/js/src/jit-test/tests/jaeger/recompile/bug641225.js new file mode 100644 index 0000000000..7b79781972 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug641225.js @@ -0,0 +1,149 @@ +gczeal(1); +var o0 = Function.prototype; +o1 = {}; +var o4 = Error.prototype; +o5 = new Int32Array(100); +o6 = new Proxy({}, {}) +o8 = new Proxy(function() { return {}; }, { + get: function() { return 10; }, +}); +o9 = {}; +var o10 = -500; +var o12 = new Int32Array(100); +function f0(o) { +} +function f1(o) { +} +function f3(o) { + with(o) {} + o[o5] = o5; +} +function f5(o) { +}for(var f2 in o9) { + for(var i1=0; i1<83; i1++) { + for(var i3=0; i3<98; i3++) { + for(var x in f1) { f1[x]; }; + } + Object.defineProperty(o0, 'constructor', {enumerable: true,unused: 1 }); + f1(f5); + f4(f3); + f3(o8); + f2(o5); + o9.toString(1, 2); + f4.caller = o3; + f2(o6); + f0(f2); + f1(f2); + f0(f1); + var key = Object.getOwnPropertyNames(o9)[2]; if(key) delete o9[key]; + var props = Object.getOwnPropertyNames(o5); + if (props.length > 6) { + var prop = props[6]; + o8[prop] = o5[prop]; + } + f3(f1); + f1(f5); + } + for(var o3 in f1) { + f1(o3); + f4(o3); + o0 == f4; + f1(f3); + Object.freeze(o12); + f0(o9); + new f0(o1); + o4 = o5.call(o4, o4, o4, o4, o4, o4); + f2(o10); + var prop = Object.getOwnPropertyNames(o0)[15]; + if (prop) { Object.defineProperty(o0, prop, {configurable: true,enumerable: true,get: function(){},set: function(){},unused: 1 }); } + f3(f1); + new f2(o0); + } + f5(o9); + gc(); + f0(o2); + f3(f4); + new f4(o7); + f1 = new o10(f1, f1, f1, f1); + f5(o10); + f5(o7); + f0(o7); + f1(o10); + f3(o10); + delete f0.constructor; + f0(f3); + f1 = wrap(f3); + f4(f1); + delete o1.prototype; + f4(o5); + f2(f2); + o1 + ''; + f2(f2); + f0(o12); + f0(o12); + f1(o3); + o5[3] = 8.3; + o10['__proto_' + '_']; +} +for(var o2 in f5) { + for(var o10 in f3) { + delete f2['__proto_' + '_']; + o8 = f1.toString; + f1(o1); + f0(o9); + f2(o12); + var key = Object.getOwnPropertyNames(o3)[19]; if(key) o9 = o3[key]; + f1(o10); + f4(f1); + f1(o1); + f1(o7); + for(var x in o1) { o1[x]; }; + f0(o8); + f4(o1); + f0(o1); + f0.p0 = o6; + f3(o9); + f5(o8); + f2 >>> o7; + if(o3 === o8) {} + f5(o3); + } + o5[0] = f4; + o0.caller = function() { }; + Object.freeze(f0); + f4(o3); + o7.p0 = o3; + f1(f5); + f4(o10); + f2(o5); + f2(o5); + f0(o3); + o8[o8] = o8; + f0(o5); + f1(o6); + f2 = Object.create(o5); + var key = Object.getOwnPropertyNames(o11)[23]; if(key) f2 = o11[key]; + f5(o9); + o12 = o6.bind(o12, o12, o12); + f5(f4); + f1(o1); + f0(o11); + f1(o11); + eval('f4'); + f4(o1); + Object.isExtensible(o7); +} +(function() { + f1(o12); + f5 + ''; + if(o8 != o3) {} +})(); +f1(o10); +f3(f0); +o4.toSource = function() { }; +var _o = o1; +var prop = Object.getOwnPropertyNames(_o)[5]; +if (prop) { _o[prop](o2, o2); } +f3(o0); +f1(f3); +Object.isExtensible(f1); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug641269.js b/js/src/jit-test/tests/jaeger/recompile/bug641269.js new file mode 100644 index 0000000000..413d65070a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug641269.js @@ -0,0 +1,8 @@ +// |jit-test| error: ReferenceError + +var g = newGlobal({newCompartment: true}); +var dbg = new g.Debugger(this); + +(function() { + const x = [][x] +})() diff --git a/js/src/jit-test/tests/jaeger/recompile/bug641535.js b/js/src/jit-test/tests/jaeger/recompile/bug641535.js new file mode 100644 index 0000000000..732eeb08cb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug641535.js @@ -0,0 +1,2 @@ +var o = {}; +o[o.p] = 2; diff --git a/js/src/jit-test/tests/jaeger/recompile/bug642405.js b/js/src/jit-test/tests/jaeger/recompile/bug642405.js new file mode 100644 index 0000000000..2bbca34832 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug642405.js @@ -0,0 +1,13 @@ +function startTest() {}; +try { +} +catch(ex) +{ + actual = ex + ''; +} +var actual = 'no error'; +var prefValue; +DESCRIPTION = "var class = true"; +EXPECTED = "error"; +foo(EXPECTED[prefValue], DESCRIPTION[prefValue], startTest[prefValue]); +function foo() {} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug643182.js b/js/src/jit-test/tests/jaeger/recompile/bug643182.js new file mode 100644 index 0000000000..cb134fe0bd --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug643182.js @@ -0,0 +1,7 @@ +x = 123; +function f() {} +function g(o) { + y = x.p; + eval('o'); +} +g(f); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug643376.js b/js/src/jit-test/tests/jaeger/recompile/bug643376.js new file mode 100644 index 0000000000..300fbc90d7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug643376.js @@ -0,0 +1,8 @@ +SECTION = 0; +function TestCase() {} +function outer_func(x) +{ + var y = "inner"; + new TestCase( SECTION, { SECTION: ++y }); +} +outer_func(1111); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug643669.js b/js/src/jit-test/tests/jaeger/recompile/bug643669.js new file mode 100644 index 0000000000..d66639df40 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug643669.js @@ -0,0 +1,3 @@ +try {(function () { + eval("gc().l()") + })() } catch (e) {} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug645044.js b/js/src/jit-test/tests/jaeger/recompile/bug645044.js new file mode 100644 index 0000000000..e31762a8e6 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug645044.js @@ -0,0 +1,4 @@ + +this.__defineGetter__("x", gc); +x.__proto__ = this; +__proto__ = 44; diff --git a/js/src/jit-test/tests/jaeger/recompile/bug646267.js b/js/src/jit-test/tests/jaeger/recompile/bug646267.js new file mode 100644 index 0000000000..2f15037675 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug646267.js @@ -0,0 +1,8 @@ +function t(code) { + var f = new Function(code); + try { f(); } catch (e) { } +} +t(""); +t(""); +t(""); +t("this.function = 7;"); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug647183.js b/js/src/jit-test/tests/jaeger/recompile/bug647183.js new file mode 100644 index 0000000000..0405a548a4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug647183.js @@ -0,0 +1,23 @@ +var SECTION = ""; +var VERSION = ""; +function test() {} +function writeTestCaseResult( expect, actual, string ) { + if (typeof document != "object" || +!document.location.href.match(/jsreftest.html/)) { + } +} +TIME_0000 = now = new Date; +TIME_NOW = now.valueOf(); +function DaysInYear( y ) { +function MakeDate( day, time ) { + +} +} +function TimeClip( t ) { + if ( isNaN ) { Number.NaN; } +} +function runDSTOffsetCachingTestsFraction(part, parts) { print; }; +test_times=( TIME_NOW, TIME_0000, ( SECTION, VERSION+".getUTCMinutes()", + TIME_NOW.test_times,VERSION.SECTION ) , TIME_0000, TIME_0000, + 0, 0 ); +try { j = 0( SECTION, TimeClip(1.1), 0 ); } catch (e) {} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug647199.js b/js/src/jit-test/tests/jaeger/recompile/bug647199.js new file mode 100644 index 0000000000..d8ad7994a6 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug647199.js @@ -0,0 +1,11 @@ +TryInWhile( new TryObject( "hello", ThrowException, true ) ); +function TryObject( value, throwFunction, result ) { + this.thrower=throwFunction +} +function ThrowException() { return TryInWhile(1); } +function TryInWhile( object ) { + try { + object.thrower() + } catch ( e ) { + } +} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug647532.js b/js/src/jit-test/tests/jaeger/recompile/bug647532.js new file mode 100644 index 0000000000..3c8bc3f404 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug647532.js @@ -0,0 +1,4 @@ +try { Function("\ + __defineSetter__(\"x\",Object.keys)\ + (z=x instanceof[].some)\ +")() } catch (e) { } diff --git a/js/src/jit-test/tests/jaeger/recompile/bug647547.js b/js/src/jit-test/tests/jaeger/recompile/bug647547.js new file mode 100644 index 0000000000..6f9c970aa7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug647547.js @@ -0,0 +1,9 @@ +DoWhile(new DoWhileObject); +new DoWhileObject("", Boolean); +function DoWhileObject( d, e, s ) { + this.whileExpression=e; +} +function DoWhile( object ) { + while ( object.whileExpression ) eval( ); + Boolean +} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug647991-1.js b/js/src/jit-test/tests/jaeger/recompile/bug647991-1.js new file mode 100644 index 0000000000..2597524478 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug647991-1.js @@ -0,0 +1,18 @@ +function f() { + function g() { + eval(""); + gc(); + Math.abs(4); + NaN; + } + g(); +} +function h() { + var x, y; + x = Math.floor(-0); + y = parseInt("1"); +} + +f(); +h(); + diff --git a/js/src/jit-test/tests/jaeger/recompile/bug647991-2.js b/js/src/jit-test/tests/jaeger/recompile/bug647991-2.js new file mode 100644 index 0000000000..6ebea8482d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug647991-2.js @@ -0,0 +1,2 @@ +[""][NaN] = 2; +-([][[""][String] = ""] = null); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug648502.js b/js/src/jit-test/tests/jaeger/recompile/bug648502.js new file mode 100644 index 0000000000..26caf6b615 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug648502.js @@ -0,0 +1,12 @@ +function f(x, y) { + -(undefined ? 0 : 0); + assertEq(y === y, true); + return 0; +} +f(1, 2); +{ + f(3, 3.14); + f(true, f(4, 5)); + + function g() {} +} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug648567.js b/js/src/jit-test/tests/jaeger/recompile/bug648567.js new file mode 100644 index 0000000000..5b7df219d9 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug648567.js @@ -0,0 +1,16 @@ +var arr = [-10, true]; +true || arr[0]; + +function g() { + var x = arr[12]; + var y = arr.length; + arr[undefined] = x; + assertEq(y, 2); +} +{ + function f() { + gc(); + g(); + } + f(); +} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug648843.js b/js/src/jit-test/tests/jaeger/recompile/bug648843.js new file mode 100644 index 0000000000..37de8fbbe5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug648843.js @@ -0,0 +1,8 @@ + +function Q(on) +{ + options().match +} +function options() { return "methodjit"; } +gczeal(2); +for (i = 0; i < 100 ; ++i) { Q(Q(42, [])); } diff --git a/js/src/jit-test/tests/jaeger/recompile/bug648966.js b/js/src/jit-test/tests/jaeger/recompile/bug648966.js new file mode 100644 index 0000000000..df0f9d8cd3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug648966.js @@ -0,0 +1,7 @@ + +function f(x) { + gc(); + -x; + -null; +} +f(); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug649261.js b/js/src/jit-test/tests/jaeger/recompile/bug649261.js new file mode 100644 index 0000000000..fabc38e73e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug649261.js @@ -0,0 +1,2 @@ +var DESCRIPTION; +eval("DESCRIPTION += \"Non-character escapes in identifiers negative test.\";"); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug649769.js b/js/src/jit-test/tests/jaeger/recompile/bug649769.js new file mode 100644 index 0000000000..28c823b422 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug649769.js @@ -0,0 +1,16 @@ + +function g(x) { + if (!x) { + throw 1; + } +} + +function f(a, b, c, d) { + var x = [].push(3); + g(true); + assertEq(x, 1); +} +f(1.2, 2, 3, 4); +gc(); +f(1, 2, 3, 4); + diff --git a/js/src/jit-test/tests/jaeger/recompile/bug651119.js b/js/src/jit-test/tests/jaeger/recompile/bug651119.js new file mode 100644 index 0000000000..598a36574d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug651119.js @@ -0,0 +1,51 @@ +Object.extend = function(destination, source) { + for (var property in source) + destination[property] = source[property]; +}; +var Enumerable = { + _each: function(iterator) { + for (var i = 0, length = this.length; i < length; i++) + iterator(this[i]); + }, + each: function(iterator, context) { + var index = 0; + this._each(function(value) { + iterator.call(context, value, index++); + }); + }, + map: function(iterator, context) { + var results = []; + this.each(function(value, index) { + var res = iterator.call(context, value); + results.push(res); + }); + return results; + }, + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, +}; +Object.extend(Array.prototype, Enumerable); +function $A(iterable) { + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; +} +function g() { + return [1, 2, 3, 4, 5].each(function(part) { + return 0; + }); +} +function f() { + g(); + g(); + g(); + g(); + var result = [[2, 1, 3], [6, 5, 4]]; + result = result.invoke('invoke', 'toString', 2); + result[0].join(', '); +}; +f(); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug653980.js b/js/src/jit-test/tests/jaeger/recompile/bug653980.js new file mode 100644 index 0000000000..f5a4d2a9f0 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug653980.js @@ -0,0 +1,13 @@ + +function f(code) { + try { + Function(code)() + } catch(r) {} +} { + function x() {} +} +f("") +f("") +f("") +f("x::e") +if (typeof w == "") {} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug654536.js b/js/src/jit-test/tests/jaeger/recompile/bug654536.js new file mode 100644 index 0000000000..5a3266ff6a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug654536.js @@ -0,0 +1,6 @@ +function f() { + var x = Object.prototype.hasOwnProperty.call(1); + assertEq(x, false); + isNaN(2); +} +f(); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug655949.js b/js/src/jit-test/tests/jaeger/recompile/bug655949.js new file mode 100644 index 0000000000..1adace1a10 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug655949.js @@ -0,0 +1,6 @@ +var a; +try { + a(); +} catch(e) { + assertEq(e instanceof TypeError, true); +} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug655998.js b/js/src/jit-test/tests/jaeger/recompile/bug655998.js new file mode 100644 index 0000000000..a48eb32152 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug655998.js @@ -0,0 +1,7 @@ +function f(x) { + var y; + gc(); + ++x.x; +} +f(1); +f.call(2, 3); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug657288.js b/js/src/jit-test/tests/jaeger/recompile/bug657288.js new file mode 100644 index 0000000000..2a19c5c515 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug657288.js @@ -0,0 +1,9 @@ +// |jit-test| error: TypeError +new DoWhileObject; +function DoWhileObject(breakOut, breakIn, iterations, loops) { + loops.prototype = new DoWhile; + this.looping; +} +function DoWhile(object) { + do {} while (object); +} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug658209.js b/js/src/jit-test/tests/jaeger/recompile/bug658209.js new file mode 100644 index 0000000000..966c10f28b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug658209.js @@ -0,0 +1,10 @@ +for (var i=0; i<20; i++) { + (function () { + var x; + (function () { + x = /abc/; + x++; + gc(); + })(); + })(); +} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug658211.js b/js/src/jit-test/tests/jaeger/recompile/bug658211.js new file mode 100644 index 0000000000..02de292591 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug658211.js @@ -0,0 +1,13 @@ +function foo(x) { + return bar(x); +} +function bar(x) { + return x.f + 10; +} +var g = Object(); +g.f = 10; +assertEq(foo(g), 20); +assertEq(foo(g), 20); +assertEq(foo(g), 20); +eval("g.f = 'three'"); +assertEq(foo(g), 'three10'); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug658212.js b/js/src/jit-test/tests/jaeger/recompile/bug658212.js new file mode 100644 index 0000000000..e462770b56 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug658212.js @@ -0,0 +1,33 @@ +var gTestcases = Array; +function TestCase(n, d, e, a) { + this.description = d + gTestcases[gTc] = this +} +TestCase.prototype.dump=function () { return + + + + + this.description + + + + + '\n'; +}; +function printStatus (msg) { + return function toPrinted(value) { + }; +} +function reportCompare(expected, actual, description) { + new TestCase("unknown-test-name", description, expected, actual) +} +gTc = 0;; +function jsTestDriverEnd() { + for (var i = 0; i < gTestcases.length; i++) + gTestcases[i].dump() +} +var summary = 'Do not assert with try/finally inside finally'; +var expect = 'No Crash'; +reportCompare(expect, printStatus, summary); +jsTestDriverEnd(); +jsTestDriverEnd(); +try { + f +} catch (ex) { + actual = '' +} +reportCompare(expect, actual, 5); +jsTestDriverEnd() diff --git a/js/src/jit-test/tests/jaeger/recompile/bug658561.js b/js/src/jit-test/tests/jaeger/recompile/bug658561.js new file mode 100644 index 0000000000..a8c0937c00 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug658561.js @@ -0,0 +1,5 @@ +var s1 = 'xx'; +for (var x = 0; x < 10 ; ++x ) { + new function() { return s1++; }; + gc(); +} diff --git a/js/src/jit-test/tests/jaeger/recompile/bug658777.js b/js/src/jit-test/tests/jaeger/recompile/bug658777.js new file mode 100644 index 0000000000..7f6ec16e15 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug658777.js @@ -0,0 +1,11 @@ +function Employee(name, dept) { return this.name = name || ""; } +function WorkerBee(name, dept, projs) { + this.base = Employee + this.base(name, dept) +} +function Engineer(name, projs, machine) { + this.base = WorkerBee + this.base(name, "engineering", projs) + __proto__["a" + constructor] = 1 +} +new Engineer; diff --git a/js/src/jit-test/tests/jaeger/recompile/bug659639.js b/js/src/jit-test/tests/jaeger/recompile/bug659639.js new file mode 100644 index 0000000000..4e7ffe2880 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug659639.js @@ -0,0 +1,16 @@ +test(); +function iso(d) { new Date(d).toISOString() } +function check(s,millis) { iso(millis); } +function dd(year, month, day, hour, minute, second, millis) { + return Date.UTC(year, 1, day, hour, minute, second, millis); +} +function test() { + try { + check("", 20092353211) + check("", 2009) + check("", 0) + check("", dd(BUGNUMBER, 7, 23, 19, 53, 21, 1)) + } catch (e) {} +} +var BUGNUMBER = "10278"; +test() diff --git a/js/src/jit-test/tests/jaeger/recompile/bug659766.js b/js/src/jit-test/tests/jaeger/recompile/bug659766.js new file mode 100644 index 0000000000..fac969288b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug659766.js @@ -0,0 +1,29 @@ +var gTestcases = new Array; +var gTc = gTestcases; +function TestCase(n, d, e, a) { + this.description=d + this.reason='' + gTestcases[gTc++]=this +} +TestCase.prototype.dump=function () { return + toPrinted(this.description) + toPrinted(this.reason) + '\n'; }; +function toPrinted(value) { return value=value.replace(/\\n/g, 'NL').replace(/[^\x20-\x7E]+/g, escapeString); } +function escapeString (str) { + try { + err + } catch(ex) { } +} +function jsTestDriverEnd() { + for (var i = 0; i < gTestcases.length; i++) + gTestcases[i].dump() +} +var SECTION = "dowhile-007"; +DoWhile(); +function DoWhile( object ) { return result1=false; } +new TestCase( + SECTION, + "break one: ", + result1 +); +jsTestDriverEnd(); +new TestCase( SECTION, "'�O� �:i��'.match(new RegExp('.+'))", [], '�O� �:i��'); +jsTestDriverEnd(); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug661859.js b/js/src/jit-test/tests/jaeger/recompile/bug661859.js new file mode 100644 index 0000000000..f0ca2400f5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug661859.js @@ -0,0 +1,24 @@ +function TestCase(n, d, e, a) { return this.expect = e; } +function reportCompare(expected, actual, description) { + typeof actual +} +expect = 1; +var summary = 'Do not assert: top < ss->printer->script->depth'; +var actual = 'No Crash'; +var expect = 'No Crash'; +test(); +function notInlined(f) { + // prevent inlining this function, as a consequence, it prevent inlining + // Array.prototype.some (Bug 1087468) + with ({}) {} + return f; +} +function test(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) { + try { + p = [1].some(notInlined(function (y) { return test(); })) ? 4 : 0x0041; + } catch (ex) {} + reportCompare(expect, actual, summary) +} +test(); +TestCase(); +test() diff --git a/js/src/jit-test/tests/jaeger/recompile/bug663690.js b/js/src/jit-test/tests/jaeger/recompile/bug663690.js new file mode 100644 index 0000000000..1738d01968 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug663690.js @@ -0,0 +1,14 @@ + +function g(c) { + b = b = h(c); +} +function j(s) { + return Function(s) +} +function h(c) { + return j(c)() +} +g() +var a +Boolean.__proto__[a] = [] +g("return gc()") diff --git a/js/src/jit-test/tests/jaeger/recompile/bug671943-2.js b/js/src/jit-test/tests/jaeger/recompile/bug671943-2.js new file mode 100644 index 0000000000..7b262b9b67 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug671943-2.js @@ -0,0 +1,10 @@ +if (typeof schedulegc != 'undefined') + schedulegc(11); +function foo(n) { + if (n == 10) + foo.apply = function(a, b) { return b[0]; } + return n; +} +function bar() { return foo.apply(null, arguments); } +for (var i = 0; i < 20; i++) + assertEq(bar(i), i); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug672123.js b/js/src/jit-test/tests/jaeger/recompile/bug672123.js new file mode 100644 index 0000000000..d2ca2497e7 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug672123.js @@ -0,0 +1,46 @@ +var caught = false; +function h(code) { + f = eval("(function(){" + code + "})") + g() +} +function g() { + try { + f(); + } catch (r) { caught = true } +} +h("") +for (i = 0; i < 9; i++) { + h("") +} +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("") +h("\"\"(gc())") +assertEq(caught, true); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug674391.js b/js/src/jit-test/tests/jaeger/recompile/bug674391.js new file mode 100644 index 0000000000..7fdc2c3037 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug674391.js @@ -0,0 +1,11 @@ +a = []; +for (var i = 0; i < 1000; i++) { + a[i] = i; +} +function foo(x) { + for (var i in x) { + } +} +if (typeof schedulegc != "undefined") + schedulegc(100); +foo(a); diff --git a/js/src/jit-test/tests/jaeger/recompile/bug676764.js b/js/src/jit-test/tests/jaeger/recompile/bug676764.js new file mode 100644 index 0000000000..fca27de64c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug676764.js @@ -0,0 +1,14 @@ + +try { with( {"a":1} ) { + (function () { + for (;;) { + t + } + })() +} } catch (e) {} + +with( {"b":2} ) { + (function () { + for (b = 0; b < 18; ++b) {} + })(); +} diff --git a/js/src/jit-test/tests/jaeger/recompile/callic.js b/js/src/jit-test/tests/jaeger/recompile/callic.js new file mode 100644 index 0000000000..6647c9acf6 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/callic.js @@ -0,0 +1,27 @@ + +/* Recompilation while being processed by a call IC. */ + +var g; +function foo() { + for (g = 0; g < 5; g++) { + bar(); + } + function bar() { + with ({}) { + eval("g = undefined;"); + } + } +} +foo(); + +assertEq(g, NaN); + +/* Recompilation while being processed by a native call IC. */ + +function native() { + var x; + x = x; + x = Math.ceil(NaN); + assertEq(x, NaN); +} +native(); diff --git a/js/src/jit-test/tests/jaeger/recompile/exotic.js b/js/src/jit-test/tests/jaeger/recompile/exotic.js new file mode 100644 index 0000000000..c1630d50a5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/exotic.js @@ -0,0 +1,64 @@ + +// Test exotic ways of triggering recompilation. + +// Recompilation triggered by local function. + +var o = {}; +function what(q) { + function inner() { return q; } + o.f = inner; + var a = o.f(); + return a; +} +for (var i = 0; i < 10; i++) { + var a = what(i); + assertEq(a, i); +} + +// Lowered scripted call to apply returning code pointer. + +var global = 3; +function foo(x, y) { + var q = x.apply(null, y); + if (q != 10) + assertEq(global, true); +} +foo(function(a) { global = a; return 10; }, [1]); +foo(function(a) { global = a; return 10; }, [1]); +foo(function(a) { global = a; return 10; }, [1]); +assertEq(global, 1); +foo(function(a) { global = a; return 3; }, [true]); +assertEq(global, true); + +// Lowered scripted call returning NULL. + +var oglobal = 3; +function xfoo(x, y) { + var q = x.apply(null, y); + if (q != 10) + assertEq(oglobal, true); +} +xfoo(function(a) { oglobal = a; return 10; }, [1]); +xfoo(function(a) { oglobal = a; return 10; }, [1]); +xfoo(function(a) { oglobal = a; return 10; }, [1]); +assertEq(oglobal, 1); +xfoo(function(a) { [1,2,3]; oglobal = a; return 3; }, [true]); +assertEq(oglobal, true); + +// Recompilation out of SplatApplyArgs. + +weirdarray = [,,1,2,3]; +Object.defineProperty(weirdarray, 0, {get: function() { vglobal = 'true'; }}); + +var vglobal = 3; +function yfoo(x, y) { + var q = x.apply(null, y); + if (q != 10) + assertEq(vglobal, 'true'); + else + assertEq(vglobal, 3); +} +yfoo(function(a) { return 10; }, [1]); +yfoo(function(a) { return 10; }, [1]); +yfoo(function(a) { return 10; }, [1]); +yfoo(function() { return 0; }, weirdarray); diff --git a/js/src/jit-test/tests/jaeger/recompile/flush.js b/js/src/jit-test/tests/jaeger/recompile/flush.js new file mode 100644 index 0000000000..81681e6040 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/flush.js @@ -0,0 +1,18 @@ + +/* Handle flushing of scripted call ICs pointing to recompiled functions. */ + +function add(x, y) { + var z = x + y; + return String(x + y); +} + +function foo() { + var x = 0x7ffffff0; + var res = ""; + for (var i = 0; i < 20; i++) { + res += add(x, i) + ","; + res += add(x, i) + ","; + } + assertEq(res, "2147483632,2147483632,2147483633,2147483633,2147483634,2147483634,2147483635,2147483635,2147483636,2147483636,2147483637,2147483637,2147483638,2147483638,2147483639,2147483639,2147483640,2147483640,2147483641,2147483641,2147483642,2147483642,2147483643,2147483643,2147483644,2147483644,2147483645,2147483645,2147483646,2147483646,2147483647,2147483647,2147483648,2147483648,2147483649,2147483649,2147483650,2147483650,2147483651,2147483651,"); +} +foo(); diff --git a/js/src/jit-test/tests/jaeger/recompile/getelem.js b/js/src/jit-test/tests/jaeger/recompile/getelem.js new file mode 100644 index 0000000000..1c976ac7ee --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/getelem.js @@ -0,0 +1,26 @@ + +/* Unexpected values out of GETELEM */ + +function foo() { + var x = [1,2,3]; + var y; + var z = x[y]; + y = 10; + assertEq(z, "twelve"); +} +Array.prototype["undefined"] = "twelve"; +foo(); + +function fna() { + var a = {}; + a[true] = 1; + assertEq(a["true"], 1); +} +fna(); + +function fnb() { + var a = []; + a[1.1] = 2; + assertEq(a["1.1"], 2); +} +fnb(); diff --git a/js/src/jit-test/tests/jaeger/recompile/incdec.js b/js/src/jit-test/tests/jaeger/recompile/incdec.js new file mode 100644 index 0000000000..93786ba349 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/incdec.js @@ -0,0 +1,92 @@ + +/* Handle recompilation on overflow of inc/dec operations. */ + +function local() +{ + var j = 0x7ffffff0; + for (var i = 0; i < 100; i++) + j++; + assertEq(j, 2147483732); +} +local(); + +function olocal() +{ + var j = 0x7ffffff0; + for (var i = 0; i < 100; i++) { + if (j++ == 5000) + break; + } + assertEq(j, 2147483732); +} +olocal(); + +function arg(j) +{ + for (var i = 0; i < 100; i++) + j++; + assertEq(j, 2147483732); +} +arg(0x7ffffff0); + +function oarg(j) +{ + for (var i = 0; i < 100; i++) { + if (j++ == 5000) + break; + } + assertEq(j, 2147483732); +} +oarg(0x7ffffff0); + +// basic global inc/dec correctness +var x = 1.23; +x = x--; +x = x++; +x = ++x; +x = --x; +assertEq(x, 1.23); + +var g = 0x7ffffff0; +function glob() +{ + for (var i = 0; i < 100; i++) + g++; + assertEq(g, 2147483732); +} +glob(); + +function gname() +{ + n = 0x7ffffff0; + for (var i = 0; i < 100; i++) + n++; + assertEq(n, 2147483732); +} +gname(); + +function prop() +{ + var v = {f: 0x7ffffff0}; + for (var i = 0; i < 100; i++) + v.f++; + assertEq(v.f, 2147483732); +} +prop(); + +function elem(v, f) +{ + for (var i = 0; i < 100; i++) + v[f]++; + assertEq(v.f, 2147483732); +} +elem({f: 0x7ffffff0}, "f"); + +function name() +{ + var v = 0x7ffffff0; + var i; + eval("for (i = 0; i < 100; i++) v++"); + assertEq(v + 10, 2147483742); +} +name(); diff --git a/js/src/jit-test/tests/jaeger/recompile/inlinestubs.js b/js/src/jit-test/tests/jaeger/recompile/inlinestubs.js new file mode 100644 index 0000000000..05a7ee8ef3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/inlinestubs.js @@ -0,0 +1,43 @@ +// rejoining after recompilation from CompileFunction or a native called by an inlined frame. + +var global = 0; +var arr = [ + function() { return 0; }, + function() { return 1; }, + function() { return 2; }, + function() { return 3; }, + function() { return 4; }, + function() { return 5; }, + function() { return 6; }, + function() { return 7; }, + function() { global = -"three"; return 8; } + ]; +function wrap_call(i) { + var fn = arr["" + i]; + return fn(); +} +function foo1() { + var res = 0; + for (var i = 0; i < arr.length; i++) { + res += wrap_call(i); + var expected = (i == arr.length - 1) ? NaN : 10; + assertEq(global + 10, expected); + } +} +foo1(); + +var callfn = Function.call; +function wrap_floor(x, y) { + var z = x; + if (y) + z = {}; // trick the compiler into not inlining the floor() call. + return Math.floor(z); +} + +function foo2(x, y) { + var z = 0; + for (var i = 0; i < y; i++) + z = wrap_floor(x + i, false); + assertEq(z + 10, 2147483661); +} +foo2(0x7ffffff0 + .5, 20); diff --git a/js/src/jit-test/tests/jaeger/recompile/memory-01.js b/js/src/jit-test/tests/jaeger/recompile/memory-01.js new file mode 100644 index 0000000000..aa14746212 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/memory-01.js @@ -0,0 +1,12 @@ + +function foo(n) { + for (var i = 0; i < n; i++) {} + return i; +} + +assertEq(foo(1000), 1000); + +gc(); + +eval("assertEq(foo(1000.5), 1001)"); + diff --git a/js/src/jit-test/tests/jaeger/recompile/memory-02.js b/js/src/jit-test/tests/jaeger/recompile/memory-02.js new file mode 100644 index 0000000000..875487abc2 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/memory-02.js @@ -0,0 +1,19 @@ + +var g = 10; + +function bar(n) { + return g; +} + +function foo(n, v) { + for (var i = 0; i < n; i++) + assertEq(bar(i), v); +} + +foo(10, 10); + +gc(); + +eval("g = 10.5"); + +foo(10, 10.5); diff --git a/js/src/jit-test/tests/jaeger/recompile/memory-03.js b/js/src/jit-test/tests/jaeger/recompile/memory-03.js new file mode 100644 index 0000000000..c5eaf82961 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/memory-03.js @@ -0,0 +1,6 @@ + +eval("var x = 10; function foo() { return x; }"); + +assertEq(foo(), 10); +gc(); +assertEq(foo(), 10); diff --git a/js/src/jit-test/tests/jaeger/recompile/memory-04.js b/js/src/jit-test/tests/jaeger/recompile/memory-04.js new file mode 100644 index 0000000000..794c93802d --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/memory-04.js @@ -0,0 +1,8 @@ + +function foo(x, y) { + gc(); + var z = x + y; + print(z); +} + +foo(0x7ffffff0, 100); diff --git a/js/src/jit-test/tests/jaeger/recompile/native.js b/js/src/jit-test/tests/jaeger/recompile/native.js new file mode 100644 index 0000000000..72a6c25761 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/native.js @@ -0,0 +1,26 @@ + +/* Handle recompilations triggered by native calls. */ + +function dofloor(v) +{ + var res = ""; + for (var i = 0; i < 10; i++) { + var q = Math.floor(v + i); + res += q + ","; + } + assertEq(res, "2147483642,2147483643,2147483644,2147483645,2147483646,2147483647,2147483648,2147483649,2147483650,2147483651,"); +} +dofloor(0x7ffffffa + .5); + +function mapfloor(a) +{ + var b = a.map(function(v) { return Math.floor(v); }); + + var res = ""; + for (var i = 0; i < b.length; i++) + res += b[i] + ","; + return res; +} +mapfloor([1,2]); +mapfloor([3,4]); +assertEq(mapfloor([0x7ffffffa + 2.5, 0x7ffffffa + 20.5]), "2147483644,2147483662,"); diff --git a/js/src/jit-test/tests/jaeger/recompile/nativemulti.js b/js/src/jit-test/tests/jaeger/recompile/nativemulti.js new file mode 100644 index 0000000000..d611586970 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/nativemulti.js @@ -0,0 +1,21 @@ + +/* Recompilation that requires patching the same native stub multiple times. */ + +var first = 0; +var second = 0; + +function foreachweird(a, f, vfirst, vsecond) +{ + a.forEach(f); + assertEq(first, vfirst); + assertEq(second, vsecond); +} + +function weird() { + eval("first = 'one';"); + eval("second = 'two';"); +} + +foreachweird([0], function() {}, 0, 0); +foreachweird([0], function() {}, 0, 0); +foreachweird([0], weird, 'one', 'two'); diff --git a/js/src/jit-test/tests/jaeger/recompile/nativestack.js b/js/src/jit-test/tests/jaeger/recompile/nativestack.js new file mode 100644 index 0000000000..350649afcd --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/nativestack.js @@ -0,0 +1,25 @@ + +/* Recompilation that requires patching the same native stub multiple times on one stack. */ + +var first = 0; +var second = 0; + +function eacher(f, vfirst, vsecond) { + var a = [0]; + a.forEach(f); + assertEq(first, vfirst); + assertEq(second, vsecond); +} + +function one() { + eacher(two, 'one', 'two'); +} + +function two() { + eval("first = 'one';"); + eval("second = 'two';"); +} + +eacher(function () {}, 0, 0); +eacher(function () {}, 0, 0); +eacher(one, 'one', 'two'); diff --git a/js/src/jit-test/tests/jaeger/recompile/patchdouble.js b/js/src/jit-test/tests/jaeger/recompile/patchdouble.js new file mode 100644 index 0000000000..4de0838138 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/patchdouble.js @@ -0,0 +1,7 @@ +// only fix doubles for slots which the recompiled script thinks are doubles. +function foo(x) { + var y = x & 0xffff; + y = (y * (x * 1000)); + assertEq(y, 140735340806145000); +} +foo(0x7fffffff); diff --git a/js/src/jit-test/tests/jaeger/recompile/property.js b/js/src/jit-test/tests/jaeger/recompile/property.js new file mode 100644 index 0000000000..37223563af --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/property.js @@ -0,0 +1,26 @@ + +/* Handle recompilation on undefined properties and array holes. */ + +var v = {}; +if (typeof v == 'string') + v.x = 0; +function prop(v) +{ + var z = v.x + 1; + assertEq(z, NaN); +} +prop(v); + +v = []; +v[0] = 0; +v[1] = 1; +v[3] = 3; +v[4] = 4; +function elem(x) +{ + var x = ""; + for (var i = 0; i < 5; i++) + x += v[i]; + assertEq(x, "01undefined34"); +} +elem(v); diff --git a/js/src/jit-test/tests/jaeger/recompile/propic.js b/js/src/jit-test/tests/jaeger/recompile/propic.js new file mode 100644 index 0000000000..f394c4c467 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/propic.js @@ -0,0 +1,24 @@ + +/* Recompilation while being processed by property ICs. */ + +var ga = 10; +var gb = 10; + +Object.defineProperty(Object.prototype, "a", { + set: function(a) { eval("ga = true;"); }, + get: function() { eval("gb = true;"); } + }); + +function foo() { + var x = {}; + x.a = 10; + assertEq(ga + 1, 2); +} +foo(); + +function bar() { + var x = {}; + var a = x.a; + assertEq(gb + 1, 2); +} +bar(); diff --git a/js/src/jit-test/tests/jaeger/recompile/staticoverflow.js b/js/src/jit-test/tests/jaeger/recompile/staticoverflow.js new file mode 100644 index 0000000000..7387772444 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/staticoverflow.js @@ -0,0 +1,26 @@ + +// overflows occurring during constant folding + +var y = -null - y; +assertEq(y, NaN); + +var x = -(void 0); +assertEq(x, NaN); + +function overdiv() { + for(var i=0; i<25; i++) { + var a, b; + function f() { + } + a = f(); + b = (123 ^ 1) / 1234; + } +} +overdiv(); + +function overadd() { + var a = 0x7ffffff0; + var b = 100; + return a + b; +} +overadd(); diff --git a/js/src/jit-test/tests/jaeger/recompile/undef.js b/js/src/jit-test/tests/jaeger/recompile/undef.js new file mode 100644 index 0000000000..a738c802c6 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/undef.js @@ -0,0 +1,61 @@ + +/* Handle recompilation on undefined variables. */ + +function local() +{ + var x; + x++; + assertEq(x, NaN); + x = 0; +} +local(); + +function name(v) +{ + var x; + with (v) { + x++; + assertEq(x, NaN); + } + assertEq(x, NaN); + x = 0; +} +name({}); + +function letname(v) +{ + if (v) { + let x; + with (v) { + x = "twelve"; + } + assertEq(x, "twelve"); + } +} +letname({}); + +function upvar() +{ + var x; + function inner() { + x++; + assertEq(x, NaN); + } + inner(); +} +upvar(); + +var x; +var y; + +function global() +{ + x++; + assertEq(x, NaN); + var z = 2 + y; + assertEq(z, NaN); +} +global(); + +x = 0; +y = 0; diff --git a/js/src/jit-test/tests/jaeger/regalloc-double.js b/js/src/jit-test/tests/jaeger/regalloc-double.js new file mode 100644 index 0000000000..8d49eb54f5 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/regalloc-double.js @@ -0,0 +1,12 @@ +// register allocation involving doubles. + +function foo(a,b) { + var c; + if (a < b) { + c = a + 1; + } else { + c = 0.5; + } + return c; +} +assertEq(foo(0, 1), 1); diff --git a/js/src/jit-test/tests/jaeger/regalloc-live.js b/js/src/jit-test/tests/jaeger/regalloc-live.js new file mode 100644 index 0000000000..b50ee2a2d3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/regalloc-live.js @@ -0,0 +1,41 @@ + +// test local/arg liveness analysis in presence of many locals + +function foo(a, b, c) { + var x = 0, y = 0, z = 0; + if (a < b) { + x = a + 0; + y = b + 0; + z = c + 0; + } else { + x = a; + y = b; + z = c; + } + return x + y + z; +} +assertEq(foo(1, 2, 3), 6); + +// restore liveness correctly before switch statements + +function foo(a, b, c) { + var x = 0, y = 0, z = 0; + if (a < b) { + x = a + 0; + y = b + 0; + z = c + 0; + } else { + switch (c) { + case 1: + case 2: + case 3: + case 4: + case 5: return 0; + } + x = 0; + y = 0; + z = 0; + } + return x + y + z; +} +assertEq(foo(1, 2, 3), 6); diff --git a/js/src/jit-test/tests/jaeger/regress-bug625701.js b/js/src/jit-test/tests/jaeger/regress-bug625701.js new file mode 100644 index 0000000000..a6f24d9bd4 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/regress-bug625701.js @@ -0,0 +1,10 @@ +gczeal(2); + +for(var i=0; i<20; i++) { + function f() { + for (var j = 0; j < 3; j++) { + (function() {})(); + } + } + f(); +} diff --git a/js/src/jit-test/tests/jaeger/rsh-sanity-1.js b/js/src/jit-test/tests/jaeger/rsh-sanity-1.js new file mode 100644 index 0000000000..3127a32ab8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/rsh-sanity-1.js @@ -0,0 +1,17 @@ +/* Unknown types. */ +function rsh(lhs, rhs) { return lhs >> rhs; } +assertEq(rsh(1024, 2), 256) +assertEq(rsh(1024.5, 2), 256) +assertEq(rsh(1024.5, 2.0), 256) + +/* Constant rhs. */ +var lhs = 1024; +assertEq(lhs >> 2, 256); +lhs = 1024.5; +assertEq(lhs >> 2, 256); + +/* Constant lhs. */ +var rhs = 2; +assertEq(256, 1024 >> rhs); +var rhs = 2.0; +assertEq(256, 1024 >> rhs); diff --git a/js/src/jit-test/tests/jaeger/scriptedICs-1.js b/js/src/jit-test/tests/jaeger/scriptedICs-1.js new file mode 100644 index 0000000000..b0fd505c7e --- /dev/null +++ b/js/src/jit-test/tests/jaeger/scriptedICs-1.js @@ -0,0 +1,39 @@ +T = 12; + +function arity2(q, w, r, t, y) { + var Q1; + var Q2; + var Q3; + var Q4; + var Q5; + var Q6; + var Q7; + var Q8; + var Q9; + T; + return arguments; +} + +function arity(q, w, r) { + var Q1; + var Q2; + var Q3; + var Q4; + var Q5; + var Q6; + var Q7; + var Q8; + var Q9; + T; + return Q9; +} + +for (var i = 0; i < 10; i++) { + arity(); + if (i == 6) + arity = arity2; +} + +/* Don't assert - stubs::CompileFunction must correct |regs.sp| */ + + diff --git a/js/src/jit-test/tests/jaeger/setPropTypeGuard.js b/js/src/jit-test/tests/jaeger/setPropTypeGuard.js new file mode 100644 index 0000000000..3786fc88af --- /dev/null +++ b/js/src/jit-test/tests/jaeger/setPropTypeGuard.js @@ -0,0 +1,23 @@ + +/* + * Get a SETPROP site which is monitored (unknown lhs) and is repeatedly + * invoked on objects with the same shape but different types (and without + * triggering a recompile of the function). The SETPROP PIC needs a type guard + * when the object is being monitored. + */ +var x = {g:0}; +var y = {g:0,f:"fubar"}; +x.f = 10; + +function foo(x) { + for (var i = 0; i < 30; i++) + x.f = 10; +} +function access(x) { + return x.f + 10; +} +foo(Object.create({})); +eval("foo(x)"); +assertEq(access(y), "fubar10"); +eval("foo(y)"); +assertEq(access(y), 20); diff --git a/js/src/jit-test/tests/jaeger/smallIntTypedArrays.js b/js/src/jit-test/tests/jaeger/smallIntTypedArrays.js new file mode 100644 index 0000000000..c63d36bf2a --- /dev/null +++ b/js/src/jit-test/tests/jaeger/smallIntTypedArrays.js @@ -0,0 +1,112 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function testInt8Array(L) { + var f = new Int8Array(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13; + f[2] = f[1]; + f[L+3] = 500; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13); + assertEq(f[2], 13); + assertEq(f[3], -12); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +function testUint8Array(L) { + var f = new Uint8Array(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13; + f[2] = f[1]; + f[L+3] = 500; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13); + assertEq(f[2], 13); + assertEq(f[3], 244); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +function testUint8ClampedArray(L) { + var f = new Uint8ClampedArray(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13; + f[2] = f[1]; + f[L+3] = 500; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13); + assertEq(f[2], 13); + assertEq(f[3], 255); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +function testInt16Array(L) { + var f = new Int16Array(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13; + f[2] = f[1]; + f[L+3] = 190000; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13); + assertEq(f[2], 13); + assertEq(f[3], -6608); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +function testUint16Array(L) { + var f = new Uint16Array(8); + assertEq(f[0], 0); + assertEq(f[L], 0); + assertEq(f[L+8], undefined); + assertEq(f[8], undefined); + f[0] = 12; + f[L+1] = 13; + f[2] = f[1]; + f[L+3] = 190000; + f[L+4] = true; + f[L+5] = L; + assertEq(f[0], 12); + assertEq(f[1], 13); + assertEq(f[2], 13); + assertEq(f[3], 58928); + assertEq(f[4], 1); + assertEq(f[5], 0); +} + +for (var i = 0; i < 10; i++) { + testInt8Array(0); + testUint8Array(0); + testUint8ClampedArray(0); + testInt16Array(0); + testUint16Array(0); + if (i == 5) + gc(); +} + diff --git a/js/src/jit-test/tests/jaeger/strictModeSetUndefinedVar.js b/js/src/jit-test/tests/jaeger/strictModeSetUndefinedVar.js new file mode 100644 index 0000000000..99b846c17b --- /dev/null +++ b/js/src/jit-test/tests/jaeger/strictModeSetUndefinedVar.js @@ -0,0 +1,8 @@ +// |jit-test| error: ReferenceError; + +function f() { + "use strict"; + foo = 1; +} + +f(); diff --git a/js/src/jit-test/tests/jaeger/subCommutativity.js b/js/src/jit-test/tests/jaeger/subCommutativity.js new file mode 100644 index 0000000000..89885c27a8 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/subCommutativity.js @@ -0,0 +1,4 @@ +assertEq(6 - ((void 0) ^ 0x80000005), 2147483649); + +var x = ((void 0) ^ 0x80000005); +assertEq(6 - x, 2147483649); diff --git a/js/src/jit-test/tests/jaeger/tableSwitchConst.js b/js/src/jit-test/tests/jaeger/tableSwitchConst.js new file mode 100644 index 0000000000..6422af3187 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/tableSwitchConst.js @@ -0,0 +1,18 @@ +function f() { + switch(2) { + case 1: return 1; + case 2: return 2; + default: return -1; + } +} +assertEq(f(), 2); + +function g() { + switch(3.14) { + case 3: return 3; + case 4: return 4; + default: return -1; + } +} +assertEq(g(), -1); + diff --git a/js/src/jit-test/tests/jaeger/tableSwitchDouble.js b/js/src/jit-test/tests/jaeger/tableSwitchDouble.js new file mode 100644 index 0000000000..df9fe2a55f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/tableSwitchDouble.js @@ -0,0 +1,13 @@ + +function f(a) { + switch(a) { + case 3: return 3; + case 4: return 4; + default: return -1; + } +} + +assertEq(f(-0.0), -1); +assertEq(f(3.14), -1); +assertEq(f(12.34), -1); + diff --git a/js/src/jit-test/tests/jaeger/tableSwitchEmpty.js b/js/src/jit-test/tests/jaeger/tableSwitchEmpty.js new file mode 100644 index 0000000000..42a050dc63 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/tableSwitchEmpty.js @@ -0,0 +1,14 @@ + +function f(a) { + switch(a) { + } + switch(a) { + default: return 0; + } + assertEq(0, 1); +} + +assertEq(f(), 0); +assertEq(f(0), 0); +assertEq(f(1.1), 0); + diff --git a/js/src/jit-test/tests/jaeger/tableSwitchFloat.js b/js/src/jit-test/tests/jaeger/tableSwitchFloat.js new file mode 100644 index 0000000000..6422af3187 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/tableSwitchFloat.js @@ -0,0 +1,18 @@ +function f() { + switch(2) { + case 1: return 1; + case 2: return 2; + default: return -1; + } +} +assertEq(f(), 2); + +function g() { + switch(3.14) { + case 3: return 3; + case 4: return 4; + default: return -1; + } +} +assertEq(g(), -1); + diff --git a/js/src/jit-test/tests/jaeger/tableSwitchNeg.js b/js/src/jit-test/tests/jaeger/tableSwitchNeg.js new file mode 100644 index 0000000000..ae370262e1 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/tableSwitchNeg.js @@ -0,0 +1,27 @@ + +function f(a) { + switch(a) { + case -1: return 1; + case -2: return 2; + case -5: return 5; + default: return 10; + } +} + +assertEq(f(-1), 1); +assertEq(f(-2), 2); +assertEq(f(-5), 5); + +assertEq(f(-3), 10); +assertEq(f(-6), 10); +assertEq(f(0), 10); +assertEq(f(1), 10); + +assertEq(f(-2147483647), 10); +assertEq(f(-2147483648), 10); +assertEq(f(-2147483649), 10); + +assertEq(f(2147483647), 10); +assertEq(f(2147483648), 10); +assertEq(f(2147483649), 10); + diff --git a/js/src/jit-test/tests/jaeger/testAddStringObject.js b/js/src/jit-test/tests/jaeger/testAddStringObject.js new file mode 100644 index 0000000000..0ed0288e6c --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testAddStringObject.js @@ -0,0 +1,17 @@ +String.prototype.m = function(s) {
+ return this.indexOf('a');
+};
+
+var g = function(s) {
+ return (s + 'asdf').m();
+};
+
+var h = function(s) {
+ return ('asdf' + s).m();
+};
+
+var ix = g(new String('abc'));
+assertEq(ix, 0);
+
+var ix = h(new String('abc'));
+assertEq(ix, 0);
diff --git a/js/src/jit-test/tests/jaeger/testCallElemAfterGC.js b/js/src/jit-test/tests/jaeger/testCallElemAfterGC.js new file mode 100644 index 0000000000..369aa2c6fb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testCallElemAfterGC.js @@ -0,0 +1,20 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function A() { + this.x = 12; + this.y = function () { return this.x; }; + this[1] = function () { return this.x; }; +} + +function f(obj, key){ + assertEq(obj[key](), 12); +} + +a = new A(); +f(a, "y"); +f(a, "y"); +f(a, 1); +gc(); +f(a, "y"); +f(a, "y"); + diff --git a/js/src/jit-test/tests/jaeger/testDenseCallElem.js b/js/src/jit-test/tests/jaeger/testDenseCallElem.js new file mode 100644 index 0000000000..0301048bf3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testDenseCallElem.js @@ -0,0 +1,89 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function fillDense(a) { +} + +function testDenseUKeyUArray(a, key) { + a.push(function () { return this[3]; }); + a.push(function () { return this[4]; }); + a.push(function() { return this[5]; }); + a.push(20); + a.push("hi"); + a.push(500); + assertEq(a[key](), 20); + assertEq(a[key + 1](), "hi"); + assertEq(a[key + 2](), 500); +} + +function testDenseVKeyUArray(a) { + a.push(function () { return this[3]; }); + a.push(function () { return this[4]; }); + a.push(function() { return this[5]; }); + a.push(20); + a.push("hi"); + a.push(500); + var key = a.length & 1; + assertEq(a[key](), 20); + assertEq(a[(key + 1) & 3](), "hi"); + assertEq(a[(key + 2) & 3](), 500); +} + +function testDenseKKeyUArray(a, key) { + a.push(function () { return this[3]; }); + a.push(function () { return this[4]; }); + a.push(function() { return this[5]; }); + a.push(20); + a.push("hi"); + a.push(500); + assertEq(a[0](), 20); + assertEq(a[1](), "hi"); + assertEq(a[2](), 500); +} + +function testDenseUKeyVArray(key) { + var a = [function () { return this[3]; }, + function () { return this[4]; }, + function() { return this[5]; }, + 20, + "hi", + 500]; + assertEq(a[key](), 20); + assertEq(a[key + 1](), "hi"); + assertEq(a[key + 2](), 500); +} + +function testDenseVKeyVArray() { + var a = [function () { return this[3]; }, + function () { return this[4]; }, + function() { return this[5]; }, + 20, + "hi", + 500]; + var key = a.length & 1; + assertEq(a[key](), 20); + assertEq(a[(key + 1) & 3](), "hi"); + assertEq(a[(key + 2) & 3](), 500); +} + +function testDenseKKeyVArray() { + var a = [function () { return this[3]; }, + function () { return this[4]; }, + function() { return this[5]; }, + 20, + "hi", + 500]; + assertEq(a[0](), 20); + assertEq(a[1](), "hi"); + assertEq(a[2](), 500); +} + +for (var i = 0; i < 5; i++) { + testDenseUKeyUArray([], 0); + testDenseVKeyUArray([]); + testDenseKKeyUArray([]); + testDenseUKeyVArray(0); + testDenseVKeyVArray(); + testDenseKKeyVArray(); +} + + diff --git a/js/src/jit-test/tests/jaeger/testForOps.js b/js/src/jit-test/tests/jaeger/testForOps.js new file mode 100644 index 0000000000..773aae2495 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testForOps.js @@ -0,0 +1,67 @@ +// |jit-test| +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function assertObjectsEqual(obj1, obj2) { + assertEq(obj1.a, obj2.a); + assertEq(obj1.b, obj2.b); + assertEq(obj1.c, obj2.c); + assertEq(obj1.d, obj2.d); + assertEq(obj2.a, 1); + assertEq(obj2.b, "bee"); + assertEq(obj2.c, "crab"); + assertEq(obj2.d, 12); +} + +function forName(obj) { + eval(''); + var r = { }; + for (x in obj) + r[x] = obj[x]; + return r; +} + +function forGlobalName(obj) { + var r = { }; + for (x in obj) + r[x] = obj[x]; + return r; +} + +function forProp(obj) { + var r = { }; + var c = { }; + for (c.x in obj) + r[c.x] = obj[c.x]; + return r; +} + +function forElem(obj, x) { + var r = { }; + var c = { }; + for (c[x] in obj) + r[c[x]] = obj[c[x]]; + return r; +} + +function forLocal(obj) { + var r = { }; + for (var x in obj) + r[x] = obj[x]; + return r; +} + +function forArg(obj, x) { + var r = { }; + for (x in obj) + r[x] = obj[x]; + return r; +} + +var obj = { a: 1, b: "bee", c: "crab", d: 12 }; +assertObjectsEqual(obj, forName(obj)); +assertObjectsEqual(obj, forGlobalName(obj)); +assertObjectsEqual(obj, forProp(obj)); +assertObjectsEqual(obj, forElem(obj, "v")); +assertObjectsEqual(obj, forLocal(obj)); +assertObjectsEqual(obj, forArg(obj)); + diff --git a/js/src/jit-test/tests/jaeger/testIfEqX.js b/js/src/jit-test/tests/jaeger/testIfEqX.js new file mode 100644 index 0000000000..6940619e6f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testIfEqX.js @@ -0,0 +1,37 @@ +// Tests for IFEQX and GOTOX ops. +function testIfElse() { + var src = + "var a = 0;\n" + + "if (x) {\n"; + for (var i=0; i<7000; i++) { + src += "a = 1;"; + } + src += "} else {\n"; + for (var i=0; i<7000; i++) { + src += "a = 2;"; + } + src += "}\n"; + src += "return a;"; + + var f = new Function("x", src); + assertEq(f(true), 1); + assertEq(f(false), 2); + assertEq(f([1, 2, 3]), 1); + assertEq(f(), 2); +} +testIfElse(); + +function testWhile() { + var src = + "var i = 0, j = 0;\n" + + "while (i++ < 50) {\n"; + for (var i=0; i<5000; i++) { + src += "j = i;"; + } + src += "}\n"; + src += "return j;"; + + var f = new Function(src); + assertEq(f(), 50); +} +testWhile(); diff --git a/js/src/jit-test/tests/jaeger/testPropCallElem.js b/js/src/jit-test/tests/jaeger/testPropCallElem.js new file mode 100644 index 0000000000..2bb97fbe64 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testPropCallElem.js @@ -0,0 +1,93 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function testUKeyUObject(a, key1, key2, key3) { + a.a = function () { return this.d; } + a.b = function () { return this.e; } + a.c = function() { return this.f; } + a.d = 20; + a.e = "hi"; + a.f = 500; + assertEq(a[key1](), 20); + assertEq(a[key2](), "hi"); + assertEq(a[key3](), 500); +} + +function testVKeyUObject(a, key1, key2, key3) { + a.a = function () { return this.d; } + a.b = function () { return this.e; } + a.c = function() { return this.f; } + a.d = 20; + a.e = "hi"; + a.f = 500; + assertEq(a["" + key1](), 20); + assertEq(a["" + key2](), "hi"); + assertEq(a["" + key3](), 500); +} + +function testKKeyUObject(a) { + a.a = function () { return this.d; } + a.b = function () { return this.e; } + a.c = function() { return this.f; } + a.d = 20; + a.e = "hi"; + a.f = 500; + var key1 = "a"; + var key2 = "b"; + var key3 = "c"; + assertEq(a[key1](), 20); + assertEq(a[key2](), "hi"); + assertEq(a[key3](), 500); +} + +function testUKeyVObject(key1, key2, key3) { + a = { a: function () { return this.d; }, + b: function () { return this.e; }, + c: function () { return this.f; }, + d: 20, + e: "hi", + f: 500 + }; + assertEq(a[key1](), 20); + assertEq(a[key2](), "hi"); + assertEq(a[key3](), 500); +} + +function testVKeyVObject(key1, key2, key3) { + a = { a: function () { return this.d; }, + b: function () { return this.e; }, + c: function () { return this.f; }, + d: 20, + e: "hi", + f: 500 + }; + assertEq(a["" + key1](), 20); + assertEq(a["" + key2](), "hi"); + assertEq(a["" + key3](), 500); +} + +function testKKeyVObject(a) { + a = { a: function () { return this.d; }, + b: function () { return this.e; }, + c: function () { return this.f; }, + d: 20, + e: "hi", + f: 500 + }; + var key1 = "a"; + var key2 = "b"; + var key3 = "c"; + assertEq(a[key1](), 20); + assertEq(a[key2](), "hi"); + assertEq(a[key3](), 500); +} + +for (var i = 0; i < 5; i++) { + testUKeyUObject({}, "a", "b", "c"); + testVKeyUObject({}, "a", "b", "c"); + testKKeyUObject({}); + testUKeyVObject("a", "b", "c"); + testVKeyVObject("a", "b", "c"); + testKKeyVObject(); +} + + diff --git a/js/src/jit-test/tests/jaeger/testPropCallElem2.js b/js/src/jit-test/tests/jaeger/testPropCallElem2.js new file mode 100644 index 0000000000..43f8efb0fb --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testPropCallElem2.js @@ -0,0 +1,20 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function testUKeyUObject(a, key1, key2, key3) { + a.a = function () { return this.d; } + a.b = function () { return this.e; } + a.c = function() { return this.f; } + a.d = 20; + a.e = "hi"; + a.f = 500; + delete a["b"]; + Object.defineProperty(a, "b", { get: function () { return function () { return this.e; } } }); + assertEq(a[key1](), 20); + assertEq(a[key2](), "hi"); + assertEq(a[key3](), 500); +} + +for (var i = 0; i < 5; i++) + testUKeyUObject({}, "a", "b", "c"); + + diff --git a/js/src/jit-test/tests/jaeger/testSetElem-Easy.js b/js/src/jit-test/tests/jaeger/testSetElem-Easy.js new file mode 100644 index 0000000000..ed8fc7c9a9 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testSetElem-Easy.js @@ -0,0 +1,41 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function testBadSetElems(obj, key) { + obj[key] = 5; + obj[-1] = 5; + var L = obj; + L[L] = L; + obj = []; + obj.K = 5; + obj[2] = 5; + var T = "a"; + obj[T] = 12; + obj = []; + obj[Object] = key; +} + +function testDenseSets(L) { + var obj = [,,,,,,,,,,]; + obj[2] = 2; + assertEq(obj[2], 2); + var T = L; + assertEq(obj[T], 2); + assertEq(obj.length, 10); + obj[10] = T; + assertEq(obj[10], T); + assertEq(obj.length, 11); + var K = T + 9; + obj[K] = K; + assertEq(obj[K], K); + assertEq(obj.length, 12); + obj[K + 1] = obj; + assertEq(obj[K + 1], obj); + assertEq(obj.length, 13); +} + +for (var i = 0; i < 10; i++) { + testBadSetElems([], -1); + testDenseSets(2); +} + + diff --git a/js/src/jit-test/tests/jaeger/testSetElem-Indexed.js b/js/src/jit-test/tests/jaeger/testSetElem-Indexed.js new file mode 100644 index 0000000000..01b42bd6b3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testSetElem-Indexed.js @@ -0,0 +1,36 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function f() { + return [[], [], [], []]; +} + +function setelem(obj, key, val) { + obj[key] = val; +} + +// Generate IC +setelem([], 0, "hi"); +setelem([], 0, "hi"); + +// Get some arrays pre-indexing. +var arrays = f(); + +// Do bad stuff. +Object.defineProperty(Object.prototype, "1", { set: function (v) { this.kettle = v; } }); + +var k = arrays[0]; +setelem(k, 1, 13); +assertEq(k.kettle, 13); +assertEq(k.hasOwnProperty("1"), false); + +Object.defineProperty(Array.prototype, "2", { set: function (v) { this.pot = v; } }); +k = arrays[1]; +setelem(k, 2, "yam"); +assertEq(k.pot, "yam"); + +gc(); + +// make sure this reset okay. +setelem([], 0, "hi"); +setelem([], 0, "hi"); + diff --git a/js/src/jit-test/tests/jaeger/testSetElem-NewProto.js b/js/src/jit-test/tests/jaeger/testSetElem-NewProto.js new file mode 100644 index 0000000000..f202513d53 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testSetElem-NewProto.js @@ -0,0 +1,24 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function f() { + return [[], [], [], []]; +} + +function setelem(obj, key, val) { + obj[key] = val; +} + +// Generate IC +setelem([], 0, "hi"); +setelem([], 0, "hi"); + +var arrays = f(); + +var evil = { }; +Object.defineProperty(evil, "1", { set: function (v) { this.ham = v; } }); +Array.prototype.__proto__ = evil; + +var k = arrays[0]; +setelem(k, 1, "yam"); +assertEq(k.ham, "yam"); + diff --git a/js/src/jit-test/tests/jaeger/testSetTypedFloatArray.js b/js/src/jit-test/tests/jaeger/testSetTypedFloatArray.js new file mode 100644 index 0000000000..33e38dd3fc --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testSetTypedFloatArray.js @@ -0,0 +1,61 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function testSetTypedFloat32Array(k) { + var ar = new Float32Array(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = (k + 800) * 897 * 800 * 800 * 810 * 1923437; + var t = k + 555; + var L = ar[k+7] = t & 5; + ar[0] = 12.3; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = 500; + ar[k+2] = "3" + k; + ar[k+3] = true; + assertEq(ar[0] - 12.3 >= 0 && + ar[0] - 12.3 <= 0.0001, true); + assertEq(ar[1], 500); + assertEq(ar[2], 30); + assertEq(ar[3], 1); + assertEq(ar[4], 715525927453369300000); + assertEq(ar[5], NaN); + assertEq(ar[6], NaN); + assertEq(ar[7], 1); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +function testSetTypedFloat64Array(k) { + var ar = new Float64Array(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = (k + 800) * 897 * 800 * 800 * 810 * 1923437; + var t = k + 555; + var L = ar[k+7] = t & 5; + ar[0] = 12.3; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = 500; + ar[k+2] = "3" + k; + ar[k+3] = true; + assertEq(ar[0] - 12.3 >= 0 && + ar[0] - 12.3 <= 0.0001, true); + assertEq(ar[1], 500); + assertEq(ar[2], 30); + assertEq(ar[3], 1); + assertEq(ar[4], 715525949998080000000); + assertEq(ar[5], NaN); + assertEq(ar[6], NaN); + assertEq(ar[7], 1); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +for (var i = 0; i <= 10; i++) { + testSetTypedFloat32Array(0); + testSetTypedFloat64Array(0); + if (i == 5) + gc(); +} + diff --git a/js/src/jit-test/tests/jaeger/testSetTypedIntArray.js b/js/src/jit-test/tests/jaeger/testSetTypedIntArray.js new file mode 100644 index 0000000000..89e943b698 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testSetTypedIntArray.js @@ -0,0 +1,190 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function testSetTypedInt8Array(k) { + var ar = new Int8Array(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = k + 800; + var t = k + 555; + var t = ar[k+7] = t & 5; + ar[0] = 12; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = 500; + ar[k+2] = "3"; + ar[k+3] = true; + assertEq(ar[0], 12); + assertEq(ar[1], -12); + assertEq(ar[2], 3); + assertEq(ar[3], 1); + assertEq(ar[4], 32); + assertEq(ar[5], 0); + assertEq(ar[6], 0); + assertEq(ar[7], 1); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +function testSetTypedUint8ClampedArray(k) { + var ar = new Uint8ClampedArray(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = k + 800; + var t = k + 555; + var L = ar[k+7] = t & 5; + var Q = ar[k+7] = t + 5; + ar[0] = 12; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = -500; + ar[k+2] = "3"; + ar[k+3] = true; + assertEq(ar[0], 12); + assertEq(ar[1], 0); + assertEq(ar[2], 3); + assertEq(ar[3], 1); + assertEq(ar[4], 255); + assertEq(ar[5], 0); + assertEq(ar[6], 0); + assertEq(ar[7], 255); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +function testSetTypedUint8Array(k) { + var ar = new Uint8Array(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = k + 800; + var t = k + 555; + var L = ar[k+7] = t + 5; + ar[0] = 12.3; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = 500; + ar[k+2] = "3"; + ar[k+3] = true; + assertEq(ar[0], 12); + assertEq(ar[1], 244); + assertEq(ar[2], 3); + assertEq(ar[3], 1); + assertEq(ar[4], 32); + assertEq(ar[5], 0); + assertEq(ar[6], 0); + assertEq(ar[7], 48); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +function testSetTypedInt16Array(k) { + var ar = new Int16Array(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = (k + 800) * 800 * 800 * 913; + var t = k + 555; + var L = ar[k+7] = t + 5; + ar[0] = 12.3; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = 500000; + ar[k+2] = "3"; + ar[k+3] = true; + assertEq(ar[0], 12); + assertEq(ar[1], -24288); + assertEq(ar[2], 3); + assertEq(ar[3], 1); + assertEq(ar[4], -32768); + assertEq(ar[5], 0); + assertEq(ar[6], 0); + assertEq(ar[7], 560); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +function testSetTypedUint16Array(k) { + var ar = new Uint16Array(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = (k + 800) * 800 * 800 * 913; + var t = k + 555; + var L = ar[k+7] = t + 5; + ar[0] = 12.3; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = 500000; + ar[k+2] = "3"; + ar[k+3] = true; + assertEq(ar[0], 12); + assertEq(ar[1], 41248); + assertEq(ar[2], 3); + assertEq(ar[3], 1); + assertEq(ar[4], 32768); + assertEq(ar[5], 0); + assertEq(ar[6], 0); + assertEq(ar[7], 560); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +function testSetTypedInt32Array(k) { + var ar = new Int32Array(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = (k + 800) * 800 * 800 * 800 * 800; + var t = k + 555; + var L = ar[k+7] = t + 5; + ar[0] = 12.3; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = 500; + ar[k+2] = "3"; + ar[k+3] = true; + assertEq(ar[0], 12); + assertEq(ar[1], 500); + assertEq(ar[2], 3); + assertEq(ar[3], 1); + assertEq(ar[4], -234881024); + assertEq(ar[5], 0); + assertEq(ar[6], 0); + assertEq(ar[7], 560); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +function testSetTypedUint32Array(k) { + var ar = new Uint32Array(8); + ar[k+5] = { }; + ar[k+6] = ar; + ar[k+4] = (k + 800) * 800 * 800 * 800 * 800; + var t = k + 555; + var L = ar[k+7] = t + 5; + ar[0] = 12.3; + ar[8] = 500; + ar[k+8] = 1200; + ar[k+1] = 500; + ar[k+2] = "3"; + ar[k+3] = true; + assertEq(ar[0], 12); + assertEq(ar[1], 500); + assertEq(ar[2], 3); + assertEq(ar[3], 1); + assertEq(ar[4], 4060086272); + assertEq(ar[5], 0); + assertEq(ar[6], 0); + assertEq(ar[7], 560); + assertEq(ar[8], undefined); + assertEq(ar[k+8], undefined); +} + +for (var i = 0; i <= 10; i++) { + testSetTypedInt8Array(0); + testSetTypedUint8Array(0); + testSetTypedUint8ClampedArray(0); + testSetTypedInt16Array(0); + testSetTypedUint16Array(0); + testSetTypedInt32Array(0); + testSetTypedUint32Array(0); + if (i == 5) + gc(); +} + diff --git a/js/src/jit-test/tests/jaeger/testShiftSameBacking.js b/js/src/jit-test/tests/jaeger/testShiftSameBacking.js new file mode 100644 index 0000000000..1cbe064d3f --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testShiftSameBacking.js @@ -0,0 +1,12 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function f(a) { + var x = a; + var y = x; + + assertEq((x << y), (a << a)); + assertEq((y << x), (a << a)); +} + +f(2); + diff --git a/js/src/jit-test/tests/jaeger/testTableSwitchX.js b/js/src/jit-test/tests/jaeger/testTableSwitchX.js new file mode 100644 index 0000000000..c92d4c2758 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testTableSwitchX.js @@ -0,0 +1,25 @@ +// Tests for JSOP_TABLESWITCHX. +function test1() { + var src = + "var a = 0;\n" + + "switch(x) {\n"; + for (var i=-1; i<4; i++) { + src += (i >= 0) ? + "case " + i + ":\n" : + "default:\n"; + for (var j=0; j<1500; j++) { + src += "a = " + i + ";"; + } + src += "break;\n"; + } + src += "}\n"; + src += "return a;"; + + var f = new Function("x", src); + assertEq(f(0), 0); + assertEq(f(4), -1); + assertEq(f(), -1); + assertEq(f(1.1), -1); + assertEq(f(3), 3); +} +test1(); diff --git a/js/src/jit-test/tests/jaeger/undoAdd.js b/js/src/jit-test/tests/jaeger/undoAdd.js new file mode 100644 index 0000000000..007a29c973 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/undoAdd.js @@ -0,0 +1,25 @@ + +/* Test undoing addition in overflow paths when under heavy register pressure. */ + +function add1(x, y, a, b, res) { var nres = res + 0; var z = (x + a) + (y + b); assertEq(z, nres); } +function add2(x, y, a, b, res) { var nres = res + 0; var z = (x + a) + (y + b); assertEq(z, nres); } +function add3(x, y, a, b, res) { var nres = res + 0; var z = (x + a) + (y + b); assertEq(z, nres); } +add1(0x7ffffff0, 100, 0, 0, 2147483732); +add2(-1000, -0x80000000, 0, 0, -2147484648); +add3(-0x80000000, -1000, 0, 0, -2147484648); + +function cadd1(x, a, b, res) { + var nres = res + 0; + var nb = b + 0; + var z = (x + a) + 1000; + assertEq(z, nres + nb); +} +cadd1(0x7ffffff0, 0, 0, 2147484632); + +function cadd2(x, a, b, res) { + var nres = res + 0; + var nb = b + 0; + var z = (x + a) + (-0x80000000); + assertEq(z, nres + nb); +} +cadd2(-1000, 0, 0, -2147484648); diff --git a/js/src/jit-test/tests/jaeger/unsignedShiftZero.js b/js/src/jit-test/tests/jaeger/unsignedShiftZero.js new file mode 100644 index 0000000000..e199677d05 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/unsignedShiftZero.js @@ -0,0 +1,8 @@ + +function f(a) { + return a >>> 0; +}; + +assertEq(f(-2147483647), 2147483649); +assertEq(f(-2147483648), 2147483648); +assertEq(f(-2147483649), 2147483647); diff --git a/js/src/jit-test/tests/jaeger/xor-sanity.js b/js/src/jit-test/tests/jaeger/xor-sanity.js new file mode 100644 index 0000000000..4f41e0fcec --- /dev/null +++ b/js/src/jit-test/tests/jaeger/xor-sanity.js @@ -0,0 +1 @@ +assertEq(-2^31, -31); |