Backed out changeset fd2d1860e2ac because it seems to delete hundreds of filse I didn't want deleted.

This commit is contained in:
Jason Orendorff 2010-10-20 23:24:02 -05:00
parent 5b2994169c
commit d9a995169b
92 changed files with 4037 additions and 2 deletions

View File

@ -0,0 +1,48 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
const HAVE_TM = 'tracemonkey' in this;
const HOTLOOP = HAVE_TM ? tracemonkey.HOTLOOP : 8;
const RECORDLOOP = HOTLOOP;
const RUNLOOP = HOTLOOP + 1;
var checkStats;
if (HAVE_TM) {
checkStats = function(stats)
{
// Temporarily disabled while we work on heuristics.
return;
function jit(on)
{
if (on && !options().match(/tracejit/))
{
options('tracejit');
}
else if (!on && options().match(/tracejit/))
{
options('tracejit');
}
}
jit(false);
for (var name in stats) {
var expected = stats[name];
var actual = tracemonkey[name];
if (expected != actual) {
print('Trace stats check failed: got ' + actual + ', expected ' + expected + ' for ' + name);
}
}
jit(true);
};
} else {
checkStats = function() {};
}
var appendToActual = function(s) {
actual += s + ',';
}
if (!("gczeal" in this)) {
gczeal = function() { }
}

View File

@ -0,0 +1,22 @@
actual = '';
expected = '6,';
// tracing length
var g = 0;
function h(args) {
g = args.length;
}
function f() {
h(arguments);
}
for (var i = 0; i < 5; ++i) {
f(10, 20, 30, 40, 50, 60);
}
appendToActual(g);
assertEq(actual, expected)

View File

@ -0,0 +1,14 @@
actual = '';
expected = '[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],';
function h() {
return arguments;
}
for (var i = 0; i < 5; ++i) {
var p = h(i, i*2);
appendToActual(p);
}
assertEq(actual, expected)

View File

@ -0,0 +1,23 @@
actual = '';
expected = '[object Arguments] undefined undefined,[object Arguments] undefined undefined,';
function f() {
g(arguments);
}
function g(a, b, c) {
h(arguments);
a = 1;
b = 2;
c = 3;
h(arguments);
}
function h(a, b, c) {
appendToActual(a + ' ' + b + ' ' + c);
}
f(4, 5, 6);
assertEq(actual, expected)

View File

@ -0,0 +1,11 @@
// |jit-test| TMFLAGS: full,fragprofile,treevis
function arith()
{
var accum = 0;
for (var i = 0; i < 100; i++) {
accum += (i * 2) - 1;
}
return accum;
}
assertEq(arith(), 9800);

View File

@ -0,0 +1,9 @@
var Q = 0;
try {
(function f(i) { Q = i; if (i == 100000) return; f(i+1); })(1)
} catch (e) {
}
if (Q == 100000)
assertEq(Q, "fail");

View File

@ -0,0 +1,10 @@
var Q = 0;
try {
(function f(i) { Q = i; if (i == 100000) return; f(i+1); })(1)
} catch (e) {
}
// Exact behavior of recursion check depends on which JIT we use.
var ok = (Q == 3000 || Q == 3001);
assertEq(ok, true);

View File

@ -0,0 +1,16 @@
// Don't crash
function g(foo) {
for (a in foo) {
}
}
var makegen = eval("\n\
(function(b) {\n\
var h = \n\
eval(\"new function() { yield print(b) }\" ); \n\
return h\n\
})\n\
");
g(makegen());

View File

@ -0,0 +1,3 @@
__defineGetter__('x', Float32Array);
with(this)
x;

View File

@ -0,0 +1,10 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
// Contributor: Luke Wagner <lw@mozilla.com>
var x, f;
for (var i = 0; i < 100; i++) {
f = function() {};
f.foo;
x = f.length;
}

View File

@ -0,0 +1,17 @@
var a = ['p', 'q', 'r', 's', 't'];
var o = {p:1, q:2, r:3, s:4, t:5};
for (var i in o) {
delete o.p;
delete o.q;
delete o.r;
delete o.s;
delete o.t;
}
for each (var i in a)
assertEq(o.hasOwnProperty(i), false);
checkStats({
recorderAborted:0,
traceCompleted:1,
sideExitIntoInterpreter:1
});

View File

@ -0,0 +1,14 @@
// Make sure the arch flags are valid on startup, even if nothing has
// been traced yet. We don't know what arch the user is building on,
// but presumably we want at least 1 flag to be set on all supported
// platforms.
if (HAVE_TM) {
assertEq(jitstats.archIsIA32 ||
jitstats.archIs64BIT ||
jitstats.archIsARM ||
jitstats.archIsSPARC ||
jitstats.archIsPPC ||
jitstats.archIsAMD64,
1);
}

View File

@ -0,0 +1,23 @@
function parseIntHelper(n) {
var a;
for (var i = 0; i < 5; i++)
a = parseInt(n);
return a;
}
function doParseIntTests() {
var inputs = [0, -0, .1, -.1, .7, -.7, 1.3, -1.3];
var outputs = new Array(8);
//avoid jit, unrolled
outputs[0] = outputs[1] = outputs[2] = outputs[4] = 0;
outputs[3] = outputs[5] = -0;
outputs[6] = 1;
outputs[7] = -1;
for (var i = 0; i < 8; i++) {
var testfn = new Function('return parseIntHelper(' + uneval(inputs[i]) + ');');
assertEq(testfn(), outputs[i]);
}
}
doParseIntTests();
assertEq(parseInt("08"), 0);
assertEq(parseInt("09"), 0);

View File

@ -0,0 +1,16 @@
"use strict";
assertEq(parseInt("08"), 0);
assertEq(parseInt("09"), 0);
assertEq(parseInt("014"), 12);
assertEq(parseInt("0xA"), 10);
assertEq(parseInt("00123"), 83);
for (var i = 0; i < 5; i++)
{
assertEq(parseInt("08"), 0);
assertEq(parseInt("09"), 0);
assertEq(parseInt("014"), 12);
assertEq(parseInt("0xA"), 10);
assertEq(parseInt("00123"), 83);
}

