diff options
Diffstat (limited to 'js/src/tests/js1_8/extensions')
36 files changed, 1581 insertions, 0 deletions
diff --git a/js/src/tests/js1_8/extensions/browser.js b/js/src/tests/js1_8/extensions/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_8/extensions/browser.js diff --git a/js/src/tests/js1_8/extensions/dekker.js b/js/src/tests/js1_8/extensions/dekker.js new file mode 100644 index 000000000..26d93d4fe --- /dev/null +++ b/js/src/tests/js1_8/extensions/dekker.js @@ -0,0 +1,68 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- + +var summary = "Dekker's algorithm for mutual exclusion"; +// Adapted from pseudocode in Wikipedia: +// http://en.wikipedia.org/wiki/Dekker%27s_algorithm + +printStatus (summary); + +var N = 500; // number of iterations + +// the mutex mechanism +var f = [false, false]; +var turn = 0; + +// resource being protected +var counter = 0; + +function worker(me) { + let him = 1 - me; + + for (let i = 0; i < N; i++) { + // enter the mutex + f[me] = true; + while (f[him]) { + if (turn != me) { + f[me] = false; + while (turn != me) + ; // busy wait + f[me] = true; + } + } + + // critical section + let x = counter; + sleep(0.003); + counter = x + 1; + + // leave the mutex + turn = him; + f[me] = false; + } + + return 'ok'; +} + +var expect; +var actual; + +if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { + print('Test skipped. scatter or sleep not defined.'); + expect = actual = 'Test skipped.'; +} else { + var results = scatter([function () { return worker(0); }, + function () { return worker(1); }]); + + expect = "Thread status: [ok,ok], counter: " + (2 * N); + actual = "Thread status: [" + results + "], counter: " + counter; +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/expclo.js b/js/src/tests/js1_8/extensions/expclo.js new file mode 100644 index 000000000..96b067ed6 --- /dev/null +++ b/js/src/tests/js1_8/extensions/expclo.js @@ -0,0 +1,23 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Brendan Eich + */ + +var summary = "Flat expression closure source coordinate fencepost test"; + +function f(a) { + if (a) { + let b = 42; + let c = function () a+b; + ++b; + return c; + } + return null; +} + +var expect = 44; +var actual = f(1)(); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/expclo2.js b/js/src/tests/js1_8/extensions/expclo2.js new file mode 100644 index 000000000..2c192d861 --- /dev/null +++ b/js/src/tests/js1_8/extensions/expclo2.js @@ -0,0 +1,23 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Brendan Eich + */ + +var summary = "Partial flat expression closure upvar order test"; + +function f(a) { + if (a) { + let b = 42; + let c = function () b+a; + ++b; + return c; + } + return null; +} + +var expect = 44; +var actual = f(1)(); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/lamport.js b/js/src/tests/js1_8/extensions/lamport.js new file mode 100644 index 000000000..d9e9d6636 --- /dev/null +++ b/js/src/tests/js1_8/extensions/lamport.js @@ -0,0 +1,93 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------- + +var summary = "Lamport Bakery's algorithm for mutual exclusion"; +// Adapted from pseudocode in Wikipedia: +// http://en.wikipedia.org/wiki/Lamport%27s_bakery_algorithm + +printStatus(summary); + +var N = 15; // Number of threads. +var LOOP_COUNT = 10; // Number of times each thread should loop + +function range(n) { + for (let i = 0; i < n; i++) + yield i; +} + +function max(a) { + let x = Number.NEGATIVE_INFINITY; + for each (let i in a) + if (i > x) + x = i; + return x; +} + +// the mutex mechanism +var entering = [false for (i in range(N))]; +var ticket = [0 for (i in range(N))]; + +// the object being protected +var counter = 0; + +function lock(i) +{ + entering[i] = true; + ticket[i] = 1 + max(ticket); + entering[i] = false; + + for (let j = 0; j < N; j++) { + // If thread j is in the middle of getting a ticket, wait for that to + // finish. + while (entering[j]) + ; + + // Wait until all threads with smaller ticket numbers or with the same + // ticket number, but with higher priority, finish their work. + while ((ticket[j] != 0) && ((ticket[j] < ticket[i]) || + ((ticket[j] == ticket[i]) && (i < j)))) + ; + } +} + +function unlock(i) { + ticket[i] = 0; +} + +function worker(i) { + for (let k = 0; k < LOOP_COUNT; k++) { + lock(i); + + // The critical section + let x = counter; + sleep(0.003); + counter = x + 1; + + unlock(i); + } + return 'ok'; +} + +function makeWorker(id) { + return function () { return worker(id); }; +} + +var expect; +var actual; + +if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { + print('Test skipped. scatter or sleep not defined.'); + expect = actual = 'Test skipped.'; +} else { + scatter([makeWorker(i) for (i in range(N))]); + + expect = "counter: " + (N * LOOP_COUNT); + actual = "counter: " + counter; +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/peterson.js b/js/src/tests/js1_8/extensions/peterson.js new file mode 100644 index 000000000..de8514967 --- /dev/null +++ b/js/src/tests/js1_8/extensions/peterson.js @@ -0,0 +1,57 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------- + +var summary = "Peterson's algorithm for mutual exclusion"; + +printStatus(summary); + +var N = 500; // number of iterations + +// the mutex mechanism +var f = [false, false]; +var turn = 0; + +// the resource being protected +var counter = 0; + +function worker(me) { + let him = 1 - me; + + for (let i = 0; i < N; i++) { + // enter the mutex + f[me] = true; + turn = him; + while (f[him] && turn == him) + ; // busy wait + + // critical section + let x = counter; + sleep(0.003); + counter = x+1; + + // leave the mutex + f[me] = false; + } + + return 'ok'; +} + +var expect; +var actual; + +if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { + print('Test skipped. scatter or sleep not defined.'); + expect = actual = 'Test skipped.'; +} else { + var results = scatter ([function() { return worker(0); }, + function() { return worker(1); }]); + expect = "Thread status: [ok,ok], counter: " + (2 * N); + actual = "Thread status: [" + results + "], counter: " + counter; +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-353116.js b/js/src/tests/js1_8/extensions/regress-353116.js new file mode 100644 index 000000000..d3a1349f8 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-353116.js @@ -0,0 +1,78 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 353116; +var summary = 'Improve errors messages for null, undefined properties'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'TypeError: undefined has no properties'; + actual = 'No Error'; + + try + { + undefined.y; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + expect = 'TypeError: null has no properties'; + actual = 'No Error'; + + try + { + null.y; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + expect = 'TypeError: x is undefined'; + actual = 'No Error'; + + try + { + x = undefined; + x.y; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + expect = 'TypeError: x is null'; + actual = 'No Error'; + + try + { + x = null; + x.y; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-385729.js b/js/src/tests/js1_8/extensions/regress-385729.js new file mode 100644 index 000000000..82d06b6f6 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-385729.js @@ -0,0 +1,55 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 385729; +var summary = 'uneval(eval(expression closure))'; +var actual = 'No Crash'; +var expect = 'No Crash'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof eval != 'undefined' && typeof uneval != 'undefined') + { + expect = '(function f () /x/g)'; + try + { + // mozilla 1.9 + actual = uneval(eval(expect)); + } + catch(ex) + { + // mozilla 1.8 + expect = 'SyntaxError: missing { before function body'; + actual = ex + ''; + } + compareSource(expect, actual, summary); + + expect = '({get f () /x/g})'; + try + { + // mozilla 1.9 + actual = uneval(eval("({get f () /x/g})")); + } + catch(ex) + { + // mozilla 1.8 + expect = 'SyntaxError: missing { before function body'; + actual = ex + ''; + } + compareSource(expect, actual, summary); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-394709.js b/js/src/tests/js1_8/extensions/regress-394709.js new file mode 100644 index 000000000..d04d8832f --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-394709.js @@ -0,0 +1,51 @@ +// |reftest| skip-if(!xulRuntime.shell) +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 394709; +var summary = 'Do not leak with object.watch and closure'; +var actual = 'No Leak'; +var expect = 'No Leak'; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + assertEq(finalizeCount(), 0, "invalid initial state"); + + runtest(); + gc(); + assertEq(finalizeCount(), 1, "leaked"); + + runtest(); + gc(); + assertEq(finalizeCount(), 2, "leaked"); + + runtest(); + gc(); + assertEq(finalizeCount(), 3, "leaked"); + + + function runtest () { + var obj = { b: makeFinalizeObserver() }; + obj.watch('b', watcher); + + function watcher(id, old, value) { + ++obj.n; + return value; + } + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-415721.js b/js/src/tests/js1_8/extensions/regress-415721.js new file mode 100644 index 000000000..b5f66f779 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-415721.js @@ -0,0 +1,44 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 415721; +var summary = 'jsatom.c double hashing re-validation logic is unsound'; + +printStatus (summary); + +var VARS = 10000; +var TRIES = 100; + +function atomizeStressTest() { + var fn = "function f() {var "; + for (var i = 0; i < VARS; i++) + fn += '_f' + i + ', '; + fn += 'q;}'; + + function e() { eval(fn); } + + for (var i = 0; i < TRIES; i++) { + scatter([e,e]); + gc(); + } +} + +var expect; +var actual; + +expect = actual = 'No crash'; +if (typeof scatter == 'undefined' || typeof gc == 'undefined') { + print('Test skipped. scatter or gc not defined.'); + expect = actual = 'Test skipped.'; +} else { + atomizeStressTest(); +} + +reportCompare(expect, actual, summary); + diff --git a/js/src/tests/js1_8/extensions/regress-417131.js b/js/src/tests/js1_8/extensions/regress-417131.js new file mode 100644 index 000000000..1f80246a2 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-417131.js @@ -0,0 +1,76 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 417131; +var summary = 'stress test for cache'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function f(N) + { + for (var i = 0; i != N; ++i) { + var obj0 = {}, obj1 = {}, obj2 = {}; + obj1['a'+i] = 0; + obj2['b'+i] = 0; + obj2['b'+(i+1)] = 1; + for (var repeat = 0;repeat != 2; ++repeat) { + var count = 0; + for (var j in obj1) { + if (j !== 'a'+i) + throw "Bad:"+j; + for (var k in obj2) { + if (i == Math.floor(N/3) || i == Math.floor(2*N/3)) + gc(); + var expected; + switch (count) { + case 0: expected='b'+i; break; + case 1: expected='b'+(i+1); break; + default: + throw "Bad count: "+count; + } + if (expected != k) + throw "Bad k, expected="+expected+", actual="+k; + for (var l in obj0) + ++count; + ++count; + } + } + if (count !== 2) + throw "Bad count: "+count; + } + } + } + + var array = [function() { f(10); }, + function() { f(50); }, + function() { f(200); }, + function() { f(400); } + ]; + + if (typeof scatter == "function") { + scatter(array); + } else { + for (var i = 0; i != array.length; ++i) + array[i](); + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-417817.js b/js/src/tests/js1_8/extensions/regress-417817.js new file mode 100644 index 000000000..0d303c325 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-417817.js @@ -0,0 +1,55 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 417817; +var summary = 'Do not assert: ASSERT_VALID_PROPERTY_CACHE_HIT'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +const numThreads = 2; +const numPasses = 1000; + +var tests = { + 0: function first(myAn) + { + /* This print statement is needed to reliably trigger the bug */ + print("Hello, World!"); + }, + length: 1 +}; + +function runAllTests() +{ + var passes; + var i; + + for (passes = 0; passes < numPasses; passes++) + { + for (i = 0; i < tests.length; i++) + { + tests[0](); + } + } +} + +if (typeof scatter == 'undefined') +{ + print(expect = actual = 'Test skipped. Requires scatter.'); +} +else +{ + var i; + var a = []; + for (i = 0; i < numThreads; i++) + a.push(runAllTests); + scatter(a); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-419091.js b/js/src/tests/js1_8/extensions/regress-419091.js new file mode 100644 index 000000000..4748292ba --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-419091.js @@ -0,0 +1,52 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 419091; +var summary = 'Do not assert: JS_PROPERTY_CACHE(cx).disabled >= 0'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof scatter == 'undefined') + { + print(expect = actual = 'Test skipped. Requires scatter.'); + } + else + { + if (typeof gczeal == 'undefined') + { + gczeal = (function () {}); + } + + gczeal(2); + + function f() { + for (let i = 0; i < 10; i++) { + let y = { x: i } + } + } + + for (let i = 0; i < 10; i++) + scatter([f, f]); + + gczeal(0); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-445818.js b/js/src/tests/js1_8/extensions/regress-445818.js new file mode 100644 index 000000000..c481e7c9b --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-445818.js @@ -0,0 +1,41 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 445818; +var summary = 'Do not crash with threads'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +printBugNumber(BUGNUMBER); +printStatus (summary); + +if (typeof scatter == 'undefined') +{ + print(expect = actual = 'Test skipped. scatter not defined'); +} +else +{ + var array = [{}, {}, {}, {}]; + + function test() { + for (var i = 0; i != 42*42*42; ++i) { + var obj = array[i % array.length]; + obj["a"+i] = 1; + var tmp = {}; + tmp["a"+i] = 2; + } + } + + scatter([test, test, test, test]); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-446169-01.js b/js/src/tests/js1_8/extensions/regress-446169-01.js new file mode 100644 index 000000000..31250b3fd --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-446169-01.js @@ -0,0 +1,50 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 446169; +var summary = 'Do not assert: Thin_GetWait(tl->owner) in thread-safe build'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +var array = [{}, {}, {}, {}]; + +function foo() +{ + for (var i = 0; i != 42*42*42; ++i) + { + var obj = array[i % array.length]; + obj["a"+i] = 1; + var tmp = {}; + tmp["a"+i] = 2; + } +} + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof scatter == 'function') + { + scatter([foo, foo, foo, foo]); + } + else + { + print('Test skipped. Requires thread-safe build with scatter function.'); + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} + + diff --git a/js/src/tests/js1_8/extensions/regress-446169-02.js b/js/src/tests/js1_8/extensions/regress-446169-02.js new file mode 100644 index 000000000..a7053825d --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-446169-02.js @@ -0,0 +1,48 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 446169; +var summary = 'Do not assert: Thin_GetWait(tl->owner) in thread-safe build'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +var array = []; +for (var i = 0; i != 100*1000; i += 2) { + array[i] = i; + array[i+1] = i; +} + +var src = array.join(';x'); + +function f() { + new Function(src); +} + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof scatter == 'function') + { + scatter([f, f, f, f]); + } + else + { + print('Test skipped. Requires thread-safe build with scatter function.'); + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} + + diff --git a/js/src/tests/js1_8/extensions/regress-452913.js b/js/src/tests/js1_8/extensions/regress-452913.js new file mode 100644 index 000000000..6b0551422 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-452913.js @@ -0,0 +1,18 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 452913; +var summary = 'Do not crash with defined getter and for (let)'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +(this.__defineGetter__("x", function (x)'foo'.replace(/o/g, [1].push))); +for(let y in [,,,]) for(let y in [,,,]) x = x; + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-454744.js b/js/src/tests/js1_8/extensions/regress-454744.js new file mode 100644 index 000000000..3b22acb9f --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-454744.js @@ -0,0 +1,35 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 454744; +var summary = 'Do not assert with JIT: PCVAL_IS_SPROP(entry->vword)'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + try + { + this.__defineGetter__('x', function() 2); for (var j=0;j<4;++j) { x=1; } + } + catch(ex) + { + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-465337.js b/js/src/tests/js1_8/extensions/regress-465337.js new file mode 100644 index 000000000..fcbc308ed --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-465337.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 465337; +var summary = 'Do not assert: (m != JSVAL_INT) || isInt32(*vp)'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var out = []; + for (let j = 0; j < 5; ++j) { out.push(6 - ((void 0) ^ 0x80000005)); } + print(uneval(out)); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-465453.js b/js/src/tests/js1_8/extensions/regress-465453.js new file mode 100644 index 000000000..ed97e89a1 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-465453.js @@ -0,0 +1,42 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 465453; +var summary = 'Do not convert (undefined) to "undefined"'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = '[(new Boolean(true)), (void 0), (new Boolean(true)), ' + + '(new Boolean(true)), (void 0), (void 0), "", "", (void 0)]'; + + var out = []; + for each (var e in [(new Boolean(true)), + (void 0), + (new Boolean(true)), + (new Boolean(true)), + (void 0), + (void 0), + "", + "", + (void 0)]) + out.push(e); + print(actual = uneval(out)); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-469625.js b/js/src/tests/js1_8/extensions/regress-469625.js new file mode 100644 index 000000000..549dc9068 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-469625.js @@ -0,0 +1,42 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 469625; +var summary = 'TM: Array prototype and expression closures'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'TypeError: [].__proto__ is not a function'; + + + Array.prototype.__proto__ = function () 3; + + try + { + [].__proto__(); + } + catch(ex) + { + print(actual = ex + ''); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-471197.js b/js/src/tests/js1_8/extensions/regress-471197.js new file mode 100644 index 000000000..bdf8ab43b --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-471197.js @@ -0,0 +1,45 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 471197; +var summary = 'Do not crash when cx->thread is null'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var results; + + + function f() { + for (var i = 0; i != 1000; ++i) { + } + } + + if (typeof scatter == 'function') + { + results = scatter([f, f]); + } + else + { + print('Test skipped due to lack of scatter threadsafe function'); + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-472450-03.js b/js/src/tests/js1_8/extensions/regress-472450-03.js new file mode 100644 index 000000000..4c2d6adb5 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-472450-03.js @@ -0,0 +1,34 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 472450; +var summary = 'TM: Do not assert: StackBase(fp) + blockDepth == regs.sp'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + var cyclic = []; + cyclic[0] = cyclic; + ({__proto__: cyclic}) + for (var y = 0; y < 3; ++y) { for each (let z in ['', function(){}]) { let x = + 1, c = []; } } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-472450-04.js b/js/src/tests/js1_8/extensions/regress-472450-04.js new file mode 100644 index 000000000..c1d8f4d04 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-472450-04.js @@ -0,0 +1,36 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 472450; +var summary = 'TM: Do not assert: StackBase(fp) + blockDepth == regs.sp'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + var cyclic = []; + cyclic[0] = cyclic; + ({__proto__: cyclic}); + function f(){ + eval("for (var y = 0; y < 1; ++y) { for each (let z in [null, function(){}, null, '', null, '', null]) { let x = 1, c = []; } }"); + } + f(); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-473040.js b/js/src/tests/js1_8/extensions/regress-473040.js new file mode 100644 index 000000000..b0c944b11 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-473040.js @@ -0,0 +1,25 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 473040; +var summary = 'Do not assert: tm->reservedDoublePoolPtr > tm->reservedDoublePool'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +Object.defineProperty(__proto__, "functional", +{ + enumerable: true, configurable: true, + get: new Function("gc()") +}); +for each (let x in [new Boolean(true), new Boolean(true), -0, new + Boolean(true), -0]) { undefined; } + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-475971.js b/js/src/tests/js1_8/extensions/regress-475971.js new file mode 100755 index 000000000..685ecec41 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-475971.js @@ -0,0 +1,58 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 475971; +var summary = 'js_CheckRedeclaration should unlock object on failures'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof scatter != 'function') + { + print(expect = actual = + 'Test skipped - requires threaded build with scatter'); + } + else + { + function x() { return 1; }; + + // g must run sufficiently long to ensure that the global scope is accessed + // from the parallel threads. + function g() + { + var sum = 0; + try { + for (var i = 0; i != 10000; ++i) { + sum += x(); + } + } catch (e) { } + } + + scatter([g, g]); + + try { + eval("const x = 1"); + } catch (e) { } + + scatter([g, g]); + + print("Done"); + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-476414-01.js b/js/src/tests/js1_8/extensions/regress-476414-01.js new file mode 100644 index 000000000..901783d15 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-476414-01.js @@ -0,0 +1,67 @@ +// |reftest| skip-if(!xulRuntime.shell) slow +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 476414; +var summary = 'Do not crash @ GetGCThingFlags'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +function whatToTestSpidermonkeyTrunk(code) +{ + return { + allowExec: true + }; +} +whatToTest = whatToTestSpidermonkeyTrunk; +function tryItOut(code) +{ + var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); + var f = new Function(code); + if (wtt.allowExec && f) { + rv = tryRunning(f, code); + } +} +function tryRunning(f, code) +{ + try { + var rv = f(); + } catch(runError) {} +} +var realFunction = Function; +var realUneval = uneval; +var realToString = toString; +var realToSource = toSource; +function tryEnsureSanity() +{ + delete Function; + delete uneval; + delete toSource; + delete toString; + Function = realFunction; + uneval = realUneval; + toSource = realToSource; + toString = realToString; +} +for (let iters = 0; iters < 2000; ++iters) { + count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); + tryEnsureSanity(); + count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield \"\" } ): break; }"); + tryEnsureSanity(); + count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } "); + tryEnsureSanity(); + count=45197; tryItOut("M:with((p={}, (p.z = <x/> === '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); + tryEnsureSanity(); + gc(); + tryEnsureSanity(); + count=45254; tryItOut("for each (NaN in this);"); + tryEnsureSanity(); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-476414-02.js b/js/src/tests/js1_8/extensions/regress-476414-02.js new file mode 100644 index 000000000..9e64bfacb --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-476414-02.js @@ -0,0 +1,67 @@ +// |reftest| skip-if(!xulRuntime.shell) slow +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 476414; +var summary = 'Do not crash @ js_NativeSet'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +function whatToTestSpidermonkeyTrunk(code) +{ + return { + allowExec: true + }; +} +whatToTest = whatToTestSpidermonkeyTrunk; +function tryItOut(code) +{ + var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); + var f = new Function(code); + if (wtt.allowExec && f) { + rv = tryRunning(f, code); + } +} +function tryRunning(f, code) +{ + try { + var rv = f(); + } catch(runError) {} +} +var realFunction = Function; +var realUneval = uneval; +var realToString = toString; +var realToSource = toSource; +function tryEnsureSanity() +{ + delete Function; + delete uneval; + delete toSource; + delete toString; + Function = realFunction; + uneval = realUneval; + toSource = realToSource; + toString = realToString; +} +for (let iters = 0; iters < 2000; ++iters) { + count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); + tryEnsureSanity(); + count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield \"\" } ): break; }"); + tryEnsureSanity(); + count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } "); + tryEnsureSanity(); + count=45197; tryItOut("M:with((p={}, (p.z = <x/> === '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); + tryEnsureSanity(); + gc(); + tryEnsureSanity(); + count=45254; tryItOut("for each (NaN in this);"); + tryEnsureSanity(); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-476653.js b/js/src/tests/js1_8/extensions/regress-476653.js new file mode 100644 index 000000000..1b33cdb9c --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-476653.js @@ -0,0 +1,34 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 476653; +var summary = 'Do not crash @ QuoteString'; +var actual = ''; +var expect = ''; + + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +for each (let x1 in ['']) +for (i = 0; i < 1; ++i) {} +delete uneval; +for (i = 0; i < 1; ++i) {} +for each (let x in [new String('q'), '', /x/, '', /x/]) { + for (var y = 0; y < 7; ++y) { if (y == 2 || y == 6) { setter = x; } } +} +try +{ + this.f(z); +} +catch(ex) +{ +} + + +reportCompare(expect, actual, summary); + diff --git a/js/src/tests/js1_8/extensions/regress-476869.js b/js/src/tests/js1_8/extensions/regress-476869.js new file mode 100644 index 000000000..9b61596c0 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-476869.js @@ -0,0 +1,45 @@ +// |reftest| skip-if(Android) +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 476869; +var summary = 'Do not assert: v != JSVAL_ERROR_COOKIE'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof gczeal == 'undefined') + { + gczeal = (function (){}); + } + + + function f() + { + (new Function("gczeal(1); for each (let y in [/x/,'',new Boolean(false),new Boolean(false),new Boolean(false),'',/x/,new Boolean(false),new Boolean(false)]){}"))(); + } + __proto__.__iterator__ = this.__defineGetter__("", function(){}) + f(); + + + delete __proto__.__iterator__; + + gczeal(0); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-479252.js b/js/src/tests/js1_8/extensions/regress-479252.js new file mode 100644 index 000000000..1f65c41c9 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-479252.js @@ -0,0 +1,41 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 479252; +var summary = 'Avoid watchdog ticks when idle in shell'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof sleep != 'function' || typeof scatter != 'function' || + typeof timeout != 'function') + { + print(expect = actual = 'Test skipped: requires mulithreads and timeout.'); + } + else + { + expectExitCode(6); + + function f() { sleep(100); } + timeout(1.0); + scatter([f,f,f,f,f]); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-479381.js b/js/src/tests/js1_8/extensions/regress-479381.js new file mode 100644 index 000000000..e8c4a4d1a --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-479381.js @@ -0,0 +1,51 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 479381; +var summary = 'Do not crash @ js_FinalizeStringRT with multi-threads.'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof gczeal != 'function' || typeof scatter != 'function') + { + print(expect = actual = 'Test skipped: requires mulithreads'); + } + else + { + expect = actual = 'No Crash'; + + gczeal(2); + + function f() { + var s; + for (var i = 0; i < 9999; i++) + s = 'a' + String(i)[3] + 'b'; + return s; + } + + print(scatter([f, f, f, f])); + + gczeal(0); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-481989.js b/js/src/tests/js1_8/extensions/regress-481989.js new file mode 100644 index 000000000..36efb7567 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-481989.js @@ -0,0 +1,19 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 481989; +var summary = 'TM: Do not assert: SPROP_HAS_STUB_SETTER(sprop)'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +y = this.watch("x", function(){}); for each (let y in ['', '']) x = y; + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-482263.js b/js/src/tests/js1_8/extensions/regress-482263.js new file mode 100644 index 000000000..0c395a494 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-482263.js @@ -0,0 +1,26 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 482263; +var summary = 'TM: Do not assert: x->oprnd2() == lirbuf->sp || x->oprnd2() == gp_ins'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +Object.defineProperty(__proto__, "x", +{ + enumerable: true, configurable: true, + get: function () { return ([]) } +}); +for each (let x in []) { for each (let x in ['', '']) { } } + + +reportCompare(expect, actual, summary); + +delete __proto__.x; diff --git a/js/src/tests/js1_8/extensions/shell.js b/js/src/tests/js1_8/extensions/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_8/extensions/shell.js diff --git a/js/src/tests/js1_8/extensions/simple-tree.js b/js/src/tests/js1_8/extensions/simple-tree.js new file mode 100644 index 000000000..3795ee61b --- /dev/null +++ b/js/src/tests/js1_8/extensions/simple-tree.js @@ -0,0 +1,52 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- + +var summary = "Create a tree of threads"; + +var N = 50; // number of threads to create + +printStatus (summary); + +function range(start, stop) { + var a = []; + for (var i = start; i < stop; i++) + a.push(i); + return a; +} + +function tree(start, stop) { + sleep(0.001); + + if (start >= stop) + return []; + else if (start + 1 >= stop) + return [start]; + + sleep(0.001); + + let mid = start + Math.floor((stop - start) / 2); + let halves = scatter([function () { return tree(start, mid); }, + function () { return tree(mid, stop); }]); + sleep(0.001); + return Array.prototype.concat.apply([], halves); +} + +var expect; +var actual; + +if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { + print('Test skipped. scatter or sleep not defined.'); + expect = actual = 'Test skipped.'; +} else { + expect = range(0, N).toSource(); + actual = tree(0, N).toSource(); +} + +reportCompare(expect, actual, summary); |