summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_8_1/jit
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/js1_8_1/jit
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/js1_8_1/jit')
-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
24 files changed, 2050 insertions, 0 deletions
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;