View File

@ -0,0 +1,10 @@
var o = {
set x(v) {
return 42;
}
};
for (var i = 0; i < 10; ++i) {
var z = o.x = "choose me";
assertEq(z, "choose me");
}

View File

@ -0,0 +1,19 @@
var escape;
function testBug458838() {
var a = 1;
function g() {
var b = 0
for (var i = 0; i < 10; ++i) {
b += a;
}
return b;
}
return g();
}
assertEq(testBug458838(), 10);
checkStats({
recorderStarted: 1,
recorderAborted: 0,
traceCompleted: 1
});

View File

@ -0,0 +1,11 @@
function testBug504520() {
// A bug involving comparisons.
var arr = [1/0, 1/0, 1/0, 1/0, 1/0, 1/0, 1/0, 1/0, 1/0, 0];
assertEq(arr.length > RUNLOOP, true);
var s = '';
for (var i = 0; i < arr.length; i++)
arr[i] >= 1/0 ? null : (s += i);
assertEq(s, '9');
}
testBug504520();

View File

@ -0,0 +1,33 @@
function testBug504520Harder() {
// test 1024 similar cases
var vals = [1/0, -1/0, 0, 0/0];
var ops = ["===", "!==", "==", "!=", "<", ">", "<=", ">="];
for each (var x in vals) {
for each (var y in vals) {
for each (var op in ops) {
for each (var z in vals) {
// Assume eval is correct. This depends on the global
// Infinity property not having been reassigned.
var xz = eval(x + op + z);
var yz = eval(y + op + z);
var arr = [x, x, x, x, x, x, x, x, x, y];
assertEq(arr.length > RUNLOOP, true);
var expected = [xz, xz, xz, xz, xz, xz, xz, xz, xz, yz];
// ?: looks superfluous but that's what we're testing here
var fun = eval(
'(function (arr, results) {\n' +
' for (let i = 0; i < arr.length; i++)\n' +
' results.push(arr[i]' + op + z + ' ? "true" : "false");\n' +
'});\n');
var actual = [];
fun(arr, actual);
print(x, y, op, z);
assertEq("" + actual, "" + expected);
}
}
}
}
}
testBug504520Harder();

View File

@ -0,0 +1,36 @@
setDebug(true);
var a = new Array();
function i(save) {
var x = 9;
evalInFrame(0, "a.push(x)", save);
evalInFrame(1, "a.push(z)", save);
evalInFrame(2, "a.push(z)", save);
evalInFrame(3, "a.push(y)", save);
evalInFrame(4, "a.push(x)", save);
}
function h() {
var z = 5;
evalInFrame(0, "a.push(z)");
evalInFrame(1, "a.push(y)");
evalInFrame(2, "a.push(x)");
evalInFrame(0, "i(false)");
evalInFrame(0, "a.push(z)", true);
evalInFrame(1, "a.push(y)", true);
evalInFrame(2, "a.push(x)", true);
evalInFrame(0, "i(true)", true);
}
function g() {
var y = 4;
h();
}
function f() {
var x = 3;
g();
}
f();
assertEq(a+'', [5, 4, 3, 9, 5, 5, 4, 3, 5, 4, 3, 9, 5, 5, 4, 3]+'');

View File

@ -0,0 +1,21 @@
// don't panic
f = function() {
x = yield
}
rv = f()
for (a in rv) (function() {})
x = Proxy.create((function() {
return {
defineProperty: gc
}
})(), x)
with({
d: (({
x: Object.defineProperty(x, "", ({
set: Array.e
}))
}))
}) {}
// don't crash

View File

@ -0,0 +1,22 @@
if (typeof gczeal != "function")
gczeal = function() {}
for (a = 0; a < 9; a++)
for (b = 0; b < 1; b++)
for (c = 0; c < 2; c++)
gczeal();
for each(e in [NaN])
for (d = 0; d < 1; d++)
z = 0;
for (w in [0, 0])
{}
x = 0;
for (e = 0; e < 3; e++)
for (f = 0; f < 4; f++)
x = -x
// don't crash

View File

@ -0,0 +1,9 @@
if (typeof gczeal != "function")
gczeal = function() {}
// don't crash
x = (evalcx('lazy'))
x.watch("", function () {})
gczeal(1)
for (w in x) {}

View File

@ -0,0 +1,32 @@
function leak_test() {
// Create a reference loop function->script->traceFragment->object->function
// that GC must be able to break. To embedd object into the fragment the
// code use prototype chain of depth 2 which caches obj.__proto__.__proto__
// into the fragment.
// To make sure that we have no references to the function f after this
// function returns due via the conservative scan of the native stack we
// loop here multiple times overwriting the stack and registers with new garabge.
for (var j = 0; j != 8; ++j) {
var f = Function("a", "var s = 0; for (var i = 0; i != 100; ++i) s += a.b; return s;");
var c = {b: 1, f: f, leakDetection: makeFinalizeObserver()};
f({ __proto__: { __proto__: c}});
f = c = a = null;
gc();
}
}
function test()
{
if (typeof finalizeCount != "function")
return;
var base = finalizeCount();
leak_test();
gc();
gc();
var n = finalizeCount();
assertEq(base + 4 < finalizeCount(), true, "Some finalizations must happen");
}
test();

View File

@ -0,0 +1,12 @@
function testEliminatedGuardWithinAnchor() {
for (let i = 0; i < 5; ++i) { i / (i * i); }
return "ok";
}
assertEq(testEliminatedGuardWithinAnchor(), "ok");
if (HAVE_TM) {
checkStats({
sideExitIntoInterpreter: (jitstats.archIsARM ? 1 : 3)
});
}

View File

