diff options
Diffstat (limited to 'js/src/jit-test/tests')
20 files changed, 122 insertions, 36 deletions
diff --git a/js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js b/js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js new file mode 100644 index 000000000..a4d0bf654 --- /dev/null +++ b/js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js @@ -0,0 +1,15 @@ +// |jit-test| error:ReferenceError + +// for-of should close iterator even if the exception is once caught by the +// debugger. + +var g = newGlobal(); +g.parent = this; +g.eval("new Debugger(parent).onExceptionUnwind = function () { };"); +// jsfunfuzz-generated +for (var x of []) {}; +for (var l of [0]) { + for (var y = 0; y < 1; y++) { + g2; + } +} diff --git a/js/src/jit-test/tests/basic/constructor-name.js b/js/src/jit-test/tests/basic/constructor-name.js index 4bc6a61ea..2dd4c073f 100644 --- a/js/src/jit-test/tests/basic/constructor-name.js +++ b/js/src/jit-test/tests/basic/constructor-name.js @@ -17,7 +17,7 @@ function makeObject() { let tests = [ { name: "Ctor", object: new Ctor }, { name: "nested.Ctor", object: new nested.Ctor }, - { name: "makeInstance/LexicalCtor", object: makeInstance() }, + { name: "LexicalCtor", object: makeInstance() }, { name: null, object: {} }, { name: null, object: nested.object }, { name: null, object: makeObject() }, diff --git a/js/src/jit-test/tests/basic/destructuring-default.js b/js/src/jit-test/tests/basic/destructuring-default.js index 168977e80..49a908b8a 100644 --- a/js/src/jit-test/tests/basic/destructuring-default.js +++ b/js/src/jit-test/tests/basic/destructuring-default.js @@ -84,10 +84,7 @@ function testArgumentFunction(pattern, input) { 'return [a, b, c, d, e, f];' )(input); } -// XXX: ES6 requires the `Function` constructor to accept arbitrary -// `BindingElement`s as formal parameters. See Bug 1037939. -// Once fixed, please update the assertions below. -assertThrowsInstanceOf(() => testAll(testArgumentFunction), SyntaxError); +testAll(testArgumentFunction); function testThrow(pattern, input) { return new Function('input', diff --git a/js/src/jit-test/tests/basic/destructuring-rest.js b/js/src/jit-test/tests/basic/destructuring-rest.js index f53f07e03..fcb7b79bb 100644 --- a/js/src/jit-test/tests/basic/destructuring-rest.js +++ b/js/src/jit-test/tests/basic/destructuring-rest.js @@ -132,10 +132,9 @@ function testArgumentFunction(pattern, input, binding) { 'return ' + binding )(input); } -// XXX: ES6 requires the `Function` constructor to accept arbitrary -// `BindingElement`s as formal parameters. See Bug 1037939. -// Once fixed, please update the assertions below. -assertThrowsInstanceOf(() => testDeclaration(testArgumentFunction), SyntaxError); +// ES6 requires the `Function` constructor to accept arbitrary +// `BindingElement`s as formal parameters. +testDeclaration(testArgumentFunction); function testThrow(pattern, input, binding) { binding = binding || 'rest'; diff --git a/js/src/jit-test/tests/basic/functionnames.js b/js/src/jit-test/tests/basic/functionnames.js index 935292ee3..7fef872fc 100644 --- a/js/src/jit-test/tests/basic/functionnames.js +++ b/js/src/jit-test/tests/basic/functionnames.js @@ -40,7 +40,7 @@ assertName(Foo, 'Foo</<'); /* various properties and such */ var x = {fox: { bax: function(){} } }; -assertName(x.fox.bax, 'x.fox.bax'); +assertName(x.fox.bax, 'bax'); var foo = {foo: {foo: {}}}; foo.foo.foo = function(){}; assertName(foo.foo.foo, 'foo.foo.foo'); @@ -48,20 +48,20 @@ var z = { foz: function() { var baz = function() { var y = {bay: function() {}}; - assertName(y.bay, 'z.foz/baz/y.bay'); + assertName(y.bay, 'bay'); }; - assertName(baz, 'z.foz/baz'); + assertName(baz, 'baz'); baz(); } }; -assertName(z.foz, 'z.foz'); +assertName(z.foz, 'foz'); z.foz(); var outer = function() { x.fox.bax.nx = function(){}; var w = {fow: { baw: function(){} } }; assertName(x.fox.bax.nx, 'outer/x.fox.bax.nx') - assertName(w.fow.baw, 'outer/w.fow.baw'); + assertName(w.fow.baw, 'baw'); }; assertName(outer, 'outer'); outer(); @@ -69,7 +69,7 @@ function Fuz(){}; Fuz.prototype = { add: function() {} } -assertName(Fuz.prototype.add, 'Fuz.prototype.add'); +assertName(Fuz.prototype.add, 'add'); var x = 1; x = function(){}; @@ -94,7 +94,7 @@ a.b = function() { assertName(arguments.callee, 'a.b<'); return { a: function() {} } }(); -assertName(a.b.a, 'a.b</<.a'); +assertName(a.b.a, 'a'); a = { b: function(a) { @@ -104,9 +104,9 @@ a = { return function() {}; } }; -assertName(a.b, 'a.b'); -assertName(a.b(true), 'a.b/<') -assertName(a.b(false), 'a.b/<') +assertName(a.b, 'b'); +assertName(a.b(true), 'b/<') +assertName(a.b(false), 'b/<') function f(g) { assertName(g, 'x<'); @@ -116,7 +116,7 @@ var x = f(function () { return function() {}; }); assertName(x, 'x</<'); var a = {'b': function(){}}; -assertName(a.b, 'a.b'); +assertName(a.b, 'b'); function g(f) { assertName(f, ''); @@ -138,15 +138,15 @@ a = { "\"\'quotes\'\"": function(){}, "!@#$%": function(){} }; -assertName(a["embedded spaces"], 'a["embedded spaces"]'); -assertName(a["dots.look.like.property.references"], 'a["dots.look.like.property.references"]'); -assertName(a["\"\'quotes\'\""], 'a["\\\"\'quotes\'\\\""]'); -assertName(a["!@#$%"], 'a["!@#$%"]'); +assertName(a["embedded spaces"], 'embedded spaces'); +assertName(a["dots.look.like.property.references"], 'dots.look.like.property.references'); +assertName(a["\"\'quotes\'\""], '"\'quotes\'"'); +assertName(a["!@#$%"], '!@#$%'); a.b = {}; a.b.c = {}; a.b["c"]["d e"] = { f: { 1: { "g": { "h i": function() {} } } } }; -assertName(a.b.c["d e"].f[1].g["h i"], 'a.b.c["d e"].f[1].g["h i"]'); +assertName(a.b.c["d e"].f[1].g["h i"], 'h i'); this.m = function () {}; assertName(m, "this.m"); diff --git a/js/src/jit-test/tests/basic/regexpLastIndexReset.js b/js/src/jit-test/tests/basic/regexpLastIndexReset.js index 2a54d8ef5..dbe3c3b76 100644 --- a/js/src/jit-test/tests/basic/regexpLastIndexReset.js +++ b/js/src/jit-test/tests/basic/regexpLastIndexReset.js @@ -7,7 +7,7 @@ function test() { pattern.lastIndex = 3; var result = pattern.exec(string); assertEq(result, null); - assertEq(pattern.lastIndex, 0); + assertEq(pattern.lastIndex, 3); } for (let i = 0; i < 10; i++) { @@ -18,7 +18,7 @@ function test2() { pattern.lastIndex = 3; var result = pattern.test(string); assertEq(result, false); - assertEq(pattern.lastIndex, 0); + assertEq(pattern.lastIndex, 3); } for (let i = 0; i < 10; i++) { diff --git a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js index b147d6ded..5c73a1ad3 100644 --- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js +++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js @@ -24,7 +24,7 @@ root.eval( this.tests = [ { name: "Ctor", fn: () => new Ctor }, { name: "nested.Ctor", fn: () => new nested.Ctor }, - { name: "makeInstance/LexicalCtor", fn: () => makeInstance() }, + { name: "LexicalCtor", fn: () => makeInstance() }, { name: null, fn: () => ({}) }, { name: null, fn: () => (nested.object = {}) }, { name: null, fn: () => makeObject() }, diff --git a/js/src/jit-test/tests/debug/Script-gc-02.js b/js/src/jit-test/tests/debug/Script-gc-02.js index 33d33dfc1..04dd4b220 100644 --- a/js/src/jit-test/tests/debug/Script-gc-02.js +++ b/js/src/jit-test/tests/debug/Script-gc-02.js @@ -10,5 +10,5 @@ assertEq(arr.length, 10); gc(); for (var i = 0; i < arr.length; i++) - assertEq(arr[i].lineCount, 1); + assertEq(arr[i].lineCount, 3); diff --git a/js/src/jit-test/tests/debug/Script-gc-03.js b/js/src/jit-test/tests/debug/Script-gc-03.js index b2cb70232..30c3e8dbc 100644 --- a/js/src/jit-test/tests/debug/Script-gc-03.js +++ b/js/src/jit-test/tests/debug/Script-gc-03.js @@ -10,6 +10,6 @@ assertEq(arr.length, 100); gc(g); for (var i = 0; i < arr.length; i++) - assertEq(arr[i].lineCount, 1); + assertEq(arr[i].lineCount, 3); gc(); diff --git a/js/src/jit-test/tests/debug/Script-sourceStart-04.js b/js/src/jit-test/tests/debug/Script-sourceStart-04.js index c12e669bf..2aa382b7b 100644 --- a/js/src/jit-test/tests/debug/Script-sourceStart-04.js +++ b/js/src/jit-test/tests/debug/Script-sourceStart-04.js @@ -20,6 +20,6 @@ function test(string, range) { } test("eval('2 * 3')", [0, 5]); -test("new Function('2 * 3')", [0, 5]); -test("new Function('x', 'x * x')", [0, 5]); +test("new Function('2 * 3')", [0, 12]); +test("new Function('x', 'x * x')", [0, 13]); assertEq(count, 6); diff --git a/js/src/jit-test/tests/for-of/bug-1331444.js b/js/src/jit-test/tests/for-of/bug-1331444.js new file mode 100644 index 000000000..9770c584b --- /dev/null +++ b/js/src/jit-test/tests/for-of/bug-1331444.js @@ -0,0 +1,7 @@ +// |jit-test| error: ReferenceError + +symbols = [Symbol]; +for (comparator of[, ]) + for (a of symbols) + for (;;) + expect; diff --git a/js/src/jit-test/tests/for-of/bug-1341339.js b/js/src/jit-test/tests/for-of/bug-1341339.js new file mode 100644 index 000000000..1f88acdaf --- /dev/null +++ b/js/src/jit-test/tests/for-of/bug-1341339.js @@ -0,0 +1,9 @@ +let m = parseModule(` +function* values() {} +var iterator = values(); +for (var i=0; i < 10000; ++i) { + for (var x of iterator) {} +} +`); +m.declarationInstantiation(); +m.evaluation(); diff --git a/js/src/jit-test/tests/gc/bug-1323868.js b/js/src/jit-test/tests/gc/bug-1323868.js new file mode 100644 index 000000000..c7e8c9b08 --- /dev/null +++ b/js/src/jit-test/tests/gc/bug-1323868.js @@ -0,0 +1,5 @@ +if (helperThreadCount() == 0) + quit(); +startgc(8301); +offThreadCompileScript("(({a,b,c}))"); +gcparam("maxBytes", gcparam("gcBytes")); diff --git a/js/src/jit-test/tests/ion/bug1333946.js b/js/src/jit-test/tests/ion/bug1333946.js new file mode 100644 index 000000000..1fa1b9c49 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug1333946.js @@ -0,0 +1,8 @@ +// |jit-test| error: 42; + +for (var x of [0]) { + for (var i = 0; ; i++) { + if (i === 20000) + throw 42; + } +} diff --git a/js/src/jit-test/tests/ion/bug1334314.js b/js/src/jit-test/tests/ion/bug1334314.js new file mode 100644 index 000000000..488fc9027 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug1334314.js @@ -0,0 +1,16 @@ +// |jit-test| error: TypeError + +var g = newGlobal(); +g.parent = this; +g.eval("new Debugger(parent).onExceptionUnwind = function () { };"); + +function f() { + [[]] = []; +} +try { + f(); +} catch (e) {}; +try { + f(); +} catch (e) {}; +f(); diff --git a/js/src/jit-test/tests/parser/bug-1357075.js b/js/src/jit-test/tests/parser/bug-1357075.js new file mode 100644 index 000000000..47482e372 --- /dev/null +++ b/js/src/jit-test/tests/parser/bug-1357075.js @@ -0,0 +1,10 @@ +// |jit-test| error: TypeError + +var iterable = {}; +var iterator = { + return: 1 +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; +for ([ class get {} ().iterator ] of [iterable]) {} diff --git a/js/src/jit-test/tests/proxy/testWrapWithProtoIter.js b/js/src/jit-test/tests/proxy/testWrapWithProtoIter.js new file mode 100644 index 000000000..c6854b206 --- /dev/null +++ b/js/src/jit-test/tests/proxy/testWrapWithProtoIter.js @@ -0,0 +1 @@ +[...wrapWithProto(new Int8Array(), new Int8Array())] diff --git a/js/src/jit-test/tests/proxy/testWrapWithProtoTypedArray.js b/js/src/jit-test/tests/proxy/testWrapWithProtoTypedArray.js new file mode 100644 index 000000000..1b805d30a --- /dev/null +++ b/js/src/jit-test/tests/proxy/testWrapWithProtoTypedArray.js @@ -0,0 +1,19 @@ +let a = wrapWithProto(new Int8Array([1, 3, 5, 6, 9]), new Int8Array()); + +assertEq([...a].toString(), "1,3,5,6,9"); +assertEq(a.every(e => e < 100), true); +assertEq(a.filter(e => e % 2 == 1).toString(), "1,3,5,9"); +assertEq(a.find(e => e > 3), 5); +assertEq(a.findIndex(e => e % 2 == 0), 3); +assertEq(a.map(e => e * 10).toString(), "10,30,50,60,90"); +assertEq(a.reduce((a, b) => a + b, ""), "13569"); +assertEq(a.reduceRight((acc, e) => "(" + e + acc + ")", ""), "(1(3(5(6(9)))))"); +assertEq(a.some(e => e % 2 == 0), true); + +let s = ""; +assertEq(a.forEach(e => s += e), undefined); +assertEq(s, "13569"); + +a.sort((a, b) => b - a); +assertEq(a.toString(), "9,6,5,3,1"); + diff --git a/js/src/jit-test/tests/saved-stacks/function-display-name.js b/js/src/jit-test/tests/saved-stacks/function-display-name.js index cfe175758..f10b7de6b 100644 --- a/js/src/jit-test/tests/saved-stacks/function-display-name.js +++ b/js/src/jit-test/tests/saved-stacks/function-display-name.js @@ -2,9 +2,8 @@ function uno() { return dos(); } const dos = () => tres.quattro(); -const tres = { - quattro: () => saveStack() -}; +let tres = {}; +tres.quattro = () => saveStack() const frame = uno(); diff --git a/js/src/jit-test/tests/self-test/assertDeepEq.js b/js/src/jit-test/tests/self-test/assertDeepEq.js index b2a949abc..9c1b37e8e 100644 --- a/js/src/jit-test/tests/self-test/assertDeepEq.js +++ b/js/src/jit-test/tests/self-test/assertDeepEq.js @@ -77,7 +77,8 @@ assertDeepEq(q, p); assertNotDeepEq(() => 1, () => 2); assertNotDeepEq((...x) => 1, x => 1); assertNotDeepEq(function f(){}, function g(){}); -var f1 = function () {}, f2 = function () {}; +// Avoid setting name property. +var [f1, f2] = [function () {}, function () {}]; assertDeepEq(f1, f1); assertDeepEq(f1, f2); // same text, close enough f1.prop = 1; |