summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_8_1
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/js1_8_1')
-rw-r--r--js/src/tests/js1_8_1/JSON/browser.js0
-rw-r--r--js/src/tests/js1_8_1/JSON/regress-458959.js32
-rw-r--r--js/src/tests/js1_8_1/JSON/regress-459293.js25
-rw-r--r--js/src/tests/js1_8_1/JSON/shell.js0
-rw-r--r--js/src/tests/js1_8_1/README1
-rw-r--r--js/src/tests/js1_8_1/String/browser.js0
-rw-r--r--js/src/tests/js1_8_1/String/regress-305064.js144
-rw-r--r--js/src/tests/js1_8_1/String/shell.js0
-rw-r--r--js/src/tests/js1_8_1/browser.js0
-rw-r--r--js/src/tests/js1_8_1/extensions/browser.js0
-rw-r--r--js/src/tests/js1_8_1/extensions/new-parenthesization.js21
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-353214-02.js30
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-437288-01.js35
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-452498-162.js24
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-452498-193.js34
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-452498-196.js44
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-466905-04.js49
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-466905-05.js45
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-477158.js31
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-477187.js41
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-520572.js41
-rw-r--r--js/src/tests/js1_8_1/extensions/shell.js0
-rw-r--r--js/src/tests/js1_8_1/extensions/strict-warning.js32
-rw-r--r--js/src/tests/js1_8_1/jit/browser.js0
-rw-r--r--js/src/tests/js1_8_1/jit/math-jit-tests.js687
-rw-r--r--js/src/tests/js1_8_1/jit/regress-451673.js81
-rw-r--r--js/src/tests/js1_8_1/jit/regress-451974-01.js52
-rw-r--r--js/src/tests/js1_8_1/jit/regress-451974-02.js63
-rw-r--r--js/src/tests/js1_8_1/jit/regress-452498-01.js72
-rw-r--r--js/src/tests/js1_8_1/jit/regress-458838.js63
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-01.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-02.js70
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-03.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-04.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-05.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-06.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-07.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-08.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-09.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-10.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-11.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-462459-12.js71
-rw-r--r--js/src/tests/js1_8_1/jit/regress-469927.js44
-rw-r--r--js/src/tests/js1_8_1/jit/regress-470739.js46
-rw-r--r--js/src/tests/js1_8_1/jit/regress-471635.js56
-rw-r--r--js/src/tests/js1_8_1/jit/regress-489682.js31
-rw-r--r--js/src/tests/js1_8_1/jit/shell.js4
-rw-r--r--js/src/tests/js1_8_1/regress/browser.js0
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-006.js45
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-027.js38
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-030.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-040.js37
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-050.js43
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-051.js48
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-052-a.js42
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-053.js80
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-058.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-062.js44
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-063.js35
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-071.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-072.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-073.js38
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-074.js34
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-075.js32
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-076.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-079.js34
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-082.js84
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-092.js40
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-101.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-102.js69
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-104.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-111.js34
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-112.js39
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-114-a.js43
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-114.js50
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-116.js33
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-117.js95
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-118.js33
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-121.js33
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-123.js59
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-129.js50
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-131.js49
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-135.js46
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-155.js34
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-160.js34
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-168-1.js33
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-168-2.js32
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-176.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-181.js31
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-185.js37
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-187.js36
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-191.js47
-rw-r--r--js/src/tests/js1_8_1/regress/regress-452498-192.js30
-rw-r--r--js/src/tests/js1_8_1/regress/regress-466905-01.js30
-rw-r--r--js/src/tests/js1_8_1/regress/regress-466905-02.js29
-rw-r--r--js/src/tests/js1_8_1/regress/regress-479430-01.js44
-rw-r--r--js/src/tests/js1_8_1/regress/regress-479430-02.js46
-rw-r--r--js/src/tests/js1_8_1/regress/regress-479430-03.js49
-rw-r--r--js/src/tests/js1_8_1/regress/regress-479430-04.js45
-rw-r--r--js/src/tests/js1_8_1/regress/regress-479430-05.js44
-rw-r--r--js/src/tests/js1_8_1/regress/regress-495773.js42
-rw-r--r--js/src/tests/js1_8_1/regress/regress-495907.js34
-rw-r--r--js/src/tests/js1_8_1/regress/regress-496922.js38
-rw-r--r--js/src/tests/js1_8_1/regress/regress-507053.js46
-rw-r--r--js/src/tests/js1_8_1/regress/regress-507295.js41
-rw-r--r--js/src/tests/js1_8_1/regress/regress-509354.js41
-rw-r--r--js/src/tests/js1_8_1/regress/regress-522123.js38
-rw-r--r--js/src/tests/js1_8_1/regress/regress-524264.js7
-rw-r--r--js/src/tests/js1_8_1/regress/regress-524743.js20
-rw-r--r--js/src/tests/js1_8_1/regress/regress-530879.js9
-rw-r--r--js/src/tests/js1_8_1/regress/shell.js0
-rw-r--r--js/src/tests/js1_8_1/shell.js13
-rw-r--r--js/src/tests/js1_8_1/strict/12.2.1.js75
-rw-r--r--js/src/tests/js1_8_1/strict/8.7.2.js17
-rw-r--r--js/src/tests/js1_8_1/strict/shell.js88
-rw-r--r--js/src/tests/js1_8_1/template.js28
116 files changed, 5372 insertions, 0 deletions
diff --git a/js/src/tests/js1_8_1/JSON/browser.js b/js/src/tests/js1_8_1/JSON/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/JSON/browser.js
diff --git a/js/src/tests/js1_8_1/JSON/regress-458959.js b/js/src/tests/js1_8_1/JSON/regress-458959.js
new file mode 100644
index 000000000..04c606c5b
--- /dev/null
+++ b/js/src/tests/js1_8_1/JSON/regress-458959.js
@@ -0,0 +1,32 @@
+/* -*- 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 = 458959;
+var summary = 'this.JSON should not be enumerable';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i in this)
+ {
+ if (i.toString() == 'JSON')
+ actual = i;
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/JSON/regress-459293.js b/js/src/tests/js1_8_1/JSON/regress-459293.js
new file mode 100644
index 000000000..fbd46589c
--- /dev/null
+++ b/js/src/tests/js1_8_1/JSON/regress-459293.js
@@ -0,0 +1,25 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Robert Sayre
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 459293;
+var summary = 'Allow redeclaration of JSON';
+var actual = '';
+var expect = '';
+
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ eval('var JSON = "foo";');
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_8_1/JSON/shell.js b/js/src/tests/js1_8_1/JSON/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/JSON/shell.js
diff --git a/js/src/tests/js1_8_1/README b/js/src/tests/js1_8_1/README
new file mode 100644
index 000000000..d0b5fc6ee
--- /dev/null
+++ b/js/src/tests/js1_8_1/README
@@ -0,0 +1 @@
+JavaScript 1.8.1
diff --git a/js/src/tests/js1_8_1/String/browser.js b/js/src/tests/js1_8_1/String/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/String/browser.js
diff --git a/js/src/tests/js1_8_1/String/regress-305064.js b/js/src/tests/js1_8_1/String/regress-305064.js
new file mode 100644
index 000000000..c3e45e43c
--- /dev/null
+++ b/js/src/tests/js1_8_1/String/regress-305064.js
@@ -0,0 +1,144 @@
+// |reftest| fails
+/* -*- 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 = 305064;
+var summary = 'Tests the trim, trimRight and trimLeft methods';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var trimMethods = ['trim', 'trimLeft', 'trimRight'];
+
+/** List from ES 3.1 Recommendation for String.trim (bug 305064) **/
+var whitespace = [
+ {s : '\u0009', t : 'HORIZONTAL TAB'},
+ {s : '\u000B', t : 'VERTICAL TAB'},
+ {s : '\u000C', t : 'FORMFEED'},
+ {s : '\u0020', t : 'SPACE'},
+ {s : '\u00A0', t : 'NO-BREAK SPACE'},
+ {s : '\u1680', t : 'OGHAM SPACE MARK'},
+ {s : '\u180E', t : 'MONGOLIAN VOWEL SEPARATOR'},
+ {s : '\u2000', t : 'EN QUAD'},
+ {s : '\u2001', t : 'EM QUAD'},
+ {s : '\u2002', t : 'EN SPACE'},
+ {s : '\u2003', t : 'EM SPACE'},
+ {s : '\u2004', t : 'THREE-PER-EM SPACE'},
+ {s : '\u2005', t : 'FOUR-PER-EM SPACE'},
+ {s : '\u2006', t : 'SIX-PER-EM SPACE'},
+ {s : '\u2007', t : 'FIGURE SPACE'},
+ {s : '\u2008', t : 'PUNCTUATION SPACE'},
+ {s : '\u2009', t : 'THIN SPACE'},
+ {s : '\u200A', t : 'HAIR SPACE'},
+ {s : '\u202F', t : 'NARROW NO-BREAK SPACE'},
+ {s : '\u205F', t : 'MEDIUM MATHEMATICAL SPACE'},
+ {s : '\u3000', t : 'IDEOGRAPHIC SPACE'},
+ {s : '\u000A', t : 'LINE FEED OR NEW LINE'},
+ {s : '\u000D', t : 'CARRIAGE RETURN'},
+ {s : '\u2028', t : 'LINE SEPARATOR'},
+ {s : '\u2029', t : 'PARAGRAPH SEPARATOR'},
+ {s : '\u200B', t : 'ZERO WIDTH SPACE (category Cf)'}
+ ];
+
+for (var j = 0; j < trimMethods.length; ++j)
+{
+ var str;
+
+ var method = trimMethods[j];
+
+ if (typeof String.prototype[method] == 'undefined')
+ {
+ reportCompare(true, true, 'Test skipped. String.prototype.' + method + ' is not supported');
+ continue;
+ }
+
+ print('Test empty string.');
+ str = '';
+ expected = '';
+ actual = str[method]();
+ reportCompare(expected, actual, '"' + toPrinted(str) + '".' + method + '()');
+
+ print('Test string with no whitespace.');
+ str = 'a';
+ expected = 'a';
+ actual = str[method]();
+ reportCompare(expected, actual, '"' + toPrinted(str) + '".' + method + '()');
+
+ for (var i = 0; i < whitespace.length; ++i)
+ {
+ var v = whitespace[i].s;
+ var t = whitespace[i].t;
+ v = v + v + v;
+
+ print('=======================================');
+ print('Test ' + method + ' with with only whitespace. : ' + t);
+ str = v;
+ expected = '';
+ actual = str[method]();
+ reportCompare(expected, actual, t + ':' + '"' + toPrinted(str) + '".' + method + '()');
+
+ print('Test ' + method + ' with with no leading or trailing whitespace. : ' + t);
+ str = 'a' + v + 'b';
+ expected = str;
+ actual = str[method]();
+ reportCompare(expected, actual, t + ':' + '"' + toPrinted(str) + '".' + method + '()');
+
+ print('Test ' + method + ' with with leading whitespace. : ' + t);
+ str = v + 'a';
+ switch(method)
+ {
+ case 'trim':
+ expected = 'a';
+ break;
+ case 'trimLeft':
+ expected = 'a';
+ break;
+ case 'trimRight':
+ expected = str;
+ break;
+ }
+ actual = str[method]();
+ reportCompare(expected, actual, t + ':' + '"' + toPrinted(str) + '".' + method + '()');
+
+ print('Test ' + method + ' with with trailing whitespace. : ' + t);
+ str = 'a' + v;
+ switch(method)
+ {
+ case 'trim':
+ expected = 'a';
+ break;
+ case 'trimLeft':
+ expected = str;
+ break;
+ case 'trimRight':
+ expected = 'a';
+ break;
+ }
+ actual = str[method]();
+ reportCompare(expected, actual, t + ':' + '"' + toPrinted(str) + '".' + method + '()');
+
+ print('Test ' + method + ' with with leading and trailing whitepace.');
+ str = v + 'a' + v;
+ switch(method)
+ {
+ case 'trim':
+ expected = 'a';
+ break;
+ case 'trimLeft':
+ expected = 'a' + v;
+ break;
+ case 'trimRight':
+ expected = v + 'a';
+ break;
+ }
+ actual = str[method]();
+ reportCompare(expected, actual, t + ':' + '"' + toPrinted(str) + '".' + method + '()');
+
+ }
+}
+
diff --git a/js/src/tests/js1_8_1/String/shell.js b/js/src/tests/js1_8_1/String/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/String/shell.js
diff --git a/js/src/tests/js1_8_1/browser.js b/js/src/tests/js1_8_1/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/browser.js
diff --git a/js/src/tests/js1_8_1/extensions/browser.js b/js/src/tests/js1_8_1/extensions/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/browser.js
diff --git a/js/src/tests/js1_8_1/extensions/new-parenthesization.js b/js/src/tests/js1_8_1/extensions/new-parenthesization.js
new file mode 100644
index 000000000..a3aebf383
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/new-parenthesization.js
@@ -0,0 +1,21 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Jesse Ruderman
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 521456;
+var summary =
+ 'Incorrect decompilation of new (eval(v)).s and new (f.apply(2)).s';
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+function foo(c) { return new (eval(c)).s; }
+function bar(f) { var a = new (f.apply(2).s); return a; }
+
+assertEq(bar.toString().search(/new\s+f/), -1);
+assertEq(foo.toString().search(/new\s+eval/), -1);
+
+reportCompare(true, true);
diff --git a/js/src/tests/js1_8_1/extensions/regress-353214-02.js b/js/src/tests/js1_8_1/extensions/regress-353214-02.js
new file mode 100644
index 000000000..13a8f246d
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-353214-02.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 = 353214;
+var summary = 'bug 353214';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var f = function ([x]) { let y; }
+ expect = 'function ([x]) { let y; }';
+ actual = f + '';
+
+ compareSource(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/regress-437288-01.js b/js/src/tests/js1_8_1/extensions/regress-437288-01.js
new file mode 100644
index 000000000..d9813c34f
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-437288-01.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 = 437288;
+var summary = 'for loop turning into a while loop';
+var actual = 'No Hang';
+var expect = 'No Hang';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ eval('(function() { const x = 1; for (x in null); })();');
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/regress-452498-162.js b/js/src/tests/js1_8_1/extensions/regress-452498-162.js
new file mode 100644
index 000000000..543c9a1b0
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-452498-162.js
@@ -0,0 +1,24 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #162 From Gary Kwong
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+// Assertion failure: !OBJ_GET_CLASS(cx, proto)->getObjectOps, at ../jsobj.cpp:2030
+
+this.__defineGetter__("x3", Function);
+parseInt = x3;
+parseInt.prototype = [];
+for (var z = 0; z < 4; ++z) { new parseInt() }
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_8_1/extensions/regress-452498-193.js b/js/src/tests/js1_8_1/extensions/regress-452498-193.js
new file mode 100644
index 000000000..1397bf4bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-452498-193.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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #193 From Gary Kwong
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// Assertion failure: afunbox->parent, at ../jsparse.cpp:1912
+
+ this.x = undefined;
+ this.watch("x", Function);
+ NaN = uneval({ get \u3056 (){ return undefined } });
+ x+=NaN;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/regress-452498-196.js b/js/src/tests/js1_8_1/extensions/regress-452498-196.js
new file mode 100644
index 000000000..69d5a3586
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-452498-196.js
@@ -0,0 +1,44 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #196 From Gary Kwong
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// Assertion failure: localKind == JSLOCAL_VAR || localKind == JSLOCAL_CONST, at ../jsfun.cpp:916
+
+ this.x = undefined;
+ this.watch("x", Function);
+ NaN = uneval({ get \u3056 (){ return undefined } });
+ x+=NaN;
+
+ reportCompare(expect, actual, summary + ': 1');
+
+// Assertion failure: lexdep->isLet(), at ../jsparse.cpp:1900
+
+ (function (){
+ var x;
+ eval("var x; (function ()x)");
+ }
+ )();
+
+ reportCompare(expect, actual, summary + ': 2');
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/regress-466905-04.js b/js/src/tests/js1_8_1/extensions/regress-466905-04.js
new file mode 100644
index 000000000..95f9e2aef
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-466905-04.js
@@ -0,0 +1,49 @@
+/* -*- 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 = 466905;
+var summary = 'Prototypes of sandboxed arrays';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if (typeof evalcx != 'function')
+ {
+ expect = actual = 'Test skipped: requires evalcx support';
+ }
+ else
+ {
+ expect = true;
+
+ function createArray()
+ {
+ var a;
+ for (var i = 0; i < 10; i++)
+ a = [1, 2, 3, 4, 5];
+ return a;
+ }
+
+ var sandbox = evalcx("lazy");
+ sandbox.createArray = createArray;
+ var p1 = Object.getPrototypeOf(createArray());
+ var p2 = Object.getPrototypeOf(evalcx("createArray()", sandbox));
+ print(actual = (p1 === p2));
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/regress-466905-05.js b/js/src/tests/js1_8_1/extensions/regress-466905-05.js
new file mode 100644
index 000000000..c1da83dba
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-466905-05.js
@@ -0,0 +1,45 @@
+// |reftest| skip -- no-op in browser, fails in shell - see bug 554793
+/* -*- 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 = 466905;
+var summary = 'Sandbox shapes';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if (typeof evalcx != 'function')
+ {
+ expect = actual = 'Test skipped: requires evalcx support';
+ }
+ else if (typeof shapeOf != 'function')
+ {
+ expect = actual = 'Test skipped: requires shapeOf support';
+ }
+ else
+ {
+
+ var s1 = evalcx('lazy');
+ var s2 = evalcx('lazy');
+
+ expect = shapeOf(s1);
+ actual = shapeOf(s2);
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/regress-477158.js b/js/src/tests/js1_8_1/extensions/regress-477158.js
new file mode 100644
index 000000000..9ff3591e6
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-477158.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 477158;
+var summary = 'Do not assert: v == JSVAL_TRUE || v == JSVAL_FALSE';
+var actual = '';
+var expect = '';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+
+ x = 0;
+ x = x.prop;
+ for each (let [] in ['', '']) { switch(x) { default: (function(){}); } };
+
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/regress-477187.js b/js/src/tests/js1_8_1/extensions/regress-477187.js
new file mode 100644
index 000000000..76b2d1954
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-477187.js
@@ -0,0 +1,41 @@
+// |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 = 477187;
+var summary = 'timeout script';
+var actual = '';
+var expect = '';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if (typeof window != 'undefined' || typeof timeout != 'function')
+ {
+ print(expect = actual = 'Test skipped due to lack of timeout function');
+ reportCompare(expect, actual, summary);
+ }
+ else
+ {
+ expectExitCode(6);
+ timeout(0.01);
+ // Call reportCompare early here to get a result. The test will fail if
+ // the timeout doesn't work and the test framework is forced to terminate
+ // the test.
+ reportCompare(expect, actual, summary);
+
+ while(1);
+ }
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/regress-520572.js b/js/src/tests/js1_8_1/extensions/regress-520572.js
new file mode 100644
index 000000000..97f00029a
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-520572.js
@@ -0,0 +1,41 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Blake Kaplan
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 520572;
+var summary = 'watch should innerize the object being watched';
+var actual = 0;
+var expect = 2;
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if ("evalcx" in this) {
+ // shell
+ let s = evalcx("lazy");
+ s.n = 0;
+ evalcx('this.watch("x", function(){ n++; }); this.x = 4; x = 6', s);
+ actual = s.n;
+ reportCompare(expect, actual, summary);
+ } else {
+ // browser
+ this.watch('x', function(){ actual++; });
+ this.x = 4;
+ x = 6;
+ reportCompare(expect, actual, summary);
+ }
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/extensions/shell.js b/js/src/tests/js1_8_1/extensions/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/shell.js
diff --git a/js/src/tests/js1_8_1/extensions/strict-warning.js b/js/src/tests/js1_8_1/extensions/strict-warning.js
new file mode 100644
index 000000000..b5a37ea70
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/strict-warning.js
@@ -0,0 +1,32 @@
+// Turn on strict mode and warnings-as-errors mode.
+if (options().split().indexOf('strict') == -1)
+ options('strict');
+if (options().split().indexOf('werror') == -1)
+ options('werror');
+
+function expectSyntaxError(stmt) {
+ print(stmt);
+ var result = 'no error';
+ try {
+ Function(stmt);
+ } catch (exc) {
+ result = exc.constructor.name;
+ }
+ assertEq(result, 'SyntaxError');
+}
+
+function test(expr) {
+ // Without extra parentheses, expect an error.
+ expectSyntaxError('if (' + expr + ') {};');
+
+ // Extra parentheses silence the warning/error.
+ Function('if ((' + expr + ')) {};');
+}
+
+// Overparenthesized assignment in a condition should not be a strict error.
+test('a = 0');
+test('a = (f(), g)');
+test('a = b || c > d');
+expectSyntaxError('if (a == 0);');
+reportCompare('passed', 'passed', 'Overparenthesized assignment in a condition should not be a strict error.');
+
diff --git a/js/src/tests/js1_8_1/jit/browser.js b/js/src/tests/js1_8_1/jit/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/browser.js
diff --git a/js/src/tests/js1_8_1/jit/math-jit-tests.js b/js/src/tests/js1_8_1/jit/math-jit-tests.js
new file mode 100644
index 000000000..ac8e4b510
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/math-jit-tests.js
@@ -0,0 +1,687 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
+/* 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 = 'none';
+var summary = 'trace-capability math mini-testsuite';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+/**
+ * A number of the tests in this file depend on the setting of
+ * HOTLOOP. Define some constants up front, so they're easy to grep
+ * for.
+ */
+// The HOTLOOP constant we depend on; only readable from our stats
+// object in debug builds.
+const haveTracemonkey = !!(this.tracemonkey)
+const HOTLOOP = haveTracemonkey ? tracemonkey.HOTLOOP : 2;
+
+var testName = null;
+if ("arguments" in this && arguments.length > 0)
+ testName = arguments[0];
+var fails = [], passes=[];
+
+function jitstatHandler(f)
+{
+ if (!haveTracemonkey)
+ return;
+
+ // XXXbz this is a nasty hack, but I can't figure out a way to
+ // just use jitstats.tbl here
+ f("recorderStarted");
+ f("recorderAborted");
+ f("traceCompleted");
+ f("sideExitIntoInterpreter");
+ f("typeMapMismatchAtEntry");
+ f("returnToDifferentLoopHeader");
+ f("traceTriggered");
+ f("globalShapeMismatchAtEntry");
+ f("treesTrashed");
+ f("slotPromoted");
+ f("unstableLoopVariable");
+ f("noCompatInnerTrees");
+ f("breakLoopExits");
+ f("returnLoopExits");
+}
+
+function test(f)
+{
+ if (!testName || testName == f.name) {
+ // Collect our jit stats
+ var localJITstats = {};
+ jitstatHandler(function(prop, local, global) {
+ localJITstats[prop] = tracemonkey[prop];
+ });
+ check(f.name, f(), f.expected, localJITstats, f.jitstats);
+ }
+}
+
+function map_test(t, cases)
+{
+ for (var i = 0; i < cases.length; i++) {
+ function c() { return t(cases[i].input); }
+ c.expected = cases[i].expected;
+ c.name = t.name + "(" + uneval(cases[i].input) + ")";
+ test(c);
+ }
+}
+
+// Use this function to compare expected and actual test results.
+// Types must match.
+// For numbers, treat NaN as matching NaN, distinguish 0 and -0, and
+// tolerate a certain degree of error for other values.
+//
+// These are the same criteria used by the tests in js/tests, except that
+// we distinguish 0 and -0.
+function close_enough(expected, actual)
+{
+ if (typeof expected != typeof actual)
+ return false;
+ if (typeof expected != 'number')
+ return actual == expected;
+
+ // Distinguish NaN from other values. Using x != x comparisons here
+ // works even if tests redefine isNaN.
+ if (actual != actual)
+ return expected != expected
+ if (expected != expected)
+ return false;
+
+ // Tolerate a certain degree of error.
+ if (actual != expected)
+ return Math.abs(actual - expected) <= 1E-10;
+
+ // Distinguish 0 and -0.
+ if (actual == 0)
+ return (1 / actual > 0) == (1 / expected > 0);
+
+ return true;
+}
+
+function check(desc, actual, expected, oldJITstats, expectedJITstats)
+{
+ var pass = false;
+ if (close_enough(expected, actual)) {
+ pass = true;
+ jitstatHandler(function(prop) {
+ if (expectedJITstats && prop in expectedJITstats &&
+ expectedJITstats[prop] !=
+ tracemonkey[prop] - oldJITstats[prop]) {
+ pass = false;
+ }
+ });
+ if (pass) {
+ reportCompare(expected, actual, desc);
+ passes.push(desc);
+ return print(desc, ": passed");
+ }
+ }
+
+ if (expected instanceof RegExp) {
+ pass = reportMatch(expected, actual + '', desc);
+ if (pass) {
+ jitstatHandler(function(prop) {
+ if (expectedJITstats && prop in expectedJITstats &&
+ expectedJITstats[prop] !=
+ tracemonkey[prop] - oldJITstats[prop]) {
+ pass = false;
+ }
+ });
+ }
+ if (pass) {
+ passes.push(desc);
+ return print(desc, ": passed");
+ }
+ }
+
+ reportCompare(expected, actual, desc);
+
+ fails.push(desc);
+ var expectedStats = "";
+ if (expectedJITstats) {
+ jitstatHandler(function(prop) {
+ if (prop in expectedJITstats) {
+ if (expectedStats)
+ expectedStats += " ";
+ expectedStats +=
+ prop + ": " + expectedJITstats[prop];
+ }
+ });
+ }
+ var actualStats = "";
+ if (expectedJITstats) {
+ jitstatHandler(function(prop) {
+ if (prop in expectedJITstats) {
+ if (actualStats)
+ actualStats += " ";
+ actualStats += prop + ": " + (tracemonkey[prop]-oldJITstats[prop]);
+ }
+ });
+ }
+ print(desc, ": FAILED: expected", typeof(expected),
+ "(", uneval(expected), ")",
+ (expectedStats ? " [" + expectedStats + "] " : ""),
+ "!= actual",
+ typeof(actual), "(", uneval(actual), ")",
+ (actualStats ? " [" + actualStats + "] " : ""));
+}
+
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+// Apply FUNCNAME to ARGS, and check against EXPECTED.
+// Expect a loop containing such a call to be traced.
+// FUNCNAME and ARGS are both strings.
+// ARGS has the form of an argument list: a comma-separated list of expressions.
+// Certain Tracemonkey limitations require us to pass FUNCNAME as a string.
+// Passing ARGS as a string allows us to assign better test names:
+// expressions like Math.PI/4 haven't been evaluated to big hairy numbers.
+function testmath(funcname, args, expected) {
+ var i, j;
+
+ var arg_value_list = eval("[" + args + "]");
+ var arity = arg_value_list.length;
+
+ // Build the string "a[i][0],...,a[i][ARITY-1]".
+ var actuals = []
+ for (i = 0; i < arity; i++)
+ actuals.push("a[i][" + i + "]");
+ actuals = actuals.join(",");
+
+ // Create a function that maps FUNCNAME across an array of input values.
+ // Unless we eval here, the call to funcname won't get traced.
+ // FUNCNAME="Infinity/Math.abs" and cases like that happen to
+ // parse, too, in a twisted way.
+ var mapfunc = eval("(function(a) {\n"
+ + " for (var i = 0; i < a.length; i++)\n"
+ + " a[i] = " + funcname + "(" + actuals +");\n"
+ + " })\n");
+
+ // To prevent the compiler from doing constant folding, produce an
+ // array to pass to mapfunc that contains enough dummy
+ // values at the front to get the loop body jitted, and then our
+ // actual test value.
+ var dummies_and_input = [];
+ for (i = 0; i < RUNLOOP; i++) {
+ var dummy_list = [];
+ for (j = 0; j < arity; j++)
+ dummy_list[j] = .0078125 * ((i + j) % 128);
+ dummies_and_input[i] = dummy_list;
+ }
+ dummies_and_input[RUNLOOP] = arg_value_list;
+
+ function testfunc() {
+ // Map the function across the dummy values and the test input.
+ mapfunc(dummies_and_input);
+ return dummies_and_input[RUNLOOP];
+ }
+ testfunc.name = funcname + "(" + args + ")";
+ testfunc.expected = expected;
+
+ // Disable jitstats check. This never worked right. The actual part of the
+ // loop we cared about was never traced. We traced the filler parts early
+ // and then took a mismatch side exit on every subequent array read with
+ // a different type (gal, discovered when fixing bug 479110).
+ // testfunc.jitstats = {
+ // recorderStarted: 1,
+ // recorderAborted: 0,
+ // traceTriggered: 1
+ // };
+
+ test(testfunc);
+}
+
+testmath("Math.abs", "void 0", Number.NaN)
+testmath("Math.abs", "null", 0)
+testmath("Math.abs", "true", 1)
+testmath("Math.abs", "false", 0)
+testmath("Math.abs", "\"a string primitive\"", Number.NaN)
+testmath("Math.abs", "new String( 'a String object' )", Number.NaN)
+testmath("Math.abs", "Number.NaN", Number.NaN)
+testmath("Math.abs", "0", 0)
+testmath("Math.abs", "-0", 0)
+testmath("Infinity/Math.abs", "-0", Infinity)
+testmath("Math.abs", "Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.abs", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.abs", "- Number.MAX_VALUE", Number.MAX_VALUE)
+testmath("Math.abs", "-Number.MIN_VALUE", Number.MIN_VALUE)
+testmath("Math.abs", "Number.MAX_VALUE", Number.MAX_VALUE)
+testmath("Math.abs", "Number.MIN_VALUE", Number.MIN_VALUE)
+testmath("Math.abs", "-1", 1)
+testmath("Math.abs", "new Number(-1)", 1)
+testmath("Math.abs", "1", 1)
+testmath("Math.abs", "Math.PI", Math.PI)
+testmath("Math.abs", "-Math.PI", Math.PI)
+testmath("Math.abs", "-1/100000000", 1/100000000)
+testmath("Math.abs", "-Math.pow(2,32)", Math.pow(2,32))
+testmath("Math.abs", "Math.pow(2,32)", Math.pow(2,32))
+testmath("Math.abs", "-0xfff", 4095)
+testmath("Math.abs", "-0777", 511)
+testmath("Math.abs", "'-1e-1'", 0.1)
+testmath("Math.abs", "'0xff'", 255)
+testmath("Math.abs", "'077'", 77)
+testmath("Math.abs", "'Infinity'", Infinity)
+testmath("Math.abs", "'-Infinity'", Infinity)
+
+testmath("Math.acos", "void 0", Number.NaN)
+testmath("Math.acos", "null", Math.PI/2)
+testmath("Math.acos", "Number.NaN", Number.NaN)
+testmath("Math.acos", "\"a string\"", Number.NaN)
+testmath("Math.acos", "'0'", Math.PI/2)
+testmath("Math.acos", "'1'", 0)
+testmath("Math.acos", "'-1'", Math.PI)
+testmath("Math.acos", "1.00000001", Number.NaN)
+testmath("Math.acos", "-1.00000001", Number.NaN)
+testmath("Math.acos", "1", 0)
+testmath("Math.acos", "-1", Math.PI)
+testmath("Math.acos", "0", Math.PI/2)
+testmath("Math.acos", "-0", Math.PI/2)
+testmath("Math.acos", "Math.SQRT1_2", Math.PI/4)
+testmath("Math.acos", "-Math.SQRT1_2", Math.PI/4*3)
+testmath("Math.acos", "0.9999619230642", Math.PI/360)
+testmath("Math.acos", "-3.0", Number.NaN)
+
+testmath("Math.asin", "void 0", Number.NaN)
+testmath("Math.asin", "null", 0)
+testmath("Math.asin", "Number.NaN", Number.NaN)
+testmath("Math.asin", "\"string\"", Number.NaN)
+testmath("Math.asin", "\"0\"", 0)
+testmath("Math.asin", "\"1\"", Math.PI/2)
+testmath("Math.asin", "\"-1\"", -Math.PI/2)
+testmath("Math.asin", "Math.SQRT1_2+''", Math.PI/4)
+testmath("Math.asin", "-Math.SQRT1_2+''", -Math.PI/4)
+testmath("Math.asin", "1.000001", Number.NaN)
+testmath("Math.asin", "-1.000001", Number.NaN)
+testmath("Math.asin", "0", 0)
+testmath("Math.asin", "-0", -0)
+testmath("Infinity/Math.asin", "-0", -Infinity)
+testmath("Math.asin", "1", Math.PI/2)
+testmath("Math.asin", "-1", -Math.PI/2)
+testmath("Math.asin", "Math.SQRT1_2", Math.PI/4)
+testmath("Math.asin", "-Math.SQRT1_2", -Math.PI/4)
+
+testmath("Math.atan", "void 0", Number.NaN)
+testmath("Math.atan", "null", 0)
+testmath("Math.atan", "Number.NaN", Number.NaN)
+testmath("Math.atan", "\"a string\"", Number.NaN)
+testmath("Math.atan", "'0'", 0)
+testmath("Math.atan", "'1'", Math.PI/4)
+testmath("Math.atan", "'-1'", -Math.PI/4)
+testmath("Math.atan", "'Infinity'", Math.PI/2)
+testmath("Math.atan", "'-Infinity'", -Math.PI/2)
+testmath("Math.atan", "0", 0)
+testmath("Math.atan", "-0", -0)
+testmath("Infinity/Math.atan", "-0", -Infinity)
+testmath("Math.atan", "Number.POSITIVE_INFINITY", Math.PI/2)
+testmath("Math.atan", "Number.NEGATIVE_INFINITY", -Math.PI/2)
+testmath("Math.atan", "1", Math.PI/4)
+testmath("Math.atan", "-1", -Math.PI/4)
+
+testmath("Math.atan2", "Number.NaN,0", Number.NaN)
+testmath("Math.atan2", "null, null", 0)
+testmath("Math.atan2", "void 0, void 0", Number.NaN)
+testmath("Math.atan2", "0,Number.NaN", Number.NaN)
+testmath("Math.atan2", "1,0", Math.PI/2)
+testmath("Math.atan2", "1,-0", Math.PI/2)
+testmath("Math.atan2", "0,0.001", 0)
+testmath("Math.atan2", "0,0", 0)
+testmath("Math.atan2", "0,-0", Math.PI)
+testmath("Math.atan2", "0, -1", Math.PI)
+testmath("Math.atan2", "-0, 1", -0)
+testmath("Infinity/Math.atan2", "-0,1", -Infinity)
+testmath("Math.atan2", "-0,0", -0)
+testmath("Math.atan2", "-0, -0", -Math.PI)
+testmath("Math.atan2", "-0, -1", -Math.PI)
+testmath("Math.atan2", "-1, 0", -Math.PI/2)
+testmath("Math.atan2", "-1, -0", -Math.PI/2)
+testmath("Math.atan2", "1, Number.POSITIVE_INFINITY", 0)
+testmath("Math.atan2", "1, Number.NEGATIVE_INFINITY", Math.PI)
+testmath("Math.atan2", "-1,Number.POSITIVE_INFINITY", -0)
+testmath("Infinity/Math.atan2", "-1,Infinity", -Infinity)
+testmath("Math.atan2", "-1,Number.NEGATIVE_INFINITY", -Math.PI)
+testmath("Math.atan2", "Number.POSITIVE_INFINITY, 0", Math.PI/2)
+testmath("Math.atan2", "Number.POSITIVE_INFINITY, 1", Math.PI/2)
+testmath("Math.atan2", "Number.POSITIVE_INFINITY,-1", Math.PI/2)
+testmath("Math.atan2", "Number.POSITIVE_INFINITY,-0", Math.PI/2)
+testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 0", -Math.PI/2)
+testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-0", -Math.PI/2)
+testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 1", -Math.PI/2)
+testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-1", -Math.PI/2)
+testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY", Math.PI/4)
+testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY", 3*Math.PI/4)
+testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", -Math.PI/4)
+testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", -3*Math.PI/4)
+testmath("Math.atan2", "-1, 1", -Math.PI/4)
+
+testmath("Math.ceil", "Number.NaN", Number.NaN)
+testmath("Math.ceil", "null", 0)
+testmath("Math.ceil", "void 0", Number.NaN)
+testmath("Math.ceil", "'0'", 0)
+testmath("Math.ceil", "'-0'", -0)
+testmath("Infinity/Math.ceil", "'0'", Infinity)
+testmath("Infinity/Math.ceil", "'-0'", -Infinity)
+testmath("Math.ceil", "0", 0)
+testmath("Math.ceil", "-0", -0)
+testmath("Infinity/Math.ceil", "0", Infinity)
+testmath("Infinity/Math.ceil", "-0", -Infinity)
+testmath("Math.ceil", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.ceil", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
+testmath("Math.ceil", "-Number.MIN_VALUE", -0)
+testmath("Infinity/Math.ceil", "-Number.MIN_VALUE", -Infinity)
+testmath("Math.ceil", "1", 1)
+testmath("Math.ceil", "-1", -1)
+testmath("Math.ceil", "-0.9", -0)
+testmath("Infinity/Math.ceil", "-0.9", -Infinity)
+testmath("Math.ceil", "0.9", 1)
+testmath("Math.ceil", "-1.1", -1)
+testmath("Math.ceil", "1.1", 2)
+testmath("Math.ceil", "Number.POSITIVE_INFINITY", -Math.floor(-Infinity))
+testmath("Math.ceil", "Number.NEGATIVE_INFINITY", -Math.floor(Infinity))
+testmath("Math.ceil", "-Number.MIN_VALUE", -Math.floor(Number.MIN_VALUE))
+testmath("Math.ceil", "1", -Math.floor(-1))
+testmath("Math.ceil", "-1", -Math.floor(1))
+testmath("Math.ceil", "-0.9", -Math.floor(0.9))
+testmath("Math.ceil", "0.9", -Math.floor(-0.9))
+testmath("Math.ceil", "-1.1", -Math.floor(1.1))
+testmath("Math.ceil", "1.1", -Math.floor(-1.1))
+
+testmath("Math.cos", "void 0", Number.NaN)
+testmath("Math.cos", "false", 1)
+testmath("Math.cos", "null", 1)
+testmath("Math.cos", "'0'", 1)
+testmath("Math.cos", "\"Infinity\"", Number.NaN)
+testmath("Math.cos", "'3.14159265359'", -1)
+testmath("Math.cos", "Number.NaN", Number.NaN)
+testmath("Math.cos", "0", 1)
+testmath("Math.cos", "-0", 1)
+testmath("Math.cos", "Number.POSITIVE_INFINITY", Number.NaN)
+testmath("Math.cos", "Number.NEGATIVE_INFINITY", Number.NaN)
+testmath("Math.cos", "0.7853981633974", 0.7071067811865)
+testmath("Math.cos", "1.570796326795", 0)
+testmath("Math.cos", "2.356194490192", -0.7071067811865)
+testmath("Math.cos", "3.14159265359", -1)
+testmath("Math.cos", "3.926990816987", -0.7071067811865)
+testmath("Math.cos", "4.712388980385", 0)
+testmath("Math.cos", "5.497787143782", 0.7071067811865)
+testmath("Math.cos", "Math.PI*2", 1)
+testmath("Math.cos", "Math.PI/4", Math.SQRT2/2)
+testmath("Math.cos", "Math.PI/2", 0)
+testmath("Math.cos", "3*Math.PI/4", -Math.SQRT2/2)
+testmath("Math.cos", "Math.PI", -1)
+testmath("Math.cos", "5*Math.PI/4", -Math.SQRT2/2)
+testmath("Math.cos", "3*Math.PI/2", 0)
+testmath("Math.cos", "7*Math.PI/4", Math.SQRT2/2)
+testmath("Math.cos", "2*Math.PI", 1)
+testmath("Math.cos", "-0.7853981633974", 0.7071067811865)
+testmath("Math.cos", "-1.570796326795", 0)
+testmath("Math.cos", "2.3561944901920", -.7071067811865)
+testmath("Math.cos", "3.14159265359", -1)
+testmath("Math.cos", "3.926990816987", -0.7071067811865)
+testmath("Math.cos", "4.712388980385", 0)
+testmath("Math.cos", "5.497787143782", 0.7071067811865)
+testmath("Math.cos", "6.28318530718", 1)
+testmath("Math.cos", "-Math.PI/4", Math.SQRT2/2)
+testmath("Math.cos", "-Math.PI/2", 0)
+testmath("Math.cos", "-3*Math.PI/4", -Math.SQRT2/2)
+testmath("Math.cos", "-Math.PI", -1)
+testmath("Math.cos", "-5*Math.PI/4", -Math.SQRT2/2)
+testmath("Math.cos", "-3*Math.PI/2", 0)
+testmath("Math.cos", "-7*Math.PI/4", Math.SQRT2/2)
+testmath("Math.cos", "-Math.PI*2", 1)
+
+testmath("Math.exp", "null", 1)
+testmath("Math.exp", "void 0", Number.NaN)
+testmath("Math.exp", "1", Math.E)
+testmath("Math.exp", "true", Math.E)
+testmath("Math.exp", "false", 1)
+testmath("Math.exp", "'1'", Math.E)
+testmath("Math.exp", "'0'", 1)
+testmath("Math.exp", "Number.NaN", Number.NaN)
+testmath("Math.exp", "0", 1)
+testmath("Math.exp", "-0", 1)
+testmath("Math.exp", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.exp", "Number.NEGATIVE_INFINITY", 0)
+
+testmath("Math.floor", "void 0", Number.NaN)
+testmath("Math.floor", "null", 0)
+testmath("Math.floor", "true", 1)
+testmath("Math.floor", "false", 0)
+testmath("Math.floor", "\"1.1\"", 1)
+testmath("Math.floor", "\"-1.1\"", -2)
+testmath("Math.floor", "\"0.1\"", 0)
+testmath("Math.floor", "\"-0.1\"", -1)
+testmath("Math.floor", "Number.NaN", Number.NaN)
+testmath("Math.floor(Number.NaN) == -Math.ceil", "-Number.NaN", false)
+testmath("Math.floor", "0", 0)
+testmath("Math.floor(0) == -Math.ceil", "-0", true)
+testmath("Math.floor", "-0", -0)
+testmath("Infinity/Math.floor", "-0", -Infinity)
+testmath("Math.floor(-0)== -Math.ceil", "0", true)
+testmath("Math.floor", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil", "Number.NEGATIVE_INFINITY", true)
+testmath("Math.floor", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
+testmath("Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil", "Number.POSITIVE_INFINITY", true)
+testmath("Math.floor", "0.0000001", 0)
+testmath("Math.floor(0.0000001)==-Math.ceil", "-0.0000001", true)
+testmath("Math.floor", "-0.0000001", -1)
+testmath("Math.floor(-0.0000001)==-Math.ceil", "0.0000001", true)
+
+testmath("Math.log", "void 0", Number.NaN)
+testmath("Math.log", "null", Number.NEGATIVE_INFINITY)
+testmath("Math.log", "true", 0)
+testmath("Math.log", "false", -Infinity)
+testmath("Math.log", "'0'", -Infinity)
+testmath("Math.log", "'1'", 0)
+testmath("Math.log", "\"Infinity\"", Infinity)
+testmath("Math.log", "Number.NaN", Number.NaN)
+testmath("Math.log", "-0.000001", Number.NaN)
+testmath("Math.log", "-1", Number.NaN)
+testmath("Math.log", "0", Number.NEGATIVE_INFINITY)
+testmath("Math.log", "-0", Number.NEGATIVE_INFINITY)
+testmath("Math.log", "1", 0)
+testmath("Math.log", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.log", "Number.NEGATIVE_INFINITY", Number.NaN)
+
+testmath("Math.max", "void 0, 1", Number.NaN)
+testmath("Math.max", "void 0, void 0", Number.NaN)
+testmath("Math.max", "null, 1", 1)
+testmath("Math.max", "-1, null", 0)
+testmath("Math.max", "true,false", 1)
+testmath("Math.max", "\"-99\",\"99\"", 99)
+testmath("Math.max", "Number.NaN,Number.POSITIVE_INFINITY", Number.NaN)
+testmath("Math.max", "Number.NaN, 0", Number.NaN)
+testmath("Math.max", "\"a string\", 0", Number.NaN)
+testmath("Math.max", "Number.NaN,1", Number.NaN)
+testmath("Math.max", "\"a string\", Number.POSITIVE_INFINITY", Number.NaN)
+testmath("Math.max", "Number.POSITIVE_INFINITY, Number.NaN", Number.NaN)
+testmath("Math.max", "Number.NaN, Number.NaN", Number.NaN)
+testmath("Math.max", "0,Number.NaN", Number.NaN)
+testmath("Math.max", "1, Number.NaN", Number.NaN)
+testmath("Math.max", "0,0", 0)
+testmath("Math.max", "0,-0", 0)
+testmath("Math.max", "-0,0", 0)
+testmath("Math.max", "-0,-0", -0)
+testmath("Infinity/Math.max", "-0,-0", -Infinity)
+testmath("Math.max", "Number.POSITIVE_INFINITY, Number.MAX_VALUE", Number.POSITIVE_INFINITY)
+testmath("Math.max", "Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.max", "Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
+testmath("Math.max", "1,.99999999999999", 1)
+testmath("Math.max", "-1,-.99999999999999", -.99999999999999)
+
+testmath("Math.min", "void 0, 1", Number.NaN)
+testmath("Math.min", "void 0, void 0", Number.NaN)
+testmath("Math.min", "null, 1", 0)
+testmath("Math.min", "-1, null", -1)
+testmath("Math.min", "true,false", 0)
+testmath("Math.min", "\"-99\",\"99\"", -99)
+testmath("Math.min", "Number.NaN,0", Number.NaN)
+testmath("Math.min", "Number.NaN,1", Number.NaN)
+testmath("Math.min", "Number.NaN,-1", Number.NaN)
+testmath("Math.min", "0,Number.NaN", Number.NaN)
+testmath("Math.min", "1,Number.NaN", Number.NaN)
+testmath("Math.min", "-1,Number.NaN", Number.NaN)
+testmath("Math.min", "Number.NaN,Number.NaN", Number.NaN)
+testmath("Math.min", "1,1.0000000001", 1)
+testmath("Math.min", "1.0000000001,1", 1)
+testmath("Math.min", "0,0", 0)
+testmath("Math.min", "0,-0", -0)
+testmath("Math.min", "-0,-0", -0)
+testmath("Infinity/Math.min", "0,-0", -Infinity)
+testmath("Infinity/Math.min", "-0,-0", -Infinity)
+
+testmath("Math.pow", "null,null", 1)
+testmath("Math.pow", "void 0, void 0", Number.NaN)
+testmath("Math.pow", "true, false", 1)
+testmath("Math.pow", "false,true", 0)
+testmath("Math.pow", "'2','32'", 4294967296)
+testmath("Math.pow", "1,Number.NaN", Number.NaN)
+testmath("Math.pow", "0,Number.NaN", Number.NaN)
+testmath("Math.pow", "Number.NaN,0", 1)
+testmath("Math.pow", "Number.NaN,-0", 1)
+testmath("Math.pow", "Number.NaN, 1", Number.NaN)
+testmath("Math.pow", "Number.NaN, .5", Number.NaN)
+testmath("Math.pow", "1.00000001, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "1.00000001, Number.NEGATIVE_INFINITY", 0)
+testmath("Math.pow", "-1.00000001,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "-1.00000001,Number.NEGATIVE_INFINITY", 0)
+testmath("Math.pow", "1, Number.POSITIVE_INFINITY", Number.NaN)
+testmath("Math.pow", "1, Number.NEGATIVE_INFINITY", Number.NaN)
+testmath("Math.pow", "-1, Number.POSITIVE_INFINITY", Number.NaN)
+testmath("Math.pow", "-1, Number.NEGATIVE_INFINITY", Number.NaN)
+testmath("Math.pow", ".0000000009, Number.POSITIVE_INFINITY", 0)
+testmath("Math.pow", "-.0000000009, Number.POSITIVE_INFINITY", 0)
+testmath("Math.pow", "-.0000000009, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "Number.POSITIVE_INFINITY,.00000000001", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "Number.POSITIVE_INFINITY, 1", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "Number.POSITIVE_INFINITY, -.00000000001", 0)
+testmath("Math.pow", "Number.POSITIVE_INFINITY, -1", 0)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, 1", Number.NEGATIVE_INFINITY)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, 333", Number.NEGATIVE_INFINITY)
+testmath("Math.pow", "Number.POSITIVE_INFINITY, 2", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, 666", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, 0.5", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, -1", -0)
+testmath("Infinity/Math.pow", "Number.NEGATIVE_INFINITY, -1", -Infinity)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, -3", -0)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, -2", 0)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY,-0.5", 0)
+testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", 0)
+testmath("Math.pow", "0,1", 0)
+testmath("Math.pow", "0,0", 1)
+testmath("Math.pow", "1,0", 1)
+testmath("Math.pow", "-1,0", 1)
+testmath("Math.pow", "0,0.5", 0)
+testmath("Math.pow", "0,1000", 0)
+testmath("Math.pow", "0, Number.POSITIVE_INFINITY", 0)
+testmath("Math.pow", "0, -1", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "0, -0.5", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "0, -1000", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "0, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "-0, 1", -0)
+testmath("Math.pow", "-0,3", -0)
+testmath("Infinity/Math.pow", "-0, 1", -Infinity)
+testmath("Infinity/Math.pow", "-0,3", -Infinity)
+testmath("Math.pow", "-0,2", 0)
+testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0)
+testmath("Math.pow", "-0, -1", Number.NEGATIVE_INFINITY)
+testmath("Math.pow", "-0, -10001", Number.NEGATIVE_INFINITY)
+testmath("Math.pow", "-0, -2", Number.POSITIVE_INFINITY)
+testmath("Math.pow", "-0, 0.5", 0)
+testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0)
+testmath("Math.pow", "-1, 0.5", Number.NaN)
+testmath("Math.pow", "-1, Number.NaN", Number.NaN)
+testmath("Math.pow", "-1, -0.5", Number.NaN)
+
+testmath("Math.round", "0", 0)
+testmath("Math.round", "void 0", Number.NaN)
+testmath("Math.round", "true", 1)
+testmath("Math.round", "false", 0)
+testmath("Math.round", "'.99999'", 1)
+testmath("Math.round", "'12345e-2'", 123)
+testmath("Math.round", "Number.NaN", Number.NaN)
+testmath("Math.round", "0", 0)
+testmath("Math.round", "-0", -0)
+testmath("Infinity/Math.round", "-0", -Infinity)
+testmath("Math.round", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.round", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
+testmath("Math.round", "0.49", 0)
+testmath("Math.round", "0.5", 1)
+testmath("Math.round", "0.51", 1)
+testmath("Math.round", "-0.49", -0)
+testmath("Math.round", "-0.5", -0)
+testmath("Infinity/Math.round", "-0.49", -Infinity)
+testmath("Infinity/Math.round", "-0.5", -Infinity)
+testmath("Math.round", "-0.51", -1)
+testmath("Math.round", "3.5", 4)
+testmath("Math.round", "-3", -3)
+
+testmath("Math.sin", "null", 0)
+testmath("Math.sin", "void 0", Number.NaN)
+testmath("Math.sin", "false", 0)
+testmath("Math.sin", "'2.356194490192'", 0.7071067811865)
+testmath("Math.sin", "Number.NaN", Number.NaN)
+testmath("Math.sin", "0", 0)
+testmath("Math.sin", "-0", -0)
+testmath("Math.sin", "Number.POSITIVE_INFINITY", Number.NaN)
+testmath("Math.sin", "Number.NEGATIVE_INFINITY", Number.NaN)
+testmath("Math.sin", "0.7853981633974", 0.7071067811865)
+testmath("Math.sin", "1.570796326795", 1)
+testmath("Math.sin", "2.356194490192", 0.7071067811865)
+testmath("Math.sin", "3.14159265359", 0)
+
+testmath("Math.sqrt", "void 0", Number.NaN)
+testmath("Math.sqrt", "null", 0)
+testmath("Math.sqrt", "1", 1)
+testmath("Math.sqrt", "false", 0)
+testmath("Math.sqrt", "'225'", 15)
+testmath("Math.sqrt", "Number.NaN", Number.NaN)
+testmath("Math.sqrt", "Number.NEGATIVE_INFINITY", Number.NaN)
+testmath("Math.sqrt", "-1", Number.NaN)
+testmath("Math.sqrt", "-0.5", Number.NaN)
+testmath("Math.sqrt", "0", 0)
+testmath("Math.sqrt", "-0", -0)
+testmath("Infinity/Math.sqrt", "-0", -Infinity)
+testmath("Math.sqrt", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
+testmath("Math.sqrt", "1", 1)
+testmath("Math.sqrt", "2", Math.SQRT2)
+testmath("Math.sqrt", "0.5", Math.SQRT1_2)
+testmath("Math.sqrt", "4", 2)
+testmath("Math.sqrt", "9", 3)
+testmath("Math.sqrt", "16", 4)
+testmath("Math.sqrt", "25", 5)
+testmath("Math.sqrt", "36", 6)
+testmath("Math.sqrt", "49", 7)
+testmath("Math.sqrt", "64", 8)
+testmath("Math.sqrt", "256", 16)
+testmath("Math.sqrt", "10000", 100)
+testmath("Math.sqrt", "65536", 256)
+testmath("Math.sqrt", "0.09", 0.3)
+testmath("Math.sqrt", "0.01", 0.1)
+testmath("Math.sqrt", "0.00000001", 0.0001)
+
+testmath("Math.tan", "void 0", Number.NaN)
+testmath("Math.tan", "null", 0)
+testmath("Math.tan", "false", 0)
+testmath("Math.tan", "Number.NaN", Number.NaN)
+testmath("Math.tan", "0", 0)
+testmath("Math.tan", "-0", -0)
+testmath("Math.tan", "Number.POSITIVE_INFINITY", Number.NaN)
+testmath("Math.tan", "Number.NEGATIVE_INFINITY", Number.NaN)
+testmath("Math.tan", "Math.PI/4", 1)
+testmath("Math.tan", "3*Math.PI/4", -1)
+testmath("Math.tan", "Math.PI", -0)
+testmath("Math.tan", "5*Math.PI/4", 1)
+testmath("Math.tan", "7*Math.PI/4", -1)
+testmath("Infinity/Math.tan", "-0", -Infinity)
+
+
+/* Keep these at the end so that we can see the summary after the trace-debug spew. */
+if (0) {
+ print("\npassed:", passes.length && passes.join(","));
+ print("\nFAILED:", fails.length && fails.join(","));
+}
diff --git a/js/src/tests/js1_8_1/jit/regress-451673.js b/js/src/tests/js1_8_1/jit/regress-451673.js
new file mode 100644
index 000000000..415acdbc1
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-451673.js
@@ -0,0 +1,81 @@
+// |reftest| skip -- bogus perf test (bug 540512)
+/* -*- 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 = 451673;
+var summary = 'TM: Tracing prime number generation';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function doTest(enablejit)
+ {
+ if (enablejit)
+ else
+
+ var n = 1000000;
+ var start = new Date();
+ var i=0;
+ var j=0;
+ var numprimes=0;
+ var limit=0;
+ numprimes = 1; // 2 is prime
+ var mceil = Math.floor;
+ var msqrt = Math.sqrt;
+ var isPrime = 1;
+
+ for (i = 3; i<= n; i+=2)
+ {
+ isPrime=1;
+ limit = mceil(msqrt(i)+1) + 1;
+
+ for (j = 3; j < limit; j+=2)
+ {
+ if (i % j == 0)
+ {
+ isPrime = 0;
+ break;
+ }
+ }
+
+ if (isPrime)
+ {
+ numprimes ++;
+ }
+ }
+
+ var end = new Date();
+
+ var timetaken = end - start;
+ timetaken = timetaken / 1000;
+
+ if (enablejit)
+
+ print((enablejit ? ' JIT' : 'Non-JIT') + ": Number of primes up to: " + n + " is " + numprimes + ", counted in " + timetaken + " secs.");
+
+ return timetaken;
+ }
+
+ var timenonjit = doTest(false);
+ var timejit = doTest(true);
+
+ expect = true;
+ actual = timejit < timenonjit;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/jit/regress-451974-01.js b/js/src/tests/js1_8_1/jit/regress-451974-01.js
new file mode 100644
index 000000000..548695daf
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-451974-01.js
@@ -0,0 +1,52 @@
+// |reftest| skip -- bogus perf test (bug 540512)
+/* -*- 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 = 451974;
+var summary = 'TM: loops with anon functions should not be slower with jit enabled';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var chars = '0123456789abcdef';
+var size = 10000;
+var mult = 1000;
+var densearray = [];
+var lsize = size;
+
+while (lsize--)
+{
+ densearray.push(chars);
+}
+
+function loop()
+{
+ var start = new Date();
+
+ for (var a = 0; a < mult; a++)
+ {
+ var f = (function(x){});
+ for (var i = 0, len = densearray.length; i < len; i++)
+ {
+ f(densearray[i]);
+ }
+ }
+
+ var stop = new Date();
+ return stop - start;
+}
+
+var timenonjit = loop();
+var timejit = loop();
+
+print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
+
+expect = true;
+actual = timejit < timenonjit/2;
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_8_1/jit/regress-451974-02.js b/js/src/tests/js1_8_1/jit/regress-451974-02.js
new file mode 100644
index 000000000..ddb11713f
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-451974-02.js
@@ -0,0 +1,63 @@
+// |reftest| skip -- bogus perf test (bug 540512)
+/* -*- 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 = 451974;
+var summary = 'TM: loops with anon functions should not be slower with jit enabled';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var chars = '0123456789abcdef';
+ var size = 10000;
+ var mult = 1000;
+ var densearray = [];
+ var lsize = size;
+
+ while (lsize--)
+ {
+ densearray.push(chars);
+ }
+
+ function loop()
+ {
+ var start = new Date();
+
+ for (var a = 0; a < mult; a++)
+ {
+ var f = (function(x){});
+ for (var i = 0, len = densearray.length; i < len; i++)
+ {
+ f(densearray[i]);
+ }
+ }
+
+ var stop = new Date();
+ return stop - start;
+ }
+
+ var timenonjit = loop();
+ var timejit = loop();
+
+ print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
+
+ expect = true;
+ actual = timejit < timenonjit/2;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/jit/regress-452498-01.js b/js/src/tests/js1_8_1/jit/regress-452498-01.js
new file mode 100644
index 000000000..4ccd4476f
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-452498-01.js
@@ -0,0 +1,72 @@
+// |reftest| skip -- bogus perf test (bug 540512)
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2: jit heavyweight functions';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+function complex(aReal, aImag) {
+ this.r = aReal;
+ this.i = aImag;
+ this.square = function() {
+ return new complex(this.r * this.r - this.i * this.i,
+ 2 * this.r * this.i);
+ }
+ this.dist = function() {
+ return Math.sqrt(this.r * this.r + this.i * this.i);
+ }
+ this.add = function(aComplex) {
+ return new complex(this.r + aComplex.r, this.i + aComplex.i);
+ }
+}
+
+function mandelbrotValueOO (aC, aIterMax) {
+ let Z = new complex(0.0, 0.0);
+ for (var iter = 0; iter < aIterMax; iter++) {
+ Z = Z.square().add(aC);
+ if (Z.r * Z.r + Z.i * Z.i > 256) { break; }
+ }
+ return iter;
+}
+
+function f(trace) {
+ var start = Date.now();
+ const width = 60;
+ const height = 60;
+ const max_iters = 50;
+ var output = [];
+ for (let img_x = 0; img_x < width; img_x++) {
+ for (let img_y = 0; img_y < height; img_y++) {
+ let C = new complex(-2 + (img_x / width) * 3,
+ -1.5 + (img_y / height) * 3);
+ var res = mandelbrotValueOO(C, max_iters);
+ if (output.length > 0 && output[output.length -1][0] == res) {
+ output[output.length-1][1]++;
+ } else {
+ output.push([res, 1]);
+ }
+ }
+ }
+ const reference = "[[2, 6], [3, 17], [4, 6], [5, 1], [50, 1], [5, 1], [4, 6], [3, 17], [2, 10], [3, 17], [4, 6], [5, 1], [6, 1], [50, 1], [6, 1], [5, 1], [4, 6], [3, 17], [2, 8], [3, 17], [4, 6], [5, 2], [6, 1], [50, 1], [6, 1], [5, 2], [4, 6], [3, 17], [2, 6], [3, 17], [4, 6], [5, 2], [6, 1], [7, 1], [50, 1], [7, 1], [6, 1], [5, 2], [4, 6], [3, 17], [2, 4], [3, 17], [4, 7], [5, 2], [6, 1], [8, 1], [50, 1], [8, 1], [6, 1], [5, 2], [4, 7], [3, 17], [2, 2], [3, 17], [4, 7], [5, 3], [6, 1], [9, 1], [50, 1], [9, 1], [6, 1], [5, 3], [4, 7], [3, 17], [2, 1], [3, 16], [4, 7], [5, 3], [6, 2], [8, 1], [50, 1], [8, 1], [6, 2], [5, 3], [4, 7], [3, 32], [4, 7], [5, 4], [6, 1], [7, 1], [8, 1], [50, 1], [8, 1], [7, 1], [6, 1], [5, 4], [4, 7], [3, 31], [4, 7], [5, 3], [6, 2], [7, 1], [8, 1], [50, 1], [8, 1], [7, 1], [6, 2], [5, 3], [4, 7], [3, 30], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [50, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 28], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [10, 1], [50, 1], [10, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 26], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [9, 1], [11, 1], [50, 1], [11, 1], [9, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 25], [4, 6], [5, 3], [6, 3], [7, 1], [8, 1], [18, 1], [13, 1], [15, 1], [50, 1], [15, 1], [13, 1], [18, 1], [8, 1], [7, 1], [6, 3], [5, 3], [4, 6], [3, 24], [4, 7], [5, 2], [6, 2], [7, 3], [8, 1], [10, 1], [14, 1], [50, 3], [14, 1], [10, 1], [8, 1], [7, 3], [6, 2], [5, 2], [4, 7], [3, 23], [4, 6], [5, 3], [7, 1], [8, 1], [9, 1], [8, 2], [10, 1], [11, 1], [15, 1], [50, 3], [15, 1], [11, 1], [10, 1], [8, 2], [9, 1], [8, 1], [7, 1], [5, 3], [4, 6], [3, 22], [4, 7], [5, 2], [6, 1], [7, 1], [14, 1], [16, 1], [11, 1], [10, 1], [12, 1], [20, 1], [23, 1], [46, 1], [50, 1], [46, 1], [23, 1], [20, 1], [12, 1], [10, 1], [11, 1], [16, 1], [14, 1], [7, 1], [6, 1], [5, 2], [4, 7], [3, 20], [4, 7], [5, 3], [6, 1], [7, 1], [8, 1], [10, 1], [17, 1], [16, 1], [20, 1], [50, 7], [20, 1], [16, 1], [17, 1], [10, 1], [8, 1], [7, 1], [6, 1], [5, 3], [4, 7], [3, 19], [4, 7], [5, 3], [6, 2], [7, 1], [10, 1], [21, 1], [50, 11], [21, 1], [10, 1], [7, 1], [6, 2], [5, 3], [4, 7], [3, 18], [4, 7], [5, 4], [6, 1], [7, 1], [8, 1], [9, 1], [13, 1], [25, 1], [50, 9], [25, 1], [13, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 4], [4, 7], [3, 17], [4, 7], [5, 4], [6, 1], [7, 1], [8, 1], [14, 2], [50, 11], [14, 2], [8, 1], [7, 1], [6, 1], [5, 4], [4, 7], [3, 16], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [11, 1], [36, 1], [50, 11], [36, 1], [11, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 15], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [9, 1], [14, 1], [50, 11], [14, 1], [9, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 14], [4, 7], [5, 4], [6, 3], [7, 1], [8, 1], [9, 1], [12, 1], [26, 1], [50, 9], [26, 1], [12, 1], [9, 1], [8, 1], [7, 1], [6, 3], [5, 4], [4, 7], [3, 13], [4, 7], [5, 4], [6, 2], [7, 2], [8, 1], [9, 1], [10, 1], [15, 1], [50, 9], [15, 1], [10, 1], [9, 1], [8, 1], [7, 2], [6, 2], [5, 4], [4, 7], [3, 12], [4, 7], [5, 4], [6, 3], [7, 1], [8, 2], [9, 1], [10, 1], [12, 1], [16, 1], [50, 7], [16, 1], [12, 1], [10, 1], [9, 1], [8, 2], [7, 1], [6, 3], [5, 4], [4, 7], [3, 11], [4, 6], [5, 4], [6, 3], [7, 1], [8, 2], [9, 1], [11, 1], [12, 1], [14, 1], [17, 1], [23, 1], [34, 1], [50, 3], [34, 1], [23, 1], [17, 1], [14, 1], [12, 1], [11, 1], [9, 1], [8, 2], [7, 1], [6, 3], [5, 4], [4, 6], [3, 10], [4, 7], [5, 3], [6, 2], [7, 2], [8, 1], [9, 1], [22, 1], [12, 1], [50, 1], [25, 1], [50, 11], [25, 1], [50, 1], [12, 1], [22, 1], [9, 1], [8, 1], [7, 2], [6, 2], [5, 3], [4, 7], [3, 9], [4, 6], [5, 4], [6, 1], [7, 1], [8, 2], [9, 1], [14, 1], [50, 1], [21, 1], [50, 15], [21, 1], [50, 1], [14, 1], [9, 1], [8, 2], [7, 1], [6, 1], [5, 4], [4, 6], [3, 8], [4, 7], [5, 3], [6, 2], [9, 1], [14, 1], [13, 1], [11, 1], [13, 1], [26, 1], [50, 17], [26, 1], [13, 1], [11, 1], [13, 1], [14, 1], [9, 1], [6, 2], [5, 3], [4, 7], [3, 7], [4, 6], [5, 4], [6, 1], [7, 1], [9, 1], [49, 1], [43, 1], [50, 23], [43, 1], [49, 1], [9, 1], [7, 1], [6, 1], [5, 4], [4, 6], [3, 7], [4, 5], [5, 4], [6, 2], [7, 1], [9, 1], [13, 1], [50, 25], [13, 1], [9, 1], [7, 1], [6, 2], [5, 4], [4, 5], [3, 6], [4, 6], [5, 3], [6, 2], [7, 2], [9, 1], [11, 1], [17, 1], [50, 23], [17, 1], [11, 1], [9, 1], [7, 2], [6, 2], [5, 3], [4, 6], [3, 5], [4, 5], [5, 3], [6, 3], [7, 1], [8, 1], [9, 1], [50, 1], [26, 1], [50, 23], [26, 1], [50, 1], [9, 1], [8, 1], [7, 1], [6, 3], [5, 3], [4, 5], [3, 5], [4, 4], [5, 3], [6, 3], [7, 1], [8, 2], [10, 1], [21, 1], [50, 25], [21, 1], [10, 1], [8, 2], [7, 1], [6, 3], [5, 3], [4, 4], [3, 5], [4, 4], [5, 2], [6, 3], [7, 1], [12, 1], [9, 1], [10, 1], [11, 1], [50, 27], [11, 1], [10, 1], [9, 1], [12, 1], [7, 1], [6, 3], [5, 2], [4, 4], [3, 5], [4, 3], [5, 2], [6, 2], [7, 2], [9, 1], [42, 1], [15, 1], [23, 1], [14, 1], [50, 27], [14, 1], [23, 1], [15, 1], [42, 1], [9, 1], [7, 2], [6, 2], [5, 2], [4, 3], [3, 5], [4, 3], [5, 1], [6, 1], [20, 1], [9, 1], [8, 1], [9, 1], [10, 1], [16, 1], [50, 33], [16, 1], [10, 1], [9, 1], [8, 1], [9, 1], [20, 1], [6, 1], [5, 1], [4, 3], [3, 5], [4, 3], [5, 1], [6, 1], [9, 1], [13, 1], [12, 1], [11, 1], [38, 1], [25, 1], [50, 33], [25, 1], [38, 1], [11, 1], [12, 1], [13, 1], [9, 1], [6, 1], [5, 1], [4, 3], [3, 5], [4, 3], [5, 2], [6, 1], [7, 1], [10, 1], [24, 1], [25, 1], [50, 35], [25, 1], [24, 1], [10, 1], [7, 1], [6, 1], [5, 2], [4, 3], [3, 5], [4, 4], [5, 1], [6, 1], [7, 1], [11, 2], [13, 1], [19, 1], [50, 33], [19, 1], [13, 1], [11, 2], [7, 1], [6, 1], [5, 1], [4, 4], [3, 5], [4, 4], [5, 2], [6, 1], [50, 1], [8, 2], [17, 1], [19, 1], [35, 1], [14, 1], [24, 1], [50, 25], [24, 1], [14, 1], [35, 1], [19, 1], [17, 1], [8, 2], [50, 1], [6, 1], [5, 2], [4, 4], [3, 5], [4, 5], [5, 2], [6, 2], [7, 1], [8, 1], [9, 2], [11, 1], [38, 1], [50, 25], [38, 1], [11, 1], [9, 2], [8, 1], [7, 1], [6, 2], [5, 2], [4, 5], [3, 6], [4, 4], [5, 3], [6, 2], [7, 2], [8, 1], [9, 1], [15, 1], [50, 25], [15, 1], [9, 1], [8, 1], [7, 2], [6, 2], [5, 3], [4, 4], [3, 7], [4, 5], [5, 3], [6, 3], [7, 1], [9, 1], [42, 1], [21, 1], [50, 23], [21, 1], [42, 1], [9, 1], [7, 1], [6, 3], [5, 3], [4, 5], [3, 8], [4, 5], [5, 3], [6, 2], [7, 1], [8, 1], [9, 1], [13, 1], [50, 23], [13, 1], [9, 1], [8, 1], [7, 1], [6, 2], [5, 3], [4, 5], [3, 9], [4, 6], [5, 3], [6, 2], [7, 1], [9, 1], [14, 1], [50, 23], [14, 1], [9, 1], [7, 1], [6, 2], [5, 3], [4, 6], [3, 10], [4, 6], [5, 3], [6, 1], [7, 1], [9, 1], [16, 1], [50, 2], [35, 1], [50, 8], [13, 1], [50, 8], [35, 1], [50, 2], [16, 1], [9, 1], [7, 1], [6, 1], [5, 3], [4, 6], [3, 12], [4, 6], [5, 2], [6, 1], [19, 1], [16, 1], [17, 1], [25, 1], [21, 1], [13, 1], [18, 1], [50, 6], [11, 1], [9, 1], [11, 1], [50, 6], [18, 1], [13, 1], [21, 1], [25, 1], [17, 1], [16, 1], [19, 1], [6, 1], [5, 2], [4, 6], [3, 14], [4, 5], [5, 3], [6, 1], [8, 1], [16, 1], [10, 1], [8, 2], [11, 1], [50, 1], [16, 1], [15, 1], [32, 1], [29, 1], [9, 1], [8, 1], [7, 1], [8, 1], [9, 1], [29, 1], [32, 1], [15, 1], [16, 1], [50, 1], [11, 1], [8, 2], [10, 1], [16, 1], [8, 1], [6, 1], [5, 3], [4, 5], [3, 15], [4, 6], [5, 3], [6, 4], [7, 1], [20, 1], [19, 1], [9, 3], [7, 3], [6, 1], [7, 3], [9, 3], [19, 1], [20, 1], [7, 1], [6, 4], [5, 3], [4, 6], [3, 16], [4, 7], [5, 4], [6, 3], [7, 1], [6, 13], [7, 1], [6, 3], [5, 4], [4, 7], [3, 18], [4, 7], [5, 27], [4, 7], [3, 20], [4, 9], [5, 21], [4, 9], [3, 23], [4, 12], [5, 11], [4, 12], [3, 26], [4, 33], [3, 29], [4, 29], [3, 33], [4, 25], [3, 38], [4, 19], [3, 20], [2, 1], [3, 26], [4, 7], [3, 26], [2, 2], [3, 57], [2, 1]]";
+ reportCompare(reference, output.toSource(), summary + ': correctness jit=' + trace);
+ return (Date.now() - start);
+}
+
+
+var timenonjit = f(false);
+var timejit = f(true);
+
+expect = true;
+actual = timejit < timenonjit;
+
+print('time nonjit: ' + timenonjit + ', time jit: ' + timejit);
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_8_1/jit/regress-458838.js b/js/src/tests/js1_8_1/jit/regress-458838.js
new file mode 100644
index 000000000..b8b19f2d4
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-458838.js
@@ -0,0 +1,63 @@
+/* -*- 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 = 458838;
+var summary = 'TM: do not fall off trace when nested function accesses var of outer function';
+var actual = '';
+var expect = '';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+
+ function f() {
+ var a = 1;
+ function g() {
+ var b = 0
+ for (var i = 0; i < 10; ++i) {
+ b += a;
+ }
+ return b;
+ }
+
+ return g();
+ }
+
+ expect = 10;
+ actual = f();
+
+ var recorderStarted;
+ var recorderAborted;
+ var traceCompleted;
+ var skip = true;
+
+ if (this.tracemonkey && !this.tracemonkey.adaptive)
+ {
+ recorderStarted = this.tracemonkey.recorderStarted;
+ recorderAborted = this.tracemonkey.recorderAborted;
+ traceCompleted = this.tracemonkey.traceCompleted;
+ skip = false;
+ }
+
+
+ reportCompare(expect, actual, summary + ': return value 10');
+
+ if (!skip)
+ {
+ expect = 'recorderStarted=1, recorderAborted=0, traceCompleted=1';
+ actual = 'recorderStarted=' + recorderStarted + ', recorderAborted=' + recorderAborted + ', traceCompleted=' + traceCompleted;
+ reportCompare(expect, actual, summary + ': trace');
+ }
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-01.js b/js/src/tests/js1_8_1/jit/regress-462459-01.js
new file mode 100644
index 000000000..97c8a055d
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-01.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace Array()';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ Array();
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-02.js b/js/src/tests/js1_8_1/jit/regress-462459-02.js
new file mode 100644
index 000000000..a1836af61
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-02.js
@@ -0,0 +1,70 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace Array(1)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ Array(1);
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-03.js b/js/src/tests/js1_8_1/jit/regress-462459-03.js
new file mode 100644
index 000000000..a6b55e301
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-03.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace Array(1, 2)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ Array(1, 2);
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-04.js b/js/src/tests/js1_8_1/jit/regress-462459-04.js
new file mode 100644
index 000000000..28e0a02e7
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-04.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace Array(1, 2, 3)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ Array(1, 2, 3);
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-05.js b/js/src/tests/js1_8_1/jit/regress-462459-05.js
new file mode 100644
index 000000000..7f8e5539c
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-05.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace new Array()';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ new Array();
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-06.js b/js/src/tests/js1_8_1/jit/regress-462459-06.js
new file mode 100644
index 000000000..a43dc0de0
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-06.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace new Array(1)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ new Array(1);
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-07.js b/js/src/tests/js1_8_1/jit/regress-462459-07.js
new file mode 100644
index 000000000..c1349c696
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-07.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace new Array(1, 2)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ new Array(1, 2);
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-08.js b/js/src/tests/js1_8_1/jit/regress-462459-08.js
new file mode 100644
index 000000000..4d3431495
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-08.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace new Array(1, 2, 3)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ new Array(1, 2, 3);
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-09.js b/js/src/tests/js1_8_1/jit/regress-462459-09.js
new file mode 100644
index 000000000..40c3c7961
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-09.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace []';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ [];
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-10.js b/js/src/tests/js1_8_1/jit/regress-462459-10.js
new file mode 100644
index 000000000..6d6c3e3f4
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-10.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace [1]';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ [1];
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-11.js b/js/src/tests/js1_8_1/jit/regress-462459-11.js
new file mode 100644
index 000000000..9d4ca8461
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-11.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace [1, 2]';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ [1, 2];
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-462459-12.js b/js/src/tests/js1_8_1/jit/regress-462459-12.js
new file mode 100644
index 000000000..c0f2d5e0b
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-462459-12.js
@@ -0,0 +1,71 @@
+/* -*- 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 = 462459;
+var summary = 'TM: trace [1, 2, 3]';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+if (!this.tracemonkey || this.tracemonkey.adaptive)
+{
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
+ reportCompare(expect, actual, summary);
+}
+else
+{
+
+ expect = 'recorder started, recorder not aborted, trace completed';
+ actual = '';
+
+ var recorderStartedStart = this.tracemonkey.recorderStarted;
+ var recorderAbortedStart = this.tracemonkey.recorderAborted;
+ var traceCompletedStart = this.tracemonkey.traceCompleted;
+
+
+ for (var i = 0; i < RUNLOOP; i++)
+ {
+ [1, 2, 3];
+ }
+
+
+ var recorderStartedEnd = this.tracemonkey.recorderStarted;
+ var recorderAbortedEnd = this.tracemonkey.recorderAborted;
+ var traceCompletedEnd = this.tracemonkey.traceCompleted;
+
+ if (recorderStartedEnd > recorderStartedStart)
+ {
+ actual = 'recorder started, ';
+ }
+ else
+ {
+ actual = 'recorder not started, ';
+ }
+
+ if (recorderAbortedEnd > recorderAbortedStart)
+ {
+ actual += 'recorder aborted, ';
+ }
+ else
+ {
+ actual += 'recorder not aborted, ';
+ }
+
+ if (traceCompletedEnd > traceCompletedStart)
+ {
+ actual += 'trace completed';
+ }
+ else
+ {
+ actual += 'trace not completed';
+ }
+
+ reportCompare(expect, actual, summary);
+}
+
diff --git a/js/src/tests/js1_8_1/jit/regress-469927.js b/js/src/tests/js1_8_1/jit/regress-469927.js
new file mode 100644
index 000000000..01d208abb
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-469927.js
@@ -0,0 +1,44 @@
+// |reftest| skip -- bogus perf test (bug 540512)
+/* -*- 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 = 469927;
+var summary = 'TM: jit should not slow down short loop with let';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function letitbe() {
+ var start = new Date();
+ for (let i = 0; i < 500000; ++i) {
+ for (let j = 0; j < 4; ++j) { }
+ }
+ var stop = new Date();
+ return stop - start;
+ }
+
+ var timenonjit = letitbe();
+ var timejit = letitbe();
+
+ print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
+
+ expect = true;
+ actual = timejit < timenonjit;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/jit/regress-470739.js b/js/src/tests/js1_8_1/jit/regress-470739.js
new file mode 100644
index 000000000..8e8d2c5d0
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-470739.js
@@ -0,0 +1,46 @@
+// |reftest| skip -- bogus perf test (bug 540512)
+/* -*- 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 = 470739;
+var summary = 'TM: never abort on ==';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function loop()
+ {
+ var i;
+ var start = new Date();
+
+ for(i=0;i<500000;++i) { var r = (void 0) == null; }
+
+ var stop = new Date();
+ return stop - start;
+ }
+
+ var timenonjit = loop();
+ var timejit = loop();
+
+ print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
+
+ expect = true;
+ actual = timejit < timenonjit;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/jit/regress-471635.js b/js/src/tests/js1_8_1/jit/regress-471635.js
new file mode 100644
index 000000000..c37a9e9fb
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-471635.js
@@ -0,0 +1,56 @@
+/* -*- 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 = 471635;
+var summary = 'TM: trace js shell print()';
+var actual = '';
+var expect = '';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+
+ (function(){
+ for (var i = 1; i < 20; ++i) {
+ print("#");
+ }
+ })();
+
+ var recorderStarted;
+ var recorderAborted;
+ var traceCompleted;
+ var skip = true;
+
+ if (this.tracemonkey && !this.tracemonkey.adaptive)
+ {
+ recorderStarted = this.tracemonkey.recorderStarted;
+ recorderAborted = this.tracemonkey.recorderAborted;
+ traceCompleted = this.tracemonkey.traceCompleted;
+ skip = false;
+ }
+
+
+ if (!skip)
+ {
+ expect = 'recorderStarted=1, recorderAborted=0, traceCompleted=1';
+ actual = 'recorderStarted=' + recorderStarted + ', recorderAborted=' + recorderAborted + ', traceCompleted=' + traceCompleted;
+ }
+ else
+ {
+ expect = actual = 'Test skipped due to lack of tracemonkey jitstats object.';
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/jit/regress-489682.js b/js/src/tests/js1_8_1/jit/regress-489682.js
new file mode 100644
index 000000000..fd5dee8a9
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/regress-489682.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 489682;
+var summary = 'TM: wrong number with nested type-unstable loops';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+var v = 0;
+
+for each (var a in [0, {}, {}, {}]) {
+ print(v);
+ v = v >>> 0;
+ for each (var b in [{}, {}, new String(''), 42, new String(''), {}, 42])
+ {
+ }
+ }
+print(v);
+
+
+expect = '0';
+actual = v + '';
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_8_1/jit/shell.js b/js/src/tests/js1_8_1/jit/shell.js
new file mode 100644
index 000000000..63f283b96
--- /dev/null
+++ b/js/src/tests/js1_8_1/jit/shell.js
@@ -0,0 +1,4 @@
+// The loop count at which we trace
+const RECORDLOOP = this.tracemonkey ? tracemonkey.HOTLOOP : 8;
+// The loop count at which we run the trace
+const RUNLOOP = RECORDLOOP + 1;
diff --git a/js/src/tests/js1_8_1/regress/browser.js b/js/src/tests/js1_8_1/regress/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/browser.js
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-006.js b/js/src/tests/js1_8_1/regress/regress-452498-006.js
new file mode 100644
index 000000000..63fffd211
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-006.js
@@ -0,0 +1,45 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #6 From Andreas Gal :gal
+
+ function foo() {
+ var x = 4;
+ var f = (function() { return x++; });
+ var g = (function() { return x++; });
+ return [f,g];
+ }
+
+ var bar = foo();
+
+ expect = '9';
+ actual = 0;
+
+ bar[0]();
+ bar[1]();
+
+ actual = String(expect);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-027.js b/js/src/tests/js1_8_1/regress/regress-452498-027.js
new file mode 100644
index 000000000..3583fa03b
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-027.js
@@ -0,0 +1,38 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = '5';
+
+// ------- Comment #27 From Brendan Eich
+
+ function f(x){function g(y)x+y;return g}
+ g = f(2);
+
+ actual = String(g(3));
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
+
+
+
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-030.js b/js/src/tests/js1_8_1/regress/regress-452498-030.js
new file mode 100644
index 000000000..1d8b41908
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-030.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #30 From Mike Shaver
+
+ function f() { var i = 0; var i = 5; }
+ f();
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-040.js b/js/src/tests/js1_8_1/regress/regress-452498-040.js
new file mode 100644
index 000000000..8bd97207a
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-040.js
@@ -0,0 +1,37 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #40 From Jesse Ruderman
+
+ function m()
+ {
+ function a() { }
+ function b() { a(); }
+ this.c = function () { b(); }
+ }
+ (new m).c();
+
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-050.js b/js/src/tests/js1_8_1/regress/regress-452498-050.js
new file mode 100644
index 000000000..309242a62
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-050.js
@@ -0,0 +1,43 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #50 From Jason Orendorff
+
+// Do not crash
+
+// compiler bug when a block introduces no names
+ { let {}={}; }
+
+ try
+ {
+// compiler incorrectly emits GETLOCAL for first `x`,
+// triggering decompiler assertion
+ while (x.y) { let x; }
+ }
+ catch(ex)
+ {
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-051.js b/js/src/tests/js1_8_1/regress/regress-452498-051.js
new file mode 100644
index 000000000..cd5554e74
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-051.js
@@ -0,0 +1,48 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #51 From Jason Orendorff
+
+// Assertion failure: UPVAR_FRAME_SKIP(uva->vector[i]) == 0
+// at ../jsopcode.cpp:2791
+//
+// when decompiling the eval code, which is:
+//
+// main:
+// 00000: 10 getupvar 0
+// 00003: 10 getprop "y"
+// 00006: 10 popv
+// 00007: 10 stop
+ try
+ {
+ function f() { var x; eval("x.y"); }
+ f();
+ }
+ catch(ex)
+ {
+ }
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-052-a.js b/js/src/tests/js1_8_1/regress/regress-452498-052-a.js
new file mode 100644
index 000000000..0f55d9324
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-052-a.js
@@ -0,0 +1,42 @@
+// |reftest| skip-if(Android)
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #52 From Jason Orendorff
+
+
+// Assertion failure: pn_arity == PN_FUNC || pn_arity == PN_NAME, at ../jsparse.h:444
+// Here the function node has been morphed into a JSOP_TRUE node, but we're in
+// FindFunArgs poking it anyway.
+ if (typeof timeout == 'function')
+ {
+ expectExitCode(6);
+ timeout(3);
+ while(function(){});
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-053.js b/js/src/tests/js1_8_1/regress/regress-452498-053.js
new file mode 100644
index 000000000..9f70a0f74
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-053.js
@@ -0,0 +1,80 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #53 From Jason Orendorff
+
+// Assertion failure: (slot) < (uint32_t)(obj)->dslots[-1]
+// at ../jsobj.cpp:5559
+// On the last line of BindLet, we have
+// JS_SetReservedSlot(cx, blockObj, index, PRIVATE_TO_JSVAL(pn));
+// but this uses reserved slots as though they were unlimited.
+// blockObj only has 2.
+ { let a=0, b=1, c=2; }
+
+// In RecycleTree at ../jsparse.cpp:315, we hit
+// MOZ_CRASH("RecycleUseDefKids");
+// pn->pn_type is TOK_UNARYOP
+// pn->pn_op is JSOP_XMLNAME
+// pn->pn_defn is 1
+// pn->pn_used is 1
+ try
+ {
+ true; 0;
+ }
+ catch(ex)
+ {
+ }
+// Calls LinkUseToDef with pn->pn_defn == 1.
+//
+// If you say "var x;" first, then run this case, it gets further,
+// crashing in NoteLValue like the first case in comment 52.
+//
+ try
+ {
+ for (var [x] in y) var x;
+ }
+ catch(ex)
+ {
+ }
+// Assertion failure: !pn2->pn_defn, at ../jsparse.h:461
+// Another case where some optimization is going on.
+ try
+ {
+ if (true && foo) ;
+ }
+ catch(ex)
+ {
+ }
+// Assertion failure: scope->object == ctor
+// in js_FastNewObject at ../jsbuiltins.cpp:237
+//
+// With the patch, we're new-ing a different function each time, and the
+// .prototype property is missing.
+//
+ for (var z = 0; z < 3; z++) { (new function(){}); }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-058.js b/js/src/tests/js1_8_1/regress/regress-452498-058.js
new file mode 100644
index 000000000..ac2ba0f7a
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-058.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #58 From Gary Kwong [:nth10sd]
+
+ function foo(x) { var x = x }
+
+// Assertion failure: dn->kind() == ((data->op == JSOP_DEFCONST) ? JSDefinition::CONST : JSDefinition::VAR), at ../jsparse.cpp:2595
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-062.js b/js/src/tests/js1_8_1/regress/regress-452498-062.js
new file mode 100644
index 000000000..f28c29bbf
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-062.js
@@ -0,0 +1,44 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #62 From Gary Kwong [:nth10sd]
+
+ try
+ {
+ eval(
+ '(function(){' +
+ ' var x;' +
+ ' this.init_by_array = function()' +
+ ' x = 0;' +
+ '})();'
+ );
+ }
+ catch(ex)
+ {
+ }
+
+// Assertion failure: ATOM_IS_STRING(atom), at ../jsinterp.cpp:5686
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-063.js b/js/src/tests/js1_8_1/regress/regress-452498-063.js
new file mode 100644
index 000000000..970dfeca6
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-063.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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #63 From Brendan Eich
+
+ function f(that) {
+ for (ix in this)
+ print(ix);
+ for (let ix in that)
+ ;
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-071.js b/js/src/tests/js1_8_1/regress/regress-452498-071.js
new file mode 100644
index 000000000..647677877
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-071.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #71 From Jesse Ruderman
+
+ x; var x
+// Assertion failure: pn->pn_op == JSOP_NOP, at ../jsparse.cpp:1118
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-072.js b/js/src/tests/js1_8_1/regress/regress-452498-072.js
new file mode 100644
index 000000000..99e540c77
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-072.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #72 From Jesse Ruderman
+
+ v = function p() { delete p; };
+// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1711
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-073.js b/js/src/tests/js1_8_1/regress/regress-452498-073.js
new file mode 100644
index 000000000..9de10e87b
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-073.js
@@ -0,0 +1,38 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #73 From Jesse Ruderman
+
+ try
+ {
+ eval('function() { var arguments }');
+ }
+ catch(ex)
+ {
+ }
+
+// Assertion failure: (uintN)i < ss->top, at ../jsopcode.cpp:2801
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-074.js b/js/src/tests/js1_8_1/regress/regress-452498-074.js
new file mode 100644
index 000000000..d7f920d4a
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-074.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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = '1';
+
+// ------- Comment #74 From Jesse Ruderman
+
+ const [d] = [1]; print(actual = d);
+
+ actual = String(actual);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-075.js b/js/src/tests/js1_8_1/regress/regress-452498-075.js
new file mode 100644
index 000000000..7b5945719
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-075.js
@@ -0,0 +1,32 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #75 From Jesse Ruderman
+
+ (function p(){ p = 3; });
+ (function p(){ p = 3; return p; })()
+// Assertion failure: regs.sp == StackBase(fp), at ../jsinterp.cpp:2980
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-076.js b/js/src/tests/js1_8_1/regress/regress-452498-076.js
new file mode 100644
index 000000000..925f3db03
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-076.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #76 From Jesse Ruderman
+
+ for (let d = 0; d < 4; ++d) { d; }
+// 1: ReferenceError: d is not defined
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-079.js b/js/src/tests/js1_8_1/regress/regress-452498-079.js
new file mode 100644
index 000000000..d8b3a1f1d
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-079.js
@@ -0,0 +1,34 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #79 From Jason Orendorff
+
+ x; var x; function x() 0
+
+// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:635
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-082.js b/js/src/tests/js1_8_1/regress/regress-452498-082.js
new file mode 100644
index 000000000..5568cf8f5
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-082.js
@@ -0,0 +1,84 @@
+/* -*- tab-width: 2; 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #82 From Gary Kwong [:nth10sd]
+
+// =====
+
+ (function(){function x(){} {let x = [] }});
+
+// =====
+
+ var f = new Function("new function x(){ return x |= function(){} } ([], function(){})");
+ "" + f;
+
+// =====
+
+ uneval(function(){[y] = [x];});
+
+// =====
+
+ function g(code)
+ {
+ var f = new Function(code);
+ f();
+ }
+ g("for (var x = 0; x < 3; ++x)(new (function(){})());");
+
+// =====
+ try
+ {
+ eval(
+ 'for(let [\n' +
+ 'function x () { M:if([1,,]) }\n'
+ );
+ }
+ catch(ex)
+ {
+ }
+
+// =====
+
+ try
+ {
+ function foo(code)
+ {
+ var c;
+ eval("const c, x5 = c;");
+ }
+ foo();
+ }
+ catch(ex)
+ {
+ }
+
+// =====
+
+ var f = new Function("[] = [( '' )()];");
+ "" + f;
+
+// =====
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-092.js b/js/src/tests/js1_8_1/regress/regress-452498-092.js
new file mode 100644
index 000000000..54d42c8af
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-092.js
@@ -0,0 +1,40 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #92 From Jesse Ruderman
+
+ expect = 'SyntaxError: redeclaration of formal parameter e';
+ try
+ {
+ eval('(function (e) { var e; const e = undefined; });');
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+// Without patch: "SyntaxError: redeclaration of var e"
+// expected new behavior // With patch: "SyntaxError: redeclaration of formal parameter e:"
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-101.js b/js/src/tests/js1_8_1/regress/regress-452498-101.js
new file mode 100644
index 000000000..5bd15b2b7
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-101.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #101 From Gary Kwong [:nth10sd]
+
+ uneval(function(){with({functional: []}){x5, y = this;const y = undefined }});
+// Assertion failure: strcmp(rval, with_cookie) == 0, at ../jsopcode.cpp:2567
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-102.js b/js/src/tests/js1_8_1/regress/regress-452498-102.js
new file mode 100644
index 000000000..0aa60e4ec
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-102.js
@@ -0,0 +1,69 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #102 From Gary Kwong [:nth10sd]
+
+// =====
+
+ (function(){function x(){} function x()y})();
+
+// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710
+
+// =====
+ function f() {
+ "" + (function(){
+ for( ; [function(){}] ; x = 0)
+ with({x: ""}) {
+ const x = []
+ }});
+ }
+ f();
+
+// Assertion failure: ss->top - saveTop <= 1U, at ../jsopcode.cpp:2156
+
+// =====
+
+ try
+ {
+ function f() {
+ var x;
+ eval("const x = [];");
+ }
+ f();
+ }
+ catch(ex)
+ {
+ }
+// Assertion failure: regs.sp == StackBase(fp), at ../jsinterp.cpp:2984
+
+// Assertion failure: cg->staticLevel >= level, at ../jsemit.cpp:2014
+// Crash [@ BindNameToSlot] in opt without -j
+
+// =====
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
+
+
+
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-104.js b/js/src/tests/js1_8_1/regress/regress-452498-104.js
new file mode 100644
index 000000000..19ade2695
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-104.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #104 From Jesse Ruderman
+
+ (function(a) { function b() { a; } function a() { } })();
+// Assertion failure: pn_defn, at ../jsparse.h:655
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-111.js b/js/src/tests/js1_8_1/regress/regress-452498-111.js
new file mode 100644
index 000000000..0a6cb99a6
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-111.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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #111 From Gary Kwong [:nth10sd]
+
+new Function("{function x(){}}");
+
+// Assertion failure: pn->pn_defn || (fun->flags & JSFUN_LAMBDA), at ../jsemit.cpp:4149
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
+
+
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-112.js b/js/src/tests/js1_8_1/regress/regress-452498-112.js
new file mode 100644
index 000000000..19aa63b10
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-112.js
@@ -0,0 +1,39 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #112 From Jesse Ruderman
+
+ expect = 'ReferenceError: can\'t access lexical declaration `q\' before initialization';
+
+ try
+ {
+ q = new Function("(function() { q(3); })(); const q = undefined;"); q();
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-114-a.js b/js/src/tests/js1_8_1/regress/regress-452498-114-a.js
new file mode 100644
index 000000000..5d753f9eb
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-114-a.js
@@ -0,0 +1,43 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #114 From Gary Kwong [:nth10sd]
+
+ if (typeof timeout == 'function')
+ {
+ timeout(3);
+ try
+ {
+ eval('while(x|={}) with({}) const x;');
+ }
+ catch(ex)
+ {
+ }
+ reportCompare(expect, actual, '');
+ }
+
+// Assertion failure: cg->stackDepth >= 0, at ../jsemit.cpp:185
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-114.js b/js/src/tests/js1_8_1/regress/regress-452498-114.js
new file mode 100644
index 000000000..8962ca956
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-114.js
@@ -0,0 +1,50 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #114 From Gary Kwong [:nth10sd]
+
+ for (var x = 0; x < 3; ++x){ y = function (){} }
+
+// glorp!
+// Assertion failed: "Constantly false guard detected": 0 (../nanojit/LIR.cpp:999)
+// (note, this is with -j; I don't know what the glorp! message is about.)
+
+// =====
+ function y([{x: x, y}]){}
+
+// Assertion failure: UPVAR_FRAME_SKIP(pn->pn_cookie) == (pn->pn_defn ? cg->staticLevel : 0), at ../jsemit.cpp:3547
+
+// =====
+
+ try
+ {
+ eval("(1.3.__defineGetter__(\"\"));let (y, x) { var z = true, x = 0; }");
+ }
+ catch(ex)
+ {
+ }
+// Assertion failure: ATOM_IS_STRING(atom), at ../jsinterp.cpp:5691
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-116.js b/js/src/tests/js1_8_1/regress/regress-452498-116.js
new file mode 100644
index 000000000..c81b2b892
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-116.js
@@ -0,0 +1,33 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #116 From Gary Kwong [:nth10sd]
+
+// -j
+ (new Function("for (var x = 0; x < 3; ++x) { (function(){})() } "))();
+
+//Crash [@ js_IsActiveWithOrBlock]
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-117.js b/js/src/tests/js1_8_1/regress/regress-452498-117.js
new file mode 100644
index 000000000..ce37ea418
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-117.js
@@ -0,0 +1,95 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #117 From Gary Kwong [:nth10sd]
+
+// The following all do not require -j.
+
+// =====
+
+ try
+ {
+ eval('x; function x(){}; const x = undefined;');
+ }
+ catch(ex)
+ {
+ }
+
+// Assertion failure: !pn->isPlaceholder(), at ../jsparse.cpp:4876
+// =====
+ (function(){ var x; eval("var x; x = null"); })();
+
+// Assertion failure: !(pnu->pn_dflags & PND_BOUND), at ../jsemit.cpp:1818
+// =====
+ (function(){const x = 0, y = delete x;})()
+
+// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710
+// =====
+ try
+ {
+ (function(){(yield []) (function(){with({}){x} }); const x = undefined;})();
+ }
+ catch(ex)
+ {
+ }
+
+// Assertion failure: pnu->pn_lexdef == dn, at ../jsemit.cpp:1817
+// =====
+ uneval(function(){arguments = ({ get y(){} }); for(var [arguments] in y ) (x);});
+
+// Assertion failure: n != 0, at ../jsfun.cpp:2689
+// =====
+ try
+ {
+ eval('(function(){{for(c in (function (){ for(x in (x1))window} )()) {const x = undefined;} }})();');
+ }
+ catch(ex)
+ {
+ }
+
+// Assertion failure: (fun->u.i.script)->upvarsOffset != 0, at ../jsfun.cpp:1537
+// Opt crash [@ js_NewFlatClosure] near null
+// =====
+ "" + function(){for(var [x] in x1) ([]); function x(){}}
+
+// Assertion failure: cg->stackDepth == stackDepth, at ../jsemit.cpp:3664
+// Opt crash [@ JS_ArenaRealloc] near null
+// =====
+ try
+ {
+ eval(
+ "for (a in (function(){" +
+ " for each (let x in ['']) { return new function x1 (\u3056) { yield x } ();" +
+ " }})())" +
+ " function(){}"
+ );
+ }
+ catch(ex)
+ {
+ }
+// Crash [@ js_Interpret] near null
+// =====
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-118.js b/js/src/tests/js1_8_1/regress/regress-452498-118.js
new file mode 100644
index 000000000..4c4ee1750
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-118.js
@@ -0,0 +1,33 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #118 From Jesse Ruderman
+
+ (function() { (function() { e *= 4; })(); var e; })();
+
+//Without patch: no output
+//With patch: ReferenceError: reference to undefined property "e"
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-121.js b/js/src/tests/js1_8_1/regress/regress-452498-121.js
new file mode 100644
index 000000000..99cecd79b
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-121.js
@@ -0,0 +1,33 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #121 From Gary Kwong [:nth10sd]
+
+// without -j
+ x = function()x;
+
+// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:651
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-123.js b/js/src/tests/js1_8_1/regress/regress-452498-123.js
new file mode 100644
index 000000000..ec9973fdd
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-123.js
@@ -0,0 +1,59 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+
+// ------- Comment #123 From Gary Kwong [:nth10sd]
+
+// Does not require -j:
+// =====
+ try
+ {
+ eval('y = (function (){y} for (x in []);');
+ }
+ catch(ex)
+ {
+ }
+
+// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:651
+// =====
+ (function(){for(var x in [arguments]){} function x(){}})();
+
+// Assertion failure: dn->pn_defn, at ../jsemit.cpp:1873
+// =====
+
+
+// Requires -j:
+// =====
+ (function(){ eval("for (x in ['', {}, '', {}]) { this; }" )})();
+
+// Assertion failure: fp->thisp == fp->argv[-1].toObjectOrNull(), at ../jstracer.cpp:4172
+// =====
+ for each (let x in ['', '', '']) { (new function(){} )}
+
+// Assertion failure: scope->object == ctor, at ../jsbuiltins.cpp:236
+// Opt crash [@ js_FastNewObject] near null
+// =====
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-129.js b/js/src/tests/js1_8_1/regress/regress-452498-129.js
new file mode 100644
index 000000000..b7f3c1474
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-129.js
@@ -0,0 +1,50 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #129 From Gary Kwong [:nth10sd]
+
+// Does not require -j:
+// =====
+try {
+ eval("({ set x x () { for(x in function(){}){}} })");
+} catch (e)
+{
+}
+
+// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710
+// =====
+
+try
+{
+ (function (){ eval("(function(){delete !function(){}});"); })();
+}
+catch(ex)
+{
+}
+// Debug crash [@ JSParseNode::isFunArg] at null
+// Opt crash [@ FindFunArgs] near null
+// =====
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-131.js b/js/src/tests/js1_8_1/regress/regress-452498-131.js
new file mode 100644
index 000000000..d4cb82384
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-131.js
@@ -0,0 +1,49 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #131 From Gary Kwong [:nth10sd]
+
+// Does not require -j:
+// =====
+ try
+ {
+ eval('((__defineGetter__, function (x) { function x(){} }) for');
+ }
+ catch(ex)
+ {
+ }
+// Assertion failure: pn->pn_cookie == FREE_UPVAR_COOKIE, at ../jsparse.cpp:5698
+// =====
+ try
+ {
+ eval('( "" ? 1.3 : x); *::*; x::x;');
+ }
+ catch(ex)
+ {
+ }
+// Assertion failure: pn != dn->dn_uses, at ../jsparse.cpp:1171
+// =====
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-135.js b/js/src/tests/js1_8_1/regress/regress-452498-135.js
new file mode 100644
index 000000000..b2bf72fab
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-135.js
@@ -0,0 +1,46 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #135 From Gary Kwong [:nth10sd]
+
+// -j is not required:
+// ===
+
+ for (let i = 0; i < 9; ++i) {
+ let m = i;
+ if (i % 3 == 1) {
+ print('' + (function() { return m; })());
+ }
+ }
+
+// Debug & opt crash [@ BindNameToSlot]
+
+// -j is required:
+// ===
+ for (let a=0;a<3;++a) for (let b=0;b<3;++b) if ((g=a|(a%b))) with({}){}
+
+// Assertion failure: OBJ_IS_CLONED_BLOCK(obj), at ../jsobj.cpp:2392
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-155.js b/js/src/tests/js1_8_1/regress/regress-452498-155.js
new file mode 100644
index 000000000..5798569fa
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-155.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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ delete (1 ? window : function(){});
+ }
+ catch(ex)
+ {
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-160.js b/js/src/tests/js1_8_1/regress/regress-452498-160.js
new file mode 100644
index 000000000..6498a0b5a
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-160.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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #160 From Gary Kwong
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// crash [@ js_Interpret]
+ (eval("(function(){ this.watch(\"x\", function () { new function ()y } ); const y = undefined });"))();
+ x = NaN;
+ reportCompare(expect, actual, summary + ': 2');
+
+// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:5916
+ ({ set z(v){}, set y(v)--x, set w(v)--w });
+ reportCompare(expect, actual, summary + ': 3');
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-168-1.js b/js/src/tests/js1_8_1/regress/regress-452498-168-1.js
new file mode 100644
index 000000000..c94653e49
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-168-1.js
@@ -0,0 +1,33 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #168 From Gary Kwong
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// Assertion failure: (fun->u.i.script)->upvarsOffset != 0, at ../jsfun.cpp:1543
+
+ (
+ new Function("const x = (function () { if (1e+81){} else{x} } )"
+ ))();
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-168-2.js b/js/src/tests/js1_8_1/regress/regress-452498-168-2.js
new file mode 100644
index 000000000..b41a5211c
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-168-2.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #168 From Gary Kwong
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:2047
+
+ for (let x; __defineSetter__; (<{x}></{x}> for (x in x))) {}
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-176.js b/js/src/tests/js1_8_1/regress/regress-452498-176.js
new file mode 100644
index 000000000..77460e789
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-176.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #176 From Gary Kwong
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// Assertion failure: pn_arity == PN_FUNC || pn_arity == PN_NAME, at ../jsparse.h:449
+
+ if(delete( 5 ? [] : (function(){})() )) [];
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-181.js b/js/src/tests/js1_8_1/regress/regress-452498-181.js
new file mode 100644
index 000000000..df5f3a160
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-181.js
@@ -0,0 +1,31 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #181 From Jesse Ruderman
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 3;
+
+ (function(print) { delete print; })(); print(actual = 3);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-185.js b/js/src/tests/js1_8_1/regress/regress-452498-185.js
new file mode 100644
index 000000000..1c88dc348
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-185.js
@@ -0,0 +1,37 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #185 From Jesse Ruderman
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'SyntaxError: redeclaration of var e';
+ try
+ {
+ eval('{ var e = 3; let e = ""; } print(typeof e);');
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-187.js b/js/src/tests/js1_8_1/regress/regress-452498-187.js
new file mode 100644
index 000000000..e4138ba28
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-187.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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #187 From Jesse Ruderman
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ eval('const x = undefined; for (x in []);');
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-191.js b/js/src/tests/js1_8_1/regress/regress-452498-191.js
new file mode 100644
index 000000000..1628d7f87
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-191.js
@@ -0,0 +1,47 @@
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #191 From Brendan Eich
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = actual = 'No Error';
+ try
+ {
+ eval('{ var x; {let x;} }');
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ expect = 'SyntaxError: redeclaration of let x';
+ try
+ {
+ eval('{ let x; {var x;} }');
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-452498-192.js b/js/src/tests/js1_8_1/regress/regress-452498-192.js
new file mode 100644
index 000000000..6f176788b
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-452498-192.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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+//------- Comment #192 From Brendan Eich
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ let x;
+ with({x: (x -= 0)}){([]); const x = undefined; }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-466905-01.js b/js/src/tests/js1_8_1/regress/regress-466905-01.js
new file mode 100644
index 000000000..882f8d7e3
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-466905-01.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 = 466905;
+var summary = 'Do not assert: v_ins->isCall() && v_ins->callInfo() == &js_FastNewArray_ci';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function f(a) { for each (let c in a) [(c > 5) ? 'A' : 'B']; }
+ f([true, 8]);
+ f([2]);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-466905-02.js b/js/src/tests/js1_8_1/regress/regress-466905-02.js
new file mode 100644
index 000000000..89872af19
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-466905-02.js
@@ -0,0 +1,29 @@
+/* -*- 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 = 466905;
+var summary = 'Do not assert: v_ins->isCall() && v_ins->callInfo() == &js_FastNewArray_ci';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < 5; i++)
+ [(i > 3) ? 'a' : 'b'];
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-479430-01.js b/js/src/tests/js1_8_1/regress/regress-479430-01.js
new file mode 100644
index 000000000..c61cea7d4
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-479430-01.js
@@ -0,0 +1,44 @@
+// |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 = 479430;
+var summary = 'Missing operation callback checks';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if (typeof timeout == 'function')
+ {
+ expectExitCode(6);
+
+ timeout(0.01);
+
+ function f(n)
+ {
+ if (n != 0) {
+ f(n - 1);
+ f(n - 1);
+ }
+ }
+
+ f(100);
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-479430-02.js b/js/src/tests/js1_8_1/regress/regress-479430-02.js
new file mode 100644
index 000000000..04e6fca89
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-479430-02.js
@@ -0,0 +1,46 @@
+// |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 = 479430;
+var summary = 'Missing operation callback checks';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if (typeof timeout == 'function')
+ {
+ expectExitCode(6);
+
+ timeout(0.01);
+
+ function f(n)
+ {
+ if (n != 0) {
+ try { f(n - 1); } catch (e) {}
+ try { f(n - 1); } catch (e) {}
+ }
+ throw 0;
+ }
+
+ f(100);
+
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-479430-03.js b/js/src/tests/js1_8_1/regress/regress-479430-03.js
new file mode 100644
index 000000000..dcac2bfb5
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-479430-03.js
@@ -0,0 +1,49 @@
+// |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 = 479430;
+var summary = 'Missing operation callback checks';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if (typeof timeout == 'function')
+ {
+ expectExitCode(6);
+
+ timeout(0.01);
+
+ function f(n)
+ {
+ if (n != 0) {
+ f(n - 1);
+ f(n - 1);
+ }
+ try {
+ return 0;
+ } finally {
+ n++;
+ }
+ }
+
+ f(100);
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-479430-04.js b/js/src/tests/js1_8_1/regress/regress-479430-04.js
new file mode 100644
index 000000000..7ddcea3b0
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-479430-04.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 = 479430;
+var summary = 'Missing operation callback checks';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if (typeof timeout== 'function')
+ {
+ expectExitCode(6);
+
+ timeout(0.01);
+
+ function f(n)
+ {
+ if (n != 0) {
+ try { f(n - 1); } catch (e) {}
+ try { f(n - 1); } catch (e) {}
+ }
+ name_that_does_not_exists;
+ }
+
+ f(100);
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-479430-05.js b/js/src/tests/js1_8_1/regress/regress-479430-05.js
new file mode 100644
index 000000000..b811202f8
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-479430-05.js
@@ -0,0 +1,44 @@
+// |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 = 479430;
+var summary = 'Missing operation callback checks';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if (typeof timeout == 'function')
+ {
+ expectExitCode(6);
+
+ timeout(0.01);
+
+ function f(n)
+ {
+ if (n != 0) {
+ try { f(n - 1); } finally { f(n - 1); }
+ }
+ name_that_does_not_exists;
+ }
+
+ f(100);
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-495773.js b/js/src/tests/js1_8_1/regress/regress-495773.js
new file mode 100644
index 000000000..53c0387a7
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-495773.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 = 495773;
+var summary = 'Read upvar from trace-entry frame from JSStackFrame instead of tracing native stack';
+var actual = ''
+var expect = '010101';
+//-----------------------------------------------------------------------------
+function f() {
+ var q = [];
+ for (var a = 0; a < 3; ++a) {
+ (function () {
+ for (var b = 0; b < 2; ++b) {
+ (function () {
+ for (var c = 0; c < 1; ++c) {
+ q.push(b);
+ }
+ })();
+ }
+ })();
+ }
+ return q.join("");
+}
+
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ actual = f();
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-495907.js b/js/src/tests/js1_8_1/regress/regress-495907.js
new file mode 100644
index 000000000..12ac1ef83
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-495907.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 = 495907;
+var summary = 'Read upvar from trace-entry frame when created with top-level let';
+var actual = ''
+var expect = '00112233';
+//-----------------------------------------------------------------------------
+
+// The test code needs to run at top level in order to expose the bug.
+start_test();
+
+var o = [];
+for (let a = 0; a < 4; ++a) {
+ (function () {for (var b = 0; b < 2; ++b) {o.push(a);}}());
+}
+actual = o.join("");
+
+finish_test();
+//-----------------------------------------------------------------------------
+
+function start_test() {
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+}
+
+function finish_test() {
+ reportCompare(expect, actual, summary);
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-496922.js b/js/src/tests/js1_8_1/regress/regress-496922.js
new file mode 100644
index 000000000..7b32c26c1
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-496922.js
@@ -0,0 +1,38 @@
+/* -*- 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 = 496922;
+var summary = 'Incorrect handling of extra arguments';
+var actual = ''
+var expect = '0,0,1,1,2,2,3,3';
+
+
+//-----------------------------------------------------------------------------
+
+// The code must run as part of the top-level script in order to get the bug.
+enterFunc ('test');
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var a = [];
+{
+let f = function() {
+ for (let x = 0; x < 4; ++x) {
+ (function() {
+ for (let y = 0; y < 2; ++y) {
+ a.push(x);
+ }
+ })()
+ }
+}; (function() {})()
+ f(99)
+}
+actual = '' + a;
+
+reportCompare(expect, actual, summary);
+exitFunc ('test');
+//-----------------------------------------------------------------------------
+
diff --git a/js/src/tests/js1_8_1/regress/regress-507053.js b/js/src/tests/js1_8_1/regress/regress-507053.js
new file mode 100644
index 000000000..ace72f326
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-507053.js
@@ -0,0 +1,46 @@
+/* -*- 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 = 507053;
+var summary = 'TM: invalid results with setting a closure variable in a loop'
+var actual = '';
+var expect = '2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,';
+
+
+//-----------------------------------------------------------------------------
+start_test();
+
+var f = function() {
+ var p = 1;
+
+ function g() {
+ for (var i = 0; i < 5; ++i) {
+ p = p * 2;
+ actual += p + ',';
+ }
+ }
+ g();
+}
+
+for (var i = 0; i < 5; ++i) {
+ f();
+}
+
+finish_test();
+//-----------------------------------------------------------------------------
+
+function start_test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+}
+
+function finish_test()
+{
+ reportCompare(expect, actual, summary);
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-507295.js b/js/src/tests/js1_8_1/regress/regress-507295.js
new file mode 100644
index 000000000..7a1de77e0
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-507295.js
@@ -0,0 +1,41 @@
+/* -*- 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 = 507295;
+var summary = 'TM: assert with using result of assignment to closure var'
+var actual = '';
+var expect = 'do not crash';
+
+
+//-----------------------------------------------------------------------------
+start_test();
+
+(function () {
+ var y;
+ (eval("(function () {\
+ for (var x = 0; x < 3; ++x) {\
+ ''.replace(/a/, (y = 3))\
+ }\
+ });\
+ "))()
+})()
+
+actual = 'do not crash'
+finish_test();
+//-----------------------------------------------------------------------------
+
+function start_test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+}
+
+function finish_test()
+{
+ reportCompare(expect, actual, summary);
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_8_1/regress/regress-509354.js b/js/src/tests/js1_8_1/regress/regress-509354.js
new file mode 100644
index 000000000..cbf4cfc59
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-509354.js
@@ -0,0 +1,41 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Jason Orendorff <jorendorff@mozilla.com>
+ */
+
+// Decompile destructuring argument named `arguments` correctly.
+var actual = "" + function ([arguments]) {return arguments;};
+compareSource('function ([arguments]) {return arguments;}', actual, "part 1");
+
+// Make sure the 'arguments' argument actually works.
+var f = function ([arguments]) {return arguments + 1;};
+reportCompare(3.25, f([2.25]), "part 2");
+
+// Throw SyntaxError when `arguments` appears twice in a destructuring parameter.
+actual = "no exception";
+try {
+ eval('(function ([arguments, arguments]) {return arguments();})');
+} catch (exc) {
+ actual = exc.name;
+}
+reportCompare("SyntaxError", actual, "part 3");
+
+// And again...
+actual = "no exception";
+try {
+ eval('(function ([a, b, arguments, d], [e, f, arguments]) {return arguments();})');
+} catch (exc) {
+ actual = exc.name;
+}
+reportCompare("SyntaxError", actual, "part 4");
+
+// The original test case from bug 509354. Don't crash.
+try {
+ eval('print(function([arguments,arguments,arguments,arguments,arguments,' +
+ 'arguments,arguments,arguments,arguments,arguments,arguments,' +
+ 'arguments,arguments,arguments,arguments,arguments]){})');
+} catch (exc) {
+}
+reportCompare("no crash", "no crash", "part 5");
+
diff --git a/js/src/tests/js1_8_1/regress/regress-522123.js b/js/src/tests/js1_8_1/regress/regress-522123.js
new file mode 100644
index 000000000..7a491e094
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-522123.js
@@ -0,0 +1,38 @@
+/* -*- 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 = 522123;
+var summary = 'Indirect eval confuses scope chain';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+var x=1;
+
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 1;
+
+ evil=eval;
+ {
+ let x=2;
+ actual = evil("x");
+ };
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
+
+reportCompare(true, true);
diff --git a/js/src/tests/js1_8_1/regress/regress-524264.js b/js/src/tests/js1_8_1/regress/regress-524264.js
new file mode 100644
index 000000000..78006bd6c
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-524264.js
@@ -0,0 +1,7 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Jason Orendorff
+ */
+uneval(function () { do yield; while (0); });
+reportCompare("no assertion failure", "no assertion failure", "bug 524264");
diff --git a/js/src/tests/js1_8_1/regress/regress-524743.js b/js/src/tests/js1_8_1/regress/regress-524743.js
new file mode 100644
index 000000000..8bd3cd6ee
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-524743.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if((isDebugBuild&&!xulRuntime.shell)||Android) -- hang
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+if (typeof gczeal != 'undefined' && typeof gc != 'undefined') {
+ try
+ {
+ gczeal(2);
+ var obj = {};
+ for (var i = 0; i < 50; i++) {
+ obj["_" + i] = 0;
+ gc();
+ }
+ }
+ catch(ex)
+ {
+ }
+ gczeal(0);
+}
+reportCompare("no assertion failure", "no assertion failure", "bug 524743");
diff --git a/js/src/tests/js1_8_1/regress/regress-530879.js b/js/src/tests/js1_8_1/regress/regress-530879.js
new file mode 100644
index 000000000..39931d1c3
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/regress-530879.js
@@ -0,0 +1,9 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Jason Orendorff
+ */
+function f(a, b, c, d) {
+ yield arguments.length;
+}
+reportCompare(0, f().next(), "bug 530879");
diff --git a/js/src/tests/js1_8_1/regress/shell.js b/js/src/tests/js1_8_1/regress/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_8_1/regress/shell.js
diff --git a/js/src/tests/js1_8_1/shell.js b/js/src/tests/js1_8_1/shell.js
new file mode 100644
index 000000000..ef2f97fe1
--- /dev/null
+++ b/js/src/tests/js1_8_1/shell.js
@@ -0,0 +1,13 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*-
+ * 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/. */
+
+// NOTE: This only turns on 1.8.1 in shell builds. The browser requires the
+// futzing in js/src/tests/browser.js (which only turns on 1.8, the most
+// the browser supports).
+if (typeof version != 'undefined')
+{
+ version(181);
+}
+
diff --git a/js/src/tests/js1_8_1/strict/12.2.1.js b/js/src/tests/js1_8_1/strict/12.2.1.js
new file mode 100644
index 000000000..674c7a7c6
--- /dev/null
+++ b/js/src/tests/js1_8_1/strict/12.2.1.js
@@ -0,0 +1,75 @@
+// |reftest| skip-if(Android)
+/* -*- 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/
+ */
+
+/*
+ * In strict mode code, 'let' and 'const' declarations may not bind
+ * 'eval' or 'arguments'.
+ */
+assertEq(testLenientAndStrict('let eval;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('let x,eval;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('let arguments;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('let x,arguments;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('const eval = undefined;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('const x = undefined,eval = undefined;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('const arguments = undefined;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('const x = undefined,arguments = undefined;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+
+/*
+ * In strict mode code, 'let' declarations appearing in 'for'
+ * or 'for in' statements may not bind 'eval' or 'arguments'.
+ */
+assertEq(testLenientAndStrict('for (let eval in [])break;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('for (let [eval] in [])break;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('for (let {x:eval} in [])break;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('for (let arguments in [])break;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('for (let [arguments] in [])break;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+assertEq(testLenientAndStrict('for (let {x:arguments} in [])break;',
+ parsesSuccessfully,
+ parseRaisesException(SyntaxError)),
+ true);
+
+reportCompare(true, true);
diff --git a/js/src/tests/js1_8_1/strict/8.7.2.js b/js/src/tests/js1_8_1/strict/8.7.2.js
new file mode 100644
index 000000000..8e1d76106
--- /dev/null
+++ b/js/src/tests/js1_8_1/strict/8.7.2.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(Android)
+/* -*- 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/
+ */
+
+/* Check that assignment to a let-bound variable is permitted in both lenient and strict modes. */
+
+/* Assigning to a let-declared variable is okay in strict and loose modes. */
+assertEq(testLenientAndStrict('let let_declared; let_declared=1',
+ completesNormally,
+ completesNormally),
+ true);
+
+reportCompare(true, true);
diff --git a/js/src/tests/js1_8_1/strict/shell.js b/js/src/tests/js1_8_1/strict/shell.js
new file mode 100644
index 000000000..7469bbf94
--- /dev/null
+++ b/js/src/tests/js1_8_1/strict/shell.js
@@ -0,0 +1,88 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+
+/*
+ * Return true if both of these return true:
+ * - LENIENT_PRED applied to CODE
+ * - STRICT_PRED applied to CODE with a use strict directive added to the front
+ *
+ * Run STRICT_PRED first, for testing code that affects the global environment
+ * in loose mode, but fails in strict mode.
+ */
+function testLenientAndStrict(code, lenient_pred, strict_pred) {
+ return (strict_pred("'use strict'; " + code) &&
+ lenient_pred(code));
+}
+
+/*
+ * completesNormally(CODE) returns true if evaluating CODE (as eval
+ * code) completes normally (rather than throwing an exception).
+ */
+function completesNormally(code) {
+ try {
+ eval(code);
+ return true;
+ } catch (exception) {
+ return false;
+ }
+}
+
+/*
+ * raisesException(EXCEPTION)(CODE) returns true if evaluating CODE (as eval
+ * code) throws an exception object whose prototype is
+ * EXCEPTION.prototype, and returns false if it throws any other error
+ * or evaluates successfully. For example: raises(TypeError)("0()") ==
+ * true.
+ */
+function raisesException(exception) {
+ return function (code) {
+ try {
+ eval(code);
+ return false;
+ } catch (actual) {
+ return exception.prototype.isPrototypeOf(actual);
+ }
+ };
+};
+
+/*
+ * parsesSuccessfully(CODE) returns true if CODE parses as function
+ * code without an error.
+ */
+function parsesSuccessfully(code) {
+ try {
+ Function(code);
+ return true;
+ } catch (exception) {
+ return false;
+ }
+};
+
+/*
+ * parseRaisesException(EXCEPTION)(CODE) returns true if parsing CODE
+ * as function code raises EXCEPTION.
+ */
+function parseRaisesException(exception) {
+ return function (code) {
+ try {
+ Function(code);
+ return false;
+ } catch (actual) {
+ return exception.prototype.isPrototypeOf(actual);
+ }
+ };
+};
+
+/*
+ * Return the result of applying uneval to VAL, and replacing all runs
+ * of whitespace with a single horizontal space (poor man's
+ * tokenization).
+ */
+function clean_uneval(val) {
+ return uneval(val).replace(/\s+/g, ' ');
+}
diff --git a/js/src/tests/js1_8_1/template.js b/js/src/tests/js1_8_1/template.js
new file mode 100644
index 000000000..089aae2d6
--- /dev/null
+++ b/js/src/tests/js1_8_1/template.js
@@ -0,0 +1,28 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 99999;
+var summary = '';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}