@ -0,0 +1,18 @@
var s;
function f(i) {
if (i > 4) /* side exit when arr[i] changes from bool to undefined (via a hole) */
assertEq(s, undefined);
else
assertEq(s, false);
return 1;
}
/* trailing 'true' ensures array has capacity >= 10 */
var arr = [ false, false, false, false, false, , , , , , true ];
for (var i = 0; i < 10; ++i) {
(s = arr[i]) + f(i);
}
checkStats({ traceTriggered: 2, sideExitIntoInterpreter: 2 })

View File

@ -0,0 +1,15 @@
function testIntOverflow() {
// int32_max - 7
var ival = 2147483647 - 7;
for (var i = 0; i < 30; i++) {
ival += 30;
}
return (ival < 2147483647);
}
assertEq(testIntOverflow(), false);
checkStats({
recorderStarted: 1,
recorderAborted: 0,
traceCompleted: 1,
traceTriggered: 1,
});

View File

@ -0,0 +1,14 @@
function testMethodInitSafety() {
function f() { return 'fail'; }
function g() { return 'ok'; }
var s;
var arr = [f, f, f, f, g];
//assertEq(arr.length > RUNLOOP, true);
for (var i = 0; i < arr.length; i++) {
var x = {m: arr[i]};
s = x.m();
}
return s;
}
assertEq(testMethodInitSafety(), "ok");

View File

@ -0,0 +1,14 @@
if ('gczeal' in this)
(function () {
(eval("\
(function () {\
for (var y = 0; y < 16; ++y) {\
if (y % 3 == 2) {\
gczeal(1);\
} else {\
print(0 / 0);\
}\
}\
});\
"))()
})();

View File

@ -0,0 +1,20 @@
var _quit;
function testNestedDeepBail()
{
_quit = false;
function loop() {
for (var i = 0; i < 4; i++)
;
}
loop();
function f() {
loop();
_quit = true;
}
var stk = [[1], [], [], [], []];
while (!_quit)
stk.pop().forEach(f);
}
testNestedDeepBail();

View File

@ -0,0 +1,29 @@
// Test stack reconstruction after a nested exit
function testNestedExitStackInner(j, counter) {
++counter;
var b = 0;
for (var i = 1; i <= RUNLOOP; i++) {
++b;
var a;
// Make sure that once everything has been traced we suddenly switch to
// a different control flow the first time we run the outermost tree,
// triggering a side exit.
if (j < RUNLOOP)
a = 1;
else
a = 0;
++b;
b += a;
}
return counter + b;
}
function testNestedExitStackOuter() {
var counter = 0;
for (var j = 1; j <= RUNLOOP; ++j) {
for (var k = 1; k <= RUNLOOP; ++k) {
counter = testNestedExitStackInner(j, counter);
}
}
return counter;
}
//assertEq(testNestedExitStackOuter(), 81);

View File

@ -0,0 +1,12 @@
function testNewArrayCount()
{
function count(a) { var n = 0; for (var p in a) n++; return n; }
var a = [];
for (var i = 0; i < 5; i++)
a = [0];
assertEq(count(a), 1);
for (var i = 0; i < 5; i++)
a = [0, , 2];
assertEq(count(a), 2);
}
testNewArrayCount();

View File

@ -0,0 +1,8 @@
function testNewArrayCount2() {
function count(a) { var n = 0; for (var p in a) n++; return n; }
var x = 0;
for (var i = 0; i < 10; ++i)
x = count(new Array(1,2,3));
return x;
}
assertEq(testNewArrayCount2(), 3);

View File

@ -0,0 +1,9 @@
// proxies can return primitives
assertEq(new (Proxy.createFunction({}, function(){}, function(){})), undefined);
x = Proxy.createFunction((function () {}), Uint16Array, wrap)
new(wrap(x))
// proxies can return the callee
var x = Proxy.createFunction({}, function (q) { return q; });
new x(x);

View File

@ -0,0 +1,21 @@
delete q;
delete g;
delete h;
delete a;
delete f;
function testRebranding2() {
// Same as testRebranding, but the object to be rebranded isn't the global.
var x = "FAIL";
function g(){}
function h(){ x = "ok"; }
var obj = {m: g};
var arr = [g, g, g, g, h];
//assertEq(arr.length > RUNLOOP, true);
for (var i = 0; i < 5; i++) {
obj.m = arr[i];
obj.m();
}
return x;
}
assertEq(testRebranding2(), "ok");

View File

@ -0,0 +1,28 @@
x = Proxy.create((function () {
return {
get: function () {}
}
}()), Object.e)
var hit = false;
try {
Function("\
for(var a = 0; a < 2; ++a) {\
if (a == 0) {}\
else {\
x > x\
}\
}\
")()
} catch (e) {
hit = true;
var str = String(e);
var match = (str == "TypeError: x is not a function" ||
str == "TypeError: can't convert x to number");
assertEq(match, true);
}
assertEq(hit, true);

View File

@ -0,0 +1,10 @@
// |jit-test| TMFLAGS: full,fragprofile,treevis; valgrind
function testRegExpTest() {
var r = /abc/;
var flag = false;
for (var i = 0; i < 10; ++i)
flag = r.test("abc");
return flag;
}
assertEq(testRegExpTest(), true);

View File

@ -0,0 +1,11 @@
var a = {_val: 'q',
get p() { return f; }};
function f() { return this._val; }
var g = '';
for (var i = 0; i < 9; i++)
g += a.p();
assertEq(g, 'qqqqqqqqq');
checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1});

View File

@ -0,0 +1,38 @@
// |jit-test| TMFLAGS: full,fragprofile,treevis; valgrind
/* Test the proper operation of the left shift operator. This is especially
* important on ARM as an explicit mask is required at the native instruction
* level. */
load(libdir + 'range.js');
function testShiftLeft()
{
var r = [];
var i = 0;
var j = 0;
var shifts = [0,1,7,8,15,16,23,24,31];
/* Samples from the simple shift range. */
for (i = 0; i < shifts.length; i++)
r[j++] = 1 << shifts[i];
/* Samples outside the normal shift range. */
for (i = 0; i < shifts.length; i++)
r[j++] = 1 << (shifts[i] + 32);
/* Samples far outside the normal shift range. */
for (i = 0; i < shifts.length; i++)
r[j++] = 1 << (shifts[i] + 224);
for (i = 0; i < shifts.length; i++)
r[j++] = 1 << (shifts[i] + 256);
return r.join(",");
}
assertEq(testShiftLeft(),
"1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+
"1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+
"1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+
"1,2,128,256,32768,65536,8388608,16777216,-2147483648");

View File

@ -0,0 +1,44 @@
/* Test the proper operation of the arithmetic right shift operator. This is
* especially important on ARM as an explicit mask is required at the native
* instruction level. */
load(libdir + 'range.js');
/* Test different combinations of literals/variables. */
var s = 4;
var t = 100;
assertEq(42 >> s, 2);
assertEq(s >> 1, 2);
assertEq(23 >> 3, 2);
assertEq(t >> s, 6);
function testShiftRightArithmetic()
{
var r = [];
var i = 0;
var j = 0;
var shifts = [0,1,7,8,15,16,23,24,31];
/* Samples from the simple shift range. */
for (i = 0; i < shifts.length; i++)
r[j++] = -2147483648 >> shifts[i];
/* Samples outside the normal shift range. */
for (i = 0; i < shifts.length; i++)
r[j++] = -2147483648 >> (shifts[i] + 32);
/* Samples far outside the normal shift range. */
for (i = 0; i < shifts.length; i++)
r[j++] = -2147483648 >> (shifts[i] + 224);
for (i = 0; i < shifts.length; i++)
r[j++] = -2147483648 >> (shifts[i] + 256);
return r.join(",");
}
assertEq(testShiftRightArithmetic(),
"-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
"-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
"-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
"-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1");

View File

@ -0,0 +1,39 @@
// |jit-test| TMFLAGS: full,fragprofile,treevis; valgrind
function testSideExitInConstructor() {
var FCKConfig = {};
FCKConfig.CoreStyles =
{
'Bold': { },
'Italic': { },
'FontFace': { },
'Size' :
{
Overrides: [ ]
},
'Color' :
{
Element: '',
Styles: { },
Overrides: [ ]
},
'BackColor': {
Element : '',
Styles : { 'background-color' : '' }
},
};
var FCKStyle = function(A) {
A.Element;
};
var pass = true;
for (var s in FCKConfig.CoreStyles) {
var x = new FCKStyle(FCKConfig.CoreStyles[s]);
if (!x)
pass = false;
}
return pass;
}
assertEq(testSideExitInConstructor(), true);

View File

@ -0,0 +1,10 @@
function testSlowNativeBail() {
var a = ['0', '1', '2', '3', '+'];
try {
for (var i = 0; i < a.length; i++)
new RegExp(a[i]);
} catch (exc) {
assertEq(""+exc, "SyntaxError: invalid quantifier");
}
}
testSlowNativeBail();

View File

@ -0,0 +1,29 @@
const numFatArgs = Math.pow(2,19) - 1024;
function fun(x) {
if (x <= 0)
return 0;
return fun(x-1);
}
function fatStack() {
return fun(10000);
}
function assertRightFailure(e) {
assertEq(e.toString() == "InternalError: script stack space quota is exhausted" ||
e.toString() == "InternalError: too much recursion",
true);
}
exception = false;
try {
fatStack.apply(null, new Array(numFatArgs));
} catch (e) {
assertRightFailure(e);
exception = true;
}
assertEq(exception, true);
// No more trace recursion w/ JM
checkStats({traceCompleted:0});

View File

@ -0,0 +1,17 @@
// |jit-test| error: TypeError
(eval("\
(function () {\
for (var[x] = function(){} in \
(function m(a) {\
if (a < 1) {\
x;\
return\
}\
return m(a - 1) + m(a - 2)\
})(7)\
(eval(\"\"))\
)\
([])\
})\
"))()

View File

@ -0,0 +1,17 @@
for (j = 0; j < 1; j++) {
var f = eval("\
(function() {\
for (var a = 0; a < 8; ++a) {\
if (a % 3 == 2) {\
eval(\"\
for(b in[0,0,0,0]) {\
print()\
}\
\")\
}\
gc()\
}\
})\
");
f()
}

View File

@ -0,0 +1,10 @@
for (a in (eval("\
(function() {\
return function() {\
yield ((function() {\
return d\
})())\
} ();\
var d = []\
})\
"))());

View File

@ -0,0 +1,16 @@
function m() {
var d = 73;
return (eval("\n\
(function() {\n\
return function() {\n\
yield ((function() {\n\
print(d);\n\
return d\n\
})())\n\
} ();\n\
})\n\
"))();
}
m().next();

View File

@ -0,0 +1,27 @@
function f() {
var k = 0;
var g = function() {
return ++k;
}
return g;
}
function h() {
for (var i = 0; i < 10; ++i) {
var vf = f();
assertEq(vf(), 1);
assertEq(vf(), 2);
for (var j = 0; j < 10; ++j) {
assertEq(vf(), j + 3);
}
}
}
h();
checkStats({
recorderAborted: 8, // Inner tree is trying to grow
});

View File

@ -0,0 +1,18 @@
actual = '';
expected = 'undefined,';
function f() {
(eval("\
(function () {\
for (var z = 0; z < 2; ++z) {\
x = ''\
}\
})\
"))();
}
__defineSetter__("x", eval)
f()
appendToActual(x);
assertEq(actual, expected)

View File

@ -0,0 +1,9 @@
setDebug(true);
function nop(){}
function caller(obj) {
assertJit();
return x;
}
trap(caller, 7, "var x = 'success'; nop()");
assertEq(caller(this), "success");

View File

@ -0,0 +1,10 @@
setDebug(true);
function nop(){}
function caller(obj) {
assertJit();
var x = ({ dana : "zuul" });
return x;
}
trap(caller, 23, "x = 'success'; nop()");
assertEq(caller(this), "success");

View File

@ -0,0 +1,10 @@
setDebug(true);
function nop(){}
function caller(obj) {
assertJit();
var x = "failure";
return x;
}
trap(caller, 14, "x = 'success'; nop()");
assertEq(caller(this), "success");

View File

@ -0,0 +1,9 @@
setDebug(true);
var x = "failure";
function main() { x = "success"; }
/* The JSOP_STOP in a. */
trap(main, 8, "");
main();
assertEq(x, "success");

View File

@ -0,0 +1,10 @@
setDebug(true);
var x = "notset";
function main() { x = "failure"; }
function success() { x = "success"; }
/* The JSOP_STOP in a. */
trap(main, 7, "success()");
main();
assertEq(x, "success");

View File

@ -0,0 +1,11 @@
setDebug(true);
var x = "notset";
function main() { x = "success"; }
function failure() { x = "failure"; }
/* The JSOP_STOP in a. */
trap(main, 8, "failure()");
untrap(main, 8);
main();
assertEq(x, "success");

View File

@ -0,0 +1,7 @@
setDebug(true);
function main() {
return "failure";
}
/* JSOP_RETURN in main. */
trap(main, 3, "'success'");
assertEq(main(), "success");

View File

@ -0,0 +1,7 @@
setDebug(true);
function main() {
return 1;
}
/* JSOP_RETURN in main. */
trap(main, 1, "0");
assertEq(main(), 0);

View File

@ -0,0 +1,15 @@
setDebug(true);
x = "notset";
function myparent(nested) {
if (nested) {
/* myparent call in myparent. */
trap(myparent, 39, "failure()");
} else {
x = "success";
myparent(true);
}
}
function failure() { x = "failure"; }
myparent(false);
assertEq(x, "success");

View File

@ -0,0 +1,21 @@
setDebug(true);
x = "notset";
function child() {
x = "failure1";
/* JSOP_STOP in parent. */
trap(parent, 10, "success()");
}
function parent() {
x = "failure2";
}
/* First op in parent. */
trap(parent, 0, "child()");
function success() {
x = "success";
}
parent();
assertEq(x, "success");

View File

@ -0,0 +1,16 @@
setDebug(true);
x = "notset";
function child() {
/* JSOP_STOP in parent. */
trap(parent, 17, "success()");
}
function parent() {
child();
x = "failure";
}
function success() {
x = "success";
}
parent()
assertEq(x, "success");

View File

@ -0,0 +1,18 @@
setDebug(true);
x = "notset";
function myparent(nested) {
if (nested) {
/* noop call in myparent */
trap(myparent, 50, "success()");
} else {
myparent(true);
x = "failure";
noop();
}
}
function noop() { }
function success() { x = "success"; }
myparent();
assertEq(x, "success");

View File

@ -0,0 +1,23 @@
setDebug(true);
x = "notset";
function doNothing() { }
function myparent(nested) {
if (nested) {
/* JSOP_CALL to doNothing in myparent with nested = true. */
trap(myparent, 24, "success()");
doNothing();
} else {
doNothing();
}
}
/* JSOP_CALL to doNothing in myparent with nested = false. */
trap(myparent, 35, "myparent(true)");
function success() {
x = "success";
}
myparent(false);
assertEq(x, "success");

View File

@ -0,0 +1,11 @@
setDebug(true);
x = "notset";
function main() {
/* The JSOP_STOP in a. */
trap(main, 25, "success()");
x = "failure";
}
function success() { x = "success"; }
main();
assertEq(x, "success");

View File

@ -0,0 +1,15 @@
setDebug(true);
x = "notset";
function child() {
/* JSOP_STOP in parent */
untrap(parent, 10);
x = "success";
}
function parent() {
x = "failure";
}
/* JSOP_STOP in parent */
trap(parent, 10, "child()");
parent();
assertEq(x, "success");

View File

@ -0,0 +1,13 @@
setDebug(true);
x = "notset";
function main() {
/* JSOP_STOP in main. */
untrap(main, 23);
x = "success";
}
function failure() { x = "failure"; }
/* JSOP_STOP in main. */
trap(main, 23, "failure()");
main();
assertEq(x, "success");

View File

@ -0,0 +1,60 @@
(function()[function() function() function() function() function() function() {}]);
foo = [{
text: "(function(){if(d){(1)}})",
s: function() {},
test: function() {
try {
f
} catch(e) {}
}
},
{
text: "(function(){t})",
s: function() {},
test: function() {}
},
{
text: "(function(){if(0){}})",
s: function() {},
test: function() {}
},
{
text: "(function(){if(1){}(2)})",
s: function() {},
test: function() {}
},
{
text: "(function(){g})",
b: function() {},
test: function() {}
},
{
text: "(function(){})",
s: function() {},
test: function() {}
},
{
text: "(function(){1})",
s: function() {},
test: function() {}
}]; (function() {
for (i = 0; i < foo.length; ++i) {
a = foo[i]
text = a.text
eval(text.replace(/@/, ""));
if (a.test()) {}
}
} ());
s = [function() function() function() function() function() function() {}]
[function() function() function() function() {}];
(function() { [function() function() {}] });
(function() {});
(eval("\
(function(){\
for each(d in[\
0,0,0,0,0,0,0,0,0,0,0,0,0,null,NaN,1,Boolean(false),Boolean(false)\
]){\
[].filter(new Function,gczeal(2))\
}\
})\
"))();

View File

@ -0,0 +1,422 @@
/*
* Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
Date.parseFunctions = {count:0};
Date.parseRegexes = [];
Date.formatFunctions = {count:0};
Date.prototype.dateFormat = function(format) {
if (Date.formatFunctions[format] == null) {
Date.createNewFormat(format);
}
var func = Date.formatFunctions[format];
return this[func]();
}
Date.createNewFormat = function(format) {
var funcName = "format" + Date.formatFunctions.count++;
Date.formatFunctions[format] = funcName;
var code = "Date.prototype." + funcName + " = function(){return ";
var special = false;
var ch = '';
for (var i = 0; i < format.length; ++i) {
ch = format.charAt(i);
if (!special && ch == "\\") {
special = true;
}
else if (special) {
special = false;
code += "'" + String.escape(ch) + "' + ";
}
else {
code += Date.getFormatCode(ch);
}
}
eval(code.substring(0, code.length - 3) + ";}");
}
Date.getFormatCode = function(character) {
switch (character) {
case "d":
return "String.leftPad(this.getDate(), 2, '0') + ";
case "D":
return "Date.dayNames[this.getDay()].substring(0, 3) + ";
case "j":
return "this.getDate() + ";
case "l":
return "Date.dayNames[this.getDay()] + ";
case "S":
return "this.getSuffix() + ";
case "w":
return "this.getDay() + ";
case "z":
return "this.getDayOfYear() + ";
case "W":
return "this.getWeekOfYear() + ";
case "F":
return "Date.monthNames[this.getMonth()] + ";
case "m":
return "String.leftPad(this.getMonth() + 1, 2, '0') + ";
case "M":
return "Date.monthNames[this.getMonth()].substring(0, 3) + ";
case "n":
return "(this.getMonth() + 1) + ";
case "t":
return "this.getDaysInMonth() + ";
case "L":
return "(this.isLeapYear() ? 1 : 0) + ";
case "Y":
return "this.getFullYear() + ";
case "y":
return "('' + this.getFullYear()).substring(2, 4) + ";
case "a":
return "(this.getHours() < 12 ? 'am' : 'pm') + ";
case "A":
return "(this.getHours() < 12 ? 'AM' : 'PM') + ";
case "g":
return "((this.getHours() %12) ? this.getHours() % 12 : 12) + ";
case "G":
return "this.getHours() + ";
case "h":
return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";
case "H":
return "String.leftPad(this.getHours(), 2, '0') + ";
case "i":
return "String.leftPad(this.getMinutes(), 2, '0') + ";
case "s":
return "String.leftPad(this.getSeconds(), 2, '0') + ";
case "O":
return "this.getGMTOffset() + ";
case "T":
return "this.getTimezone() + ";
case "Z":
return "(this.getTimezoneOffset() * -60) + ";
default:
return "'" + String.escape(character) + "' + ";
}
}
Date.parseDate = function(input, format) {
if (Date.parseFunctions[format] == null) {
Date.createParser(format);
}
var func = Date.parseFunctions[format];
return Date[func](input);
}
Date.createParser = function(format) {
var funcName = "parse" + Date.parseFunctions.count++;
var regexNum = Date.parseRegexes.length;
var currentGroup = 1;
Date.parseFunctions[format] = funcName;
var code = "Date." + funcName + " = function(input){\n"
+ "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n"
+ "var d = new Date();\n"
+ "y = d.getFullYear();\n"
+ "m = d.getMonth();\n"
+ "d = d.getDate();\n"
+ "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n"
+ "if (results && results.length > 0) {"
var regex = "";
var special = false;
var ch = '';
for (var i = 0; i < format.length; ++i) {
ch = format.charAt(i);
if (!special && ch == "\\") {
special = true;
}
else if (special) {
special = false;
regex += String.escape(ch);
}
else {
obj = Date.formatCodeToRegex(ch, currentGroup);
currentGroup += obj.g;
regex += obj.s;
if (obj.g && obj.c) {
code += obj.c;
}
}
}
code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"
+ "{return new Date(y, m, d, h, i, s);}\n"
+ "else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"
+ "{return new Date(y, m, d, h, i);}\n"
+ "else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n"
+ "{return new Date(y, m, d, h);}\n"
+ "else if (y > 0 && m >= 0 && d > 0)\n"
+ "{return new Date(y, m, d);}\n"
+ "else if (y > 0 && m >= 0)\n"
+ "{return new Date(y, m);}\n"
+ "else if (y > 0)\n"
+ "{return new Date(y);}\n"
+ "}return null;}";
Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$");
eval(code);
}
Date.formatCodeToRegex = function(character, currentGroup) {
switch (character) {
case "D":
return {g:0,
c:null,
s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};
case "j":
case "d":
return {g:1,
c:"d = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{1,2})"};
case "l":
return {g:0,
c:null,
s:"(?:" + Date.dayNames.join("|") + ")"};
case "S":
return {g:0,
c:null,
s:"(?:st|nd|rd|th)"};
case "w":
return {g:0,
c:null,
s:"\\d"};
case "z":
return {g:0,
c:null,
s:"(?:\\d{1,3})"};
case "W":
return {g:0,
c:null,
s:"(?:\\d{2})"};
case "F":
return {g:1,
c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10);\n",
s:"(" + Date.monthNames.join("|") + ")"};
case "M":
return {g:1,
c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "]], 10);\n",
s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};
case "n":
case "m":
return {g:1,
c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n",
s:"(\\d{1,2})"};
case "t":
return {g:0,
c:null,
s:"\\d{1,2}"};
case "L":
return {g:0,
c:null,
s:"(?:1|0)"};
case "Y":
return {g:1,
c:"y = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{4})"};
case "y":
return {g:1,
c:"var ty = parseInt(results[" + currentGroup + "], 10);\n"
+ "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
s:"(\\d{1,2})"};
case "a":
return {g:1,
c:"if (results[" + currentGroup + "] == 'am') {\n"
+ "if (h == 12) { h = 0; }\n"
+ "} else { if (h < 12) { h += 12; }}",
s:"(am|pm)"};
case "A":
return {g:1,
c:"if (results[" + currentGroup + "] == 'AM') {\n"
+ "if (h == 12) { h = 0; }\n"
+ "} else { if (h < 12) { h += 12; }}",
s:"(AM|PM)"};
case "g":
case "G":
case "h":
case "H":
return {g:1,
c:"h = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{1,2})"};
case "i":
return {g:1,
c:"i = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{2})"};
case "s":
return {g:1,
c:"s = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{2})"};
case "O":
return {g:0,
c:null,
s:"[+-]\\d{4}"};
case "T":
return {g:0,
c:null,
s:"[A-Z]{3}"};
case "Z":
return {g:0,
c:null,
s:"[+-]\\d{1,5}"};
default:
return {g:0,
c:null,
s:String.escape(character)};
}
}
Date.prototype.getTimezone = function() {
return this.toString().replace(
/^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace(
/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3");
}
Date.prototype.getGMTOffset = function() {
return (this.getTimezoneOffset() > 0 ? "-" : "+")
+ String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, "0")
+ String.leftPad(this.getTimezoneOffset() % 60, 2, "0");
}
Date.prototype.getDayOfYear = function() {
var num = 0;
Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
for (var i = 0; i < this.getMonth(); ++i) {
num += Date.daysInMonth[i];
}
return num + this.getDate() - 1;
}
Date.prototype.getWeekOfYear = function() {
// Skip to Thursday of this week
var now = this.getDayOfYear() + (4 - this.getDay());
// Find the first Thursday of the year
var jan1 = new Date(this.getFullYear(), 0, 1);
var then = (7 - jan1.getDay() + 4);
document.write(then);
return String.leftPad(((now - then) / 7) + 1, 2, "0");
}
Date.prototype.isLeapYear = function() {
var year = this.getFullYear();
return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
}
Date.prototype.getFirstDayOfMonth = function() {
var day = (this.getDay() - (this.getDate() - 1)) % 7;
return (day < 0) ? (day + 7) : day;
}
Date.prototype.getLastDayOfMonth = function() {
var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;
return (day < 0) ? (day + 7) : day;
}
Date.prototype.getDaysInMonth = function() {
Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
return Date.daysInMonth[this.getMonth()];
}
Date.prototype.getSuffix = function() {
switch (this.getDate()) {
case 1:
case 21:
case 31:
return "st";
case 2:
case 22:
return "nd";
case 3:
case 23:
return "rd";
default:
return "th";
}
}
String.escape = function(string) {
return string.replace(/('|\\)/g, "\\$1");
}
String.leftPad = function (val, size, ch) {
var result = new String(val);
if (ch == null) {
ch = " ";
}
while (result.length < size) {
result = ch + result;
}
return result;
}
Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
Date.monthNames =
["January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"];
Date.dayNames =
["Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"];
Date.y2kYear = 50;
Date.monthNumbers = {
Jan:0,
Feb:1,
Mar:2,
Apr:3,
May:4,
Jun:5,
Jul:6,
Aug:7,
Sep:8,
Oct:9,
Nov:10,
Dec:11};
Date.patterns = {
ISO8601LongPattern:"Y-m-d H:i:s",
ISO8601ShortPattern:"Y-m-d",
ShortDatePattern: "n/j/Y",
LongDatePattern: "l, F d, Y",
FullDateTimePattern: "l, F d, Y g:i:s A",
MonthDayPattern: "F d",
ShortTimePattern: "g:i A",
LongTimePattern: "g:i:s A",
SortableDateTimePattern: "Y-m-d\\TH:i:s",
UniversalSortableDateTimePattern: "Y-m-d H:i:sO",
YearMonthPattern: "F, Y"};
var date = new Date("1/1/2007 1:11:11");
var ret;
for (i = 0; i < 4000; ++i) {
var shortFormat = date.dateFormat("Y-m-d");
var longFormat = date.dateFormat("l, F d, Y g:i:s A");
ret = shortFormat + longFormat;
date.setTime(date.getTime() + 84266956);
}
// No exact match because the output depends on the locale's time zone. See bug 524490.
assertEq(/^2017-09-05Tuesday, September 05, 2017 [0-9:]* AM$/.exec(ret) != null, true);

View File

@ -0,0 +1,41 @@
// The Computer Language Shootout
// http://shootout.alioth.debian.org/
// contributed by Isaac Gouy
function partial(n){
var a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0.0;
var twothirds = 2.0/3.0;
var alt = -1.0;
var k2 = k3 = sk = ck = 0.0;
for (var k = 1; k <= n; k++){
k2 = k*k;
k3 = k2*k;
sk = Math.sin(k);
ck = Math.cos(k);
alt = -alt;
a1 += Math.pow(twothirds,k-1);
a2 += Math.pow(k,-0.5);
a3 += 1.0/(k*(k+1.0));
a4 += 1.0/(k3 * sk*sk);
a5 += 1.0/(k3 * ck*ck);
a6 += 1.0/k;
a7 += 1.0/k2;
a8 += alt/k;
a9 += alt/(2*k -1);
}
return [ a1, a2, a3, a4, a5, a6, a7, a8, a9 ];
}
var actual = [];
for (var i = 1024; i <= 16384; i *= 2)
Array.prototype.push.apply(actual, partial(i));
var eps = 1e-12;
var expect = [2.9999999999999987,62.555269219624684,0.9990243902439033,30.174793391263677,42.99468748637077,7.509175672278132,1.6439579810301654,0.6926591377284127,0.785154022830656,2.9999999999999987,89.06036157695789,0.9995119570522216,30.30796333494624,42.99485339033617,8.202078771817716,1.6444459047881168,0.6929030995395857,0.7852760930922243,2.9999999999999987,126.54745783224483,0.999755918965097,30.314167756318135,42.994888939123,8.89510389696629,1.6446899560231332,0.6930251251486118,0.7853371282421086,2.9999999999999987,179.56450569047874,0.9998779445868421,30.314499725429847,42.99489723774016,9.588190046095265,1.644812003986005,0.693086149128997,0.785367645819433,2.9999999999999987,254.54355172132264,0.9999389685688135,30.31451920492601,42.99489939769195,10.281306710008463,1.6448730335545856,0.6931166639131536,0.7853829046083998];
assertEq(actual.length, expect.length);
for (var i = 0; i < expect.length; ++i)
assertEq(Math.abs(actual[i] - expect[i]) < eps, true);

File diff suppressed because one or more lines are too long

View File

@ -53,8 +53,10 @@ static JSFunctionSpec ptestFunctions[] = {
BEGIN_TEST(testClassGetter_isCalled)
{
CHECK(JS_InitClass(cx, JS_GetGlobalObject(cx), NULL, &ptestClass, PTest, 0,
NULL, ptestFunctions, NULL, NULL));
JSObject *my_proto;
my_proto = JS_InitClass(cx, JS_GetGlobalObject(cx), NULL, &ptestClass, PTest, 0,
NULL, ptestFunctions, NULL, NULL);
EXEC("function check() { var o = new PTest(); o.test_fn(); o.test_value1; o.test_value2; o.test_value1; }");

View File

@ -0,0 +1,24 @@
url-prefix ../../jsreftest.html?test=js1_8_1/jit/
script math-jit-tests.js
skip script regress-451673.js # bogus perf test (bug 540512)
skip script regress-451974-01.js # bogus perf test (bug 540512)
skip script regress-451974-02.js # bogus perf test (bug 540512)
skip script regress-452498-01.js # bogus perf test (bug 540512)
script regress-458838.js
script regress-462459-01.js
script regress-462459-02.js
script regress-462459-03.js
script regress-462459-04.js
script regress-462459-05.js
script regress-462459-06.js
script regress-462459-07.js
script regress-462459-08.js
script regress-462459-09.js
script regress-462459-10.js
script regress-462459-11.js
script regress-462459-12.js
skip script regress-469927.js # bogus perf test (bug 540512)
skip script regress-470739.js # bogus perf test (bug 540512)
script regress-471635.js
script regress-489682.js
script testDeepBailFromNonNative.js

View File

@ -0,0 +1,115 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Boris Zbarsky
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
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)
jit(true);
else
jit(false);
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)
jit(false);
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');
}

View File

@ -0,0 +1,86 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Andreas Gal
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
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;
}
jit(false);
var timenonjit = loop();
jit(true);
var timejit = loop();
jit(false);
print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
expect = true;
actual = timejit < timenonjit/2;
reportCompare(expect, actual, summary);

View File

@ -0,0 +1,97 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Andreas Gal
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
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;
}
jit(false);
var timenonjit = loop();
jit(true);
var timejit = loop();
jit(false);
print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
expect = true;
actual = timejit < timenonjit/2;
reportCompare(expect, actual, summary);
exitFunc ('test');
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,95 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Boris Zbarksy
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
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);
jit(true);
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;
if (this.tracemonkey)
{
recorderStarted = this.tracemonkey.recorderStarted;
recorderAborted = this.tracemonkey.recorderAborted;
traceCompleted = this.tracemonkey.traceCompleted;
}
jit(false);
reportCompare(expect, actual, summary + ': return value 10');
if (this.tracemonkey)
{
expect = 'recorderStarted=1, recorderAborted=0, traceCompleted=1';
actual = 'recorderStarted=' + recorderStarted + ', recorderAborted=' + recorderAborted + ', traceCompleted=' + traceCompleted;
reportCompare(expect, actual, summary + ': trace');
}
exitFunc ('test');
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace Array()';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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();
}
jit(false);
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);
}

View File

@ -0,0 +1,106 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace Array(1)';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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);
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace Array(1, 2)';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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);
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace Array(1, 2, 3)';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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);
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace new Array()';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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();
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace new Array(1)';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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);
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace new Array(1, 2)';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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);
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace new Array(1, 2, 3)';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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);
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace []';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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++)
{
[];
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace [1]';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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];
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace [1, 2]';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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];
}
jit(false);
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);
}

View File

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 462459;
var summary = 'TM: trace [1, 2, 3]';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
if (!this.tracemonkey)
{
jit(false);
expect = actual = 'Test skipped due to lack of tracemonkey jitstats';
reportCompare(expect, actual, summary);
}
else
{
jit(true);
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];
}
jit(false);
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);
}

View File

@ -0,0 +1,78 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
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;
}
jit(false);
var timenonjit = letitbe();
jit(true);
var timejit = letitbe();
jit(false);
print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
expect = true;
actual = timejit < timenonjit;
reportCompare(expect, actual, summary);
exitFunc ('test');
}

View File

@ -0,0 +1,80 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
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;
}
jit(false);
var timenonjit = loop();
jit(true);
var timejit = loop();
jit(false);
print('time: nonjit = ' + timenonjit + ', jit = ' + timejit);
expect = true;
actual = timejit < timenonjit;
reportCompare(expect, actual, summary);
exitFunc ('test');
}

View File

@ -0,0 +1,88 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Boris Zbarksy
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 471635;
var summary = 'TM: trace js shell print()';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
(function(){
for (var i = 1; i < 20; ++i) {
print("#");
}
})();
var recorderStarted;
var recorderAborted;
var traceCompleted;
if (this.tracemonkey)
{
recorderStarted = this.tracemonkey.recorderStarted;
recorderAborted = this.tracemonkey.recorderAborted;
traceCompleted = this.tracemonkey.traceCompleted;
}
jit(false);
if (this.tracemonkey)
{
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');
}

View File

@ -0,0 +1,65 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var BUGNUMBER = 489682;
var summary = 'TM: wrong number with nested type-unstable loops';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
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);
jit(false);
expect = '0';
actual = v + '';
reportCompare(expect, actual, summary);

View File

@ -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;