Bug 1313490 - Part 1: Remove unnecessary expression closure from jit-test. r=evilpie

This commit is contained in:
Tooru Fujisawa 2016-11-26 06:41:42 +09:00
parent ef27a35df3
commit b15d6aadc1
102 changed files with 248 additions and 208 deletions

View File

@ -3,7 +3,7 @@ if (typeof SIMD === 'undefined')
Int8x16 = SIMD.Int8x16;
var Int32x4 = SIMD.Int32x4;
function testSwizzleForType(type) type();
function testSwizzleForType(type) { return type(); }
testSwizzleForType(Int8x16);
function testSwizzleInt32x4() testSwizzleForType(Int32x4);
function testSwizzleInt32x4() { return testSwizzleForType(Int32x4); }
testSwizzleInt32x4();

View File

@ -10,7 +10,8 @@ var ValueStruct = new T.StructType({
})
var v = new ValueStruct;
new class get extends Number {};
function writeValue(o, v)
o.f = v
function writeValue(o, v) {
return o.f = v;
}
for (var i = 0; i < 5; i++)
writeValue(v, {}, "helo")

View File

@ -1,9 +1,9 @@
function f1(a, bIs, cIs, dIs, {b}={b: 3}, c=4, [d]=[5]) (
function f1(a, bIs, cIs, dIs, {b}={b: 3}, c=4, [d]=[5]) {
assertEq(a, 1),
assertEq(b, bIs),
assertEq(c, cIs),
assertEq(d, dIs)
);
}
assertEq(f1.length, 4);
f1(1, 3, 4, 5);
f1(1, 42, 43, 44, {b: 42}, 43, [44]);

View File

@ -1,6 +1,6 @@
// See bug 763313
load(libdir + "iteration.js");
function f([a]) a
function f([a]) { return a; }
var i = 0;
var o = {[Symbol.iterator]: function () { i++; return {
next: function () { i++; return {value: 42, done: false}; }}}};

View File

@ -58,7 +58,7 @@ assertThrowsInstanceOf(rec, InternalError);
var rec = asmLink(asmCompile(USE_ASM+"function rec(i) { i=i|0; if (!i) return 0; return ((rec((i-1)|0)|0)+1)|0 } return rec"));
assertEq(rec(100), 100);
assertEq(rec(1000), 1000);
assertThrowsInstanceOf(function() rec(100000000000), InternalError);
assertThrowsInstanceOf(() => rec(100000000000), InternalError);
assertEq(rec(2000), 2000);
assertAsmTypeFail(USE_ASM+"function f(){return 0} function g() { var i=0; i=f() } return g");

View File

@ -6,6 +6,8 @@ loadFile("");
loadFile(` function lalala() {}
new Map([[1, 2]]).forEach(lalala)
`);
function loadFile(lfVarx) oomTest(function() {
eval(lfVarx)
})
function loadFile(lfVarx) {
return oomTest(function() {
eval(lfVarx)
});
}

View File

@ -3,7 +3,7 @@
g = newGlobal();
g.parent = this;
g.eval("(" + function() {
Debugger(parent).onExceptionUnwind = function() 0;
Debugger(parent).onExceptionUnwind = function() { return 0; };
} + ")()");
async function f() {
t;

View File

@ -3,5 +3,5 @@
//
(function(){
var x;
eval("var x; ((function ()x)())");
eval("var x; ((function () { return x; })())");
})()

View File

@ -4,7 +4,7 @@
function f(foo)
{
var x;
eval("this.__defineGetter__(\"y\", function ()x)");
eval("this.__defineGetter__(\"y\", function () { return x; })");
}
f("");
try {

View File

@ -5,9 +5,9 @@ function f(param) {
var w;
return eval("\
(function(){\
this.__defineGetter__(\"y\", function()({\
this.__defineGetter__(\"y\", function() { return ({\
x: function(){ return w }()\
}))\
}); })\
});\
");
}

View File

@ -3,7 +3,7 @@
//
function f(a) {
function g() {
yield function () a;
yield function () { return a; };
}
return g();
}

View File

@ -2,4 +2,4 @@
// Flags:
//
options('strict')
Function("function y(x,x)d")
Function("function y(x,x) { return d; }")

View File

@ -5,5 +5,6 @@
//
AddRegExpCases(/a*b/, "xxx", 0, null );
AddRegExpCases(/x\d\dy/, "abcx45ysss235", 3,[] );
function AddRegExpCases(regexp, pattern, index, matches_array )
(matches_array.length, regexp)
function AddRegExpCases(regexp, pattern, index, matches_array ) {
return (matches_array.length, regexp);
}

View File

@ -7,8 +7,8 @@ function TestCase(n, d, e, a) {
this.description=d
gTestcases[gTc++]=this
}
TestCase.prototype.dump=function () + toPrinted(this.description)
function toPrinted(value) value=value;
TestCase.prototype.dump=function () { return + toPrinted(this.description); };
function toPrinted(value) { return value=value; }
function reportCompare (expected, actual, description) {
new TestCase("unknown-test-name", description, expected, actual)
}

View File

@ -1,10 +1,11 @@
// Binary: cache/js-opt-32-2dc40eb83023-linux
// Flags: -m -n -a
//
function toPrinted(value)
value = value.replace(/\\n/g, 'NL')
.replace(/\\r/g, 'CR')
.replace(/[^\x20-\x7E]+/g, escapeString);
function toPrinted(value) {
return value = value.replace(/\\n/g, 'NL')
.replace(/\\r/g, 'CR')
.replace(/[^\x20-\x7E]+/g, escapeString);
}
function escapeString (str)
{
var a, b, c, d;

View File

@ -4,8 +4,9 @@
gczeal(4);
function startTest() {}
function TestCase(n, d, e, a)
dump = (function () {});
function TestCase(n, d, e, a) {
return dump = (function () {});
}
if (typeof document != "object" || !document.location.href.match(/jsreftest.html/)) {}
function writeHeaderToLog( string ) {}
var SECTION = "11.4.5";

View File

@ -2,6 +2,6 @@
// Flags:
//
x = Set;
eval("function y()(Iterator)", this);
eval("function y() { return Iterator; }", this);
x.__iterator__ = y;
new Iterator(x)

View File

@ -1,4 +1,4 @@
function newFunc(x) Function(x)()
function newFunc(x) { return Function(x)(); }
newFunc(`
var BUGNUMBER = 8[ anonymous = true ]--;
() => BUGNUMBER;

View File

@ -4,7 +4,9 @@
// Baseline should not attempt to compile the script.
i = 1;
function test(s) eval("line0 = Error.lineNumber\ndebugger\n" + s);
function test(s) {
return eval("line0 = Error.lineNumber\ndebugger\n" + s);
}
function repeat(s) {
return Array(65 << 13).join(s)
}

View File

@ -14,8 +14,9 @@ function printStatus (msg) {
print (STATUS + lines[i]);
}
function printBugNumber (num) {}
function toPrinted(value)
function escapeString (str) {}
function toPrinted(value) {
return function escapeString (str) {};
}
function reportCompare (expected, actual, description) {
var actual_t = typeof actual;
var output = "";
@ -32,9 +33,10 @@ function reportCompare (expected, actual, description) {
return testcase.passed;
}
function reportMatch (expectedRegExp, actual, description) {}
function enterFunc (funcName)
function BigO(data) {
function LinearRegression(data) { }
function enterFunc (funcName) {
return function BigO(data) {
function LinearRegression(data) { }
};
}
function compareSource(expect, actual, summary) {}
function optionsInit() {
@ -44,9 +46,10 @@ function optionsClear() {}
function optionsPush() {}
optionsInit();
optionsClear();
function getTestCaseResult(expected, actual)
function test() {
for ( gTc=0; gTc < gTestcases.length; gTc++ ) {}
function getTestCaseResult(expected, actual) {
return function test() {
for ( gTc=0; gTc < gTestcases.length; gTc++ ) {}
};
}
var lfcode = new Array();
lfcode.push("4");
@ -62,7 +65,7 @@ addThis();\n\
addThis();\n\
tryThis(1);\n\
function tryThis(x)\n\
addThis();\n\
{ return addThis(); }\n\
test();\n\
function addThis() {\n\
actualvalues[UBound] = actual;\n\

View File

@ -1,7 +1,8 @@
setJitCompilerOption("ion.warmup.trigger", 30);
function ArrayCallback(state)
this.state = state;
function ArrayCallback(state) {
return this.state = state;
}
ArrayCallback.prototype.isUpperCase = function(v, index, array) {
return this.state ? true : (v == v.toUpperCase());
};

View File

@ -1,6 +1,6 @@
function f(a) {
function g() {
yield function () a;
yield function () { return a; };
}
if (a == 8)
return g();

View File

@ -8,6 +8,7 @@ test();
function test() {
[ {0xBe: /l/|| 'Error' ? s++ : summary } ]
}
function foo(code)
Function(code)();
function foo(code) {
return Function(code)();
}
foo("for each (y in this);");

View File

@ -26,7 +26,7 @@ function f2() {
x
} = x, (x._)
function
x()({})
x(){ return ({}); }
}
try { f2(); } catch (e) {}

View File

@ -1,5 +1,5 @@
function reportCompare(expected, actual, description) + ++actual + "'";
function reportCompare(expected, actual, description) { return + ++actual + "'"; }
var summary = 'Object.prototype.toLocaleString() should track Object.prototype.toString() ';
var o = {
toString: function () {}

View File

@ -13,7 +13,7 @@ try {
valueOf: gc
} - [])
} catch (prop) {}
function addThis() reportCompare(expect, actual, 'ok');
function addThis() { return reportCompare(expect, actual, 'ok'); }
Object.defineProperty(Object.prototype, "name", {
set: function (newValue) {}
});

View File

@ -1,5 +1,5 @@
Function.prototype.toString = function () f(this, true);
Function.prototype.toString = function () { return f(this, true); };
function f(obj) {
f.caller.p
}

View File

@ -13,8 +13,9 @@ function reportCompare (expected, actual, description) {
var testcase = new TestCase("unknown-test-name", description, expected, actual);
reportFailure (description + " : " + output);
}
function enterFunc (funcName)
callStack.push(funcName);
function enterFunc (funcName) {
return callStack.push(funcName);
}
try {
reportCompare(expectCompile, actualCompile,
summary + ': compile actual');

View File

@ -40,7 +40,7 @@ try {
try {
var f = function() {
{
print(new function(q)("", s))
print(new function(q) { return ("", s); })
let u
}
};

View File

@ -47,7 +47,7 @@ function check(b, desc) {
assertEq(Object.getPrototypeOf(a), ca == "[object Object]" ? Object.prototype : Array.prototype, path)
pb = ownProperties(b).filter(isCloneable)
pa = ownProperties(a)
function byName(a, b) 0
function byName(a, b) { return 0; }
byName
(pa.length, pb.length, "should see the same number of properties " + path)
for (var i = 0; i < pa.length; i++) {

View File

@ -1,5 +1,6 @@
function TestCase(n, d, e, a)
this.reason = '';
function TestCase(n, d, e, a) {
return this.reason = '';
}
function reportCompare (expected, actual, description) {
var output = "";
var testcase = new TestCase("unknown-test-name", description, expected, actual);

View File

@ -6,6 +6,6 @@ function test(str, f) {\
var x = f(eval(str));\
assertEq(x, f(g1.eval(str)));\
}\
test('new RegExp(\"1\")', function(r) assertEq('a1'.search(r), 1));\
test('new RegExp(\"1\")', function(r) { return assertEq('a1'.search(r), 1); });\
" + " })();");
eval("(function() { " + "" + " })();");

View File

@ -4,5 +4,5 @@ function foo(x, y) {
this.g = x + y;
}
var a = 0;
var b = { valueOf: function() Object.defineProperty(Object.prototype, 'g', {}) };
var b = { valueOf: function() { return Object.defineProperty(Object.prototype, 'g', {}); } };
var c = new foo(a, b);

View File

@ -2,5 +2,5 @@ function example(a, b, c) {
var complicated = 3;
perform_some_operations();
}
var myfun = function (a, b) a + b;
var myfun = function (a, b) { return a + b; }
assertEq(decompileThis(), snarf(thisFilename()));

View File

@ -1,7 +1,7 @@
var o = {get prop() a + b, set prop(x) a + b};
var o = {get prop() { a + b; }, set prop(x) { a + b; }};
var prop = Object.getOwnPropertyDescriptor(o, "prop");
assertEq(prop.get.toString(), "function get prop() a + b");
assertEq(prop.get.toSource(), "(function get prop() a + b)");
assertEq(prop.set.toString(), "function set prop(x) a + b");
assertEq(prop.set.toSource(), "(function set prop(x) a + b)");
assertEq(o.toSource(), "({get prop () a + b, set prop (x) a + b})");
assertEq(prop.get.toString(), "function get prop() { a + b; }");
assertEq(prop.get.toSource(), "(function get prop() { a + b; })");
assertEq(prop.set.toString(), "function set prop(x) { a + b; }");
assertEq(prop.set.toSource(), "(function set prop(x) { a + b; })");
assertEq(o.toSource(), "({get prop () { a + b; }, set prop (x) { a + b; }})");

View File

@ -43,17 +43,17 @@ function shapelessCalleeTest()
{
var a = [];
var helper = function (i, a) a[i] = i;
shapelessArgCalleeLoop(helper, helper, function (i, a) a[i] = -i, a);
var helper = function (i, a) { a[i] = i; };
shapelessArgCalleeLoop(helper, helper, function (i, a) { a[i] = -i; }, a);
helper = function (i, a) a[10 + i] = i;
shapelessVarCalleeLoop(helper, helper, function (i, a) a[10 + i] = -i, a);
helper = function (i, a) { a[10 + i] = i; };
shapelessVarCalleeLoop(helper, helper, function (i, a) { a[10 + i] = -i; }, a);
helper = function (i, a) a[20 + i] = i;
shapelessLetCalleeLoop(helper, helper, function (i, a) a[20 + i] = -i, a);
helper = function (i, a) { a[20 + i] = i; };
shapelessLetCalleeLoop(helper, helper, function (i, a) { a[20 + i] = -i; }, a);
helper = function (i, a) a[30 + i] = i;
shapelessUnknownCalleeLoop(null, helper, helper, function (i, a) a[30 + i] = -i, a);
helper = function (i, a) { a[30 + i] = i; };
shapelessUnknownCalleeLoop(null, helper, helper, function (i, a) { a[30 + i] = -i; }, a);
try {
helper = {hack: 42};

View File

@ -53,7 +53,7 @@ function checkNormal(f) {
assertEqArray(f.apply(null, ...[[undefined]]), [undefined, undefined, undefined]);
}
checkNormal(function(a, b, c) [a, b, c]);
checkNormal(function(a, b, c) { return [a, b, c]; });
checkNormal((a, b, c) => [a, b, c]);
function checkDefault(f) {
@ -67,7 +67,7 @@ function checkDefault(f) {
assertEqArray(f.apply(null, ...[[undefined]]), [-1, -2, -3]);
}
checkDefault(function(a = -1, b = -2, c = -3) [a, b, c]);
checkDefault(function(a = -1, b = -2, c = -3) { return [a, b, c]; });
checkDefault((a = -1, b = -2, c = -3) => [a, b, c]);
function checkRest(f) {
@ -84,5 +84,5 @@ function checkRest(f) {
assertEqArray(f.apply(null, ...new Map([[["a", "A"], ["b", "B"]]])).map(([k, v]) => k + v), ["aA", "bB"]);
}
checkRest(function(...x) x);
checkRest(function(...x) { return x; });
checkRest((...x) => x);

View File

@ -7,5 +7,5 @@ function check(f) {
assertEqArray(f.call(...[null, 1, ...[2, 3], 4, ...[5, 6]]), [1, 2, 3, 4, 5, 6]);
}
check(function(...x) x);
check(function(...x) { return x; });
check((...x) => x);

View File

@ -44,8 +44,8 @@ function checkLength(f, makeFn) {
assertEq(makeFn("...arg")(f, gen()), 3);
}
checkLength(function(x) arguments.length, makeCall);
checkLength(function(x) arguments.length, makeFunCall);
checkLength(function(x) { return arguments.length; }, makeCall);
checkLength(function(x) { return arguments.length; }, makeFunCall);
function lengthClass(x) {
this.length = arguments.length;
}

View File

@ -14,13 +14,13 @@ var foo = {}
foo[Symbol.iterator] = 10;
assertThrowsInstanceOf(() => Math.sin(...foo), TypeError);
foo[Symbol.iterator] = function() undefined;
foo[Symbol.iterator] = function() { return undefined; };
assertThrowsInstanceOf(() => Math.sin(...foo), TypeError);
foo[Symbol.iterator] = function() this;
foo[Symbol.iterator] = function() { return this; };
assertThrowsInstanceOf(() => Math.sin(...foo), TypeError);
foo[Symbol.iterator] = function() this;
foo[Symbol.iterator] = function() { return this; };
foo.next = function() { throw 10; };
assertThrowsValue(() => Math.sin(...foo), 10);

View File

@ -9,9 +9,9 @@ function check(f) {
}
}
let f = function() f(...a) + 1;
let f = function() { return f(...a) + 1; };
let g = () => g(...a) + 1;
let h = function() new h(...a) + 1;
let h = function() { return new h(...a) + 1; };
check(f);
check(g);

View File

@ -57,8 +57,8 @@ function checkNormal(f, makeFn) {
assertEqArray(makeFn("...[undefined]")(f), [undefined, undefined, undefined]);
}
checkNormal(function(a, b, c) [a, b, c], makeCall);
checkNormal(function(a, b, c) [a, b, c], makeFunCall);
checkNormal(function(a, b, c) { return [a, b, c]; }, makeCall);
checkNormal(function(a, b, c) { return [a, b, c]; }, makeFunCall);
checkNormal((a, b, c) => [a, b, c], makeCall);
checkNormal((a, b, c) => [a, b, c], makeFunCall);
function normalClass(a, b, c) {
@ -78,8 +78,8 @@ function checkDefault(f, makeFn) {
assertEqArray(makeFn("...[undefined]")(f), [-1, -2, -3]);
}
checkDefault(function(a = -1, b = -2, c = -3) [a, b, c], makeCall);
checkDefault(function(a = -1, b = -2, c = -3) [a, b, c], makeFunCall);
checkDefault(function(a = -1, b = -2, c = -3) { return [a, b, c]; }, makeCall);
checkDefault(function(a = -1, b = -2, c = -3) { return [a, b, c]; }, makeFunCall);
checkDefault((a = -1, b = -2, c = -3) => [a, b, c], makeCall);
checkDefault((a = -1, b = -2, c = -3) => [a, b, c], makeFunCall);
function defaultClass(a = -1, b = -2, c = -3) {
@ -99,8 +99,8 @@ function checkRest(f, makeFn) {
assertEqArray(makeFn("...[undefined]")(f), [undefined]);
}
checkRest(function(...x) x, makeCall);
checkRest(function(...x) x, makeFunCall);
checkRest(function(...x) { return x; }, makeCall);
checkRest(function(...x) { return x; }, makeFunCall);
checkRest((...x) => x, makeCall);
checkRest((...x) => x, makeFunCall);
function restClass(...x) {

View File

@ -1,12 +1,12 @@
const C = function (a, b, c) {
return function C() {
this.m1 = function () a;
this.m2 = function () b;
this.m3 = function () c;
this.m1 = function () { return a; };
this.m2 = function () { return b; };
this.m3 = function () { return c; };
}
}(2,3,4);
var c = new C();
var d = function (e) {return {m0: function () e}}(5);
var d = function (e) {return {m0: function () { return e; }}}(5);
for (var i = 0; i < 5; i++)
d.m0();
C.call(d);

View File

@ -1,6 +1,7 @@
function g1() {}
function g2()
function Int8Array () {}
function g2() {
return function Int8Array () {};
}
function f1(other) {
eval("gc(); h = g1");
for(var i=0; i<20; i++) {

View File

@ -1 +1 @@
assertEq((function(x, y, x) { return (function() x+y)(); })(1,2,5), 7);
assertEq((function(x, y, x) { return (function() { return x+y; })(); })(1,2,5), 7);

View File

@ -3,7 +3,7 @@ function testCallProtoMethod() {
X.prototype.getName = function () { return "X"; }
function Y() { this.x = 2; }
Y.prototype.getName = function() "Y";
Y.prototype.getName = function() { return "Y"; };
var a = [new X, new X, new X, new X, new Y];
var s = '';

View File

@ -4,9 +4,9 @@ assertEq((function() { var x; x = 3; return (function() { return x } )() })(), 3
assertEq((function() { x = 3; var x; return (function() { return x } )() })(), 3);
assertEq((function() { var x; var g = function() { return x }; x = 3; return g() })(), 3);
assertEq((function() { function f() { return 3 }; assertEq(f(), 3); return (function() f())() })(), 3);
assertEq((function() { function f() { return 3 }; assertEq(f(), 3); return (function() { return f(); })(); })(), 3);
assertEq((function() { function f() { return 3 }; assertEq(f(), 3); return eval('f()') })(), 3);
assertEq((function() { function f() { return 3 }; (function() f())(); return f() })(), 3);
assertEq((function() { function f() { return 3 }; (function() { return f(); })(); return f() })(), 3);
assertEq((function() { var x = 3; return eval("x") })(), 3);
assertEq((function() { var x; x = 3; return eval("x") })(), 3);
@ -26,39 +26,39 @@ assertEq((function(x) { return eval("x") })(3), 3);
assertEq((function(x) { x = 3; return eval("x") })(4), 3);
assertEq((function(a) { var [x,y] = a; (function() { x += y })(); return x })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return (function() x)() })([1,2]), 3);
assertEq((function(a) { var [[l, x],[m, y]] = a; x += y; return (function() x)() })([[0,1],[0,2]]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return (function() { return x; })() })([1,2]), 3);
assertEq((function(a) { var [[l, x],[m, y]] = a; x += y; return (function() { return x; })() })([[0,1],[0,2]]), 3);
assertEq((function(a) { var [x,y] = a; eval('x += y'); return x })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return eval('x') })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; (function() { x += y })(); return x })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return (function() x)() })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return (function() { return x; })() })([1,2]), 3);
assertEq((function(a,x,y) { [x,y] = a; (function() { eval('x += y') })(); return x })([1,2]), 3);
assertEq((function(a,x,y) { [x,y] = a; x += y; return (function() eval('x'))() })([1,2]), 3);
assertEq((function(a,x,y) { [x,y] = a; x += y; return (function() { return eval('x'); })() })([1,2]), 3);
assertEq((function() { var [x,y] = [1,2]; x += y; return (function() x)() })(), 3);
assertEq((function() { var [x,y] = [1,2]; (function() x += y)(); return x })(), 3);
assertEq((function() { { let [x,y] = [1,2]; x += y; return (function() x)() } })(), 3);
assertEq((function() { { let [x,y] = [1,2]; (function() x += y)(); return x } })(), 3);
assertEq((function() { var [x,y] = [1,2]; x += y; return (function() { return x; })() })(), 3);
assertEq((function() { var [x,y] = [1,2]; (function() { return x += y; })(); return x })(), 3);
assertEq((function() { { let [x,y] = [1,2]; x += y; return (function() { return x; })() } })(), 3);
assertEq((function() { { let [x,y] = [1,2]; (function() { return x += y; })(); return x } })(), 3);
assertEq((function([x,y]) { (function() { x += y })(); return x })([1,2]), 3);
assertEq((function([x,y]) { x += y; return (function() x)() })([1,2]), 3);
assertEq((function([x,y]) { x += y; return (function() { return x; })() })([1,2]), 3);
assertEq((function([[l,x],[m,y]]) { (function() { x += y })(); return x })([[0,1],[0,2]]), 3);
assertEq((function([[l,x],[m,y]]) { x += y; return (function() x)() })([[0,1],[0,2]]), 3);
assertEq((function([[l,x],[m,y]]) { x += y; return (function() { return x; })() })([[0,1],[0,2]]), 3);
assertEq((function([x,y]) { (function() { eval('x += y') })(); return x })([1,2]), 3);
assertEq((function([x,y]) { x += y; return (function() eval('x'))() })([1,2]), 3);
assertEq((function([x,y]) { x += y; return (function() { return eval('x'); })() })([1,2]), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { eval('x += y'); return x }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return eval('x') }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { (function() { x += y })(); return x }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return (function() x)() }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return (function() { return x; })() }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { (function() { eval('x += y') })(); return x }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return (function() eval('x'))() }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return (function() { return eval('x'); })() }})(), 3);
assertEq((function(a) { let [x,y] = a; (function() { x += y })(); return x })([1,2]), 3);
assertEq((function(a) { let [x,y] = a; x += y; return (function() x)() })([1,2]), 3);
assertEq((function(a) { let [x,y] = a; x += y; return (function() { return x; })() })([1,2]), 3);
assertEq((function(a) { { let [x,y] = a; (function() { x += y })(); return x } })([1,2]), 3);
assertEq((function(a) { { let [x,y] = a; x += y; return (function() x)() } })([1,2]), 3);
assertEq((function(a) { { let [x,y] = a; x += y; return (function() { return x; })() } })([1,2]), 3);
assertEq((function(a) { { let [[l, x],[m, y]] = a; (function() { x += y })(); return x } })([[0,1],[0,2]]), 3);
assertEq((function(a) { { let [[l, x],[m, y]] = a; x += y; return (function() x)() } })([[0,1],[0,2]]), 3);
assertEq((function(a) { { let [[l, x],[m, y]] = a; x += y; return (function() { return x; })() } })([[0,1],[0,2]]), 3);
assertEq((function() { let x = 3; return (function() { return x })() })(), 3);
assertEq((function() { let g = function() { return x }; let x = 3; return g() })(), 3);
@ -69,7 +69,7 @@ assertEq((function() { { let x = 2; x = 3; return (function() { return x })() }
assertEq((function() { { let x = 1; { let x = 3; (function() { assertEq(x,3) })() } return x } })(), 1);
assertEq((function() { try { throw 3 } catch (e) { (function(){assertEq(e,3)})(); return e } })(), 3);
assertEq((function() { try { throw 3 } catch (e) { assertEq(e, 3); return (function() e)() } })(), 3);
assertEq((function() { try { throw 3 } catch (e) { assertEq(e, 3); return (function() { return e; })() } })(), 3);
assertEq((function() { try { throw 3 } catch (e) { (function(){eval('assertEq(e,3)')})(); return e } })(), 3);
assertEq((function() { var x; function f() { return x } function f() { return 3 }; return f() })(), 3);

View File

@ -20,8 +20,9 @@ var dbg = new Debugger(g1, g2, g3);
function script(func) {
var gw = dbg.addDebuggee(func.global);
var script = gw.makeDebuggeeValue(func).script;
script.toString = function ()
"[Debugger.Script for " + func.name + " in " + uneval(func.global) + "]";
script.toString = function () {
return "[Debugger.Script for " + func.name + " in " + uneval(func.global) + "]";
};
return script;
}

View File

@ -1,7 +1,7 @@
gczeal(2);
g = newGlobal();
dbg = Debugger(g);
dbg.onNewScript = function() function() this;
dbg.onNewScript = function() { return function() { return this; } };
schedulegc(10);
g.eval("setLazyParsingDisabled(true)");
g.evaluate("function one() {}");

View File

@ -15,7 +15,7 @@ if (!('oomAfterAllocations' in this))
setBreakpoint;
}
}
g.eval("" + function f(d) toggle(d))
g.eval("" + function f(d) { return toggle(d); })
g.eval("(" + function() {
f(false);
f(true);

View File

@ -13,7 +13,7 @@ file = lfcode.shift();
loadFile(file);
function loadFile(lfVarx) {
try {
function newFunc(x) Function(x)();
function newFunc(x) { return Function(x)(); }
newFunc(lfVarx)();
} catch (lfVare) {
print(lfVare)

View File

@ -3,7 +3,7 @@
g = newGlobal();
dbg = Debugger(g);
hits = 0;
dbg.onNewScript = function () hits++;
dbg.onNewScript = function () { return hits++; };
assertEq(g.eval("eval('2 + 3')"), 5);
this.gczeal(hits,1);
dbg = Debugger(g);

View File

@ -20,7 +20,7 @@ function check(expr, expected = expr) {
for ([end, err] of[[".random_prop", " is undefined" ]])
statement = "o = {};" + expr + end;
cases = [
function() ieval("var undef;" + statement),
function() { return ieval("var undef;" + statement); },
Function(statement)
]
for (f of cases)

View File

@ -1,7 +1,8 @@
// |jit-test| error:ReferenceError
toPrinted(this.reason);
function toPrinted(value)
value = String(value);
function toPrinted(value) {
return value = String(value);
}
var lfcode = new Array();
lfcode.push = loadFile;
lfcode.push("enableTrackAllocations();");

View File

@ -8,8 +8,9 @@ var evalInFrame = (function (global) {
})(this);
var gTestcases = new Array();
var gTc = gTestcases.length;
function TestCase()
gTestcases[gTc++] = this;
function TestCase() {
return gTestcases[gTc++] = this;
}
function checkCollation(extensionCoValue, usageValue) {
var collator = new Intl.Collator(["de-DE"]);
collator.resolvedOptions().collation;

View File

@ -5,8 +5,9 @@ var g = newGlobal();
gczeal(10, 2)
var dbg = Debugger(g);
dbg.onDebuggerStatement = function (frame1) {
function hit(frame2)
hit[0] = "mutated";
function hit(frame2) {
return hit[0] = "mutated";
}
var s = frame1.script;
var offs = s.getLineOffsets(g.line0 + 2);
for (var i = 0; i < offs.length; i++)

View File

@ -15,7 +15,7 @@ function foo() {
LineType = new TO.StructType({
PointType
})
function testBasic() new LineType;
function testBasic() { return new LineType; }
testBasic();
}
evaluate("foo()");

View File

@ -2,9 +2,9 @@ if (!('oomTest' in this))
quit();
print = function() {}
function k() dissrc(print);
function j() k();
function h() j();
function f() h();
function k() { return dissrc(print); }
function j() { return k(); }
function h() { return j(); }
function f() { return h(); }
f();
oomTest(() => f())

View File

@ -4,5 +4,6 @@ if (!('oomTest' in this))
lfLogBuffer = `this[''] = function() {}`;
loadFile(lfLogBuffer);
loadFile(lfLogBuffer);
function loadFile(lfVarx)
oomTest(function() parseModule(lfVarx))
function loadFile(lfVarx) {
return oomTest(function() { return parseModule(lfVarx); });
}

View File

@ -15,8 +15,8 @@ evalcx("\
g.h = function() {\
g.oomAfterAllocations(1);\
};\
g.eval(\"\" + function f() g());\
g.eval(\"\" + function g() h());\
g.eval(\"\" + function f() { return g(); });\
g.eval(\"\" + function g() { return h(); });\
g.eval(\"(\" + function() {\
f();\
} + \")()\");\

View File

@ -12,7 +12,7 @@ for (var i = 0; i < 4; ++i) {
function f1() {}
}
Object.defineProperty(a, 12, {}).push(1);
toString = (function() a.reverse())
toString = (function() { return a.reverse(); })
oomTest(Date.prototype.toJSON)
function f1000(){}
function f1001(){}

View File

@ -1,7 +1,7 @@
// |jit-test| need-for-each
a2 = []
g = function() r
g = function() { return r; };
Object.defineProperty(a2, 0, {
set: function() {}
})

View File

@ -4,7 +4,7 @@ function TestCase(n) {
}
gczeal(7,1);
eval("\
function reportCompare() new TestCase;\
function reportCompare() { return new TestCase; };\
reportCompare();\
Object.defineProperty(Object.prototype, 'name', {});\
reportCompare();\

View File

@ -7,7 +7,7 @@ function TestCase(n) {
this.reason = '';
this.passed = '';
}
function test() new TestCase;
function test() { return new TestCase; }
test();
Object.defineProperty(Object.prototype, "name", {});
test();

View File

@ -4,7 +4,7 @@ gczeal(2,300);
evaluate("\
var toFloat32 = (function() {\
var f32 = new Float32Array(1);\
function f(x) f32[0] = x;\
function f(x) { return f32[0] = x; }\
return f;\
})();\
for (var i = 0; i < 64; ++i) {\

View File

@ -1,7 +1,7 @@
var NotEarlyErrorString = "NotEarlyError";
var NotEarlyError = new Error(NotEarlyErrorString);
var juneDate = new Date(2000, 5, 20, 0, 0, 0, 0);
for (var i = 0; i < function(x) myObj(Date.prototype.toString.apply(x)); void i) {
for (var i = 0; i < function(x) { return myObj(Date.prototype.toString.apply(x)); }; void i) {
eval(a.text.replace(/@/g, ""))
}
gcslice(2601);

View File

@ -1,4 +1,4 @@
if (!('oomTest' in this))
quit();
oomTest(function() 1e300)
oomTest(function() { return 1e300; })

View File

@ -12,7 +12,7 @@ function loadFile(lfVarx) {
if (lfVarx.length != 1)
switch (lfRunTypeId) {
case 3:
function newFunc(x) Function(x)()
function newFunc(x) { return Function(x)(); }
newFunc(lfVarx)
case 5:
for (lfLocal in this);

View File

@ -10,8 +10,9 @@ loadFile(`
whatever.push;
}
testGC(o)
function writeObject()
o.f = v
function writeObject() {
return o.f = v;
}
writeObject({function() { } })
for (var i ; i < 5 ; ++i)
try {} catch (StringStruct) {}

View File

@ -11,5 +11,5 @@ loadFile(`
SwitchTest();
`)
function loadFile(lfVarx) {
oomTest(function() eval(lfVarx))
oomTest(function() { return eval(lfVarx); })
}

View File

@ -16,8 +16,8 @@ function h() {
evalInFrame(0, "a.push")
evalInFrame(1, "a.pushy")
}
function g() h()
function f() g()
function g() { return h(); }
function f() { return g(); }
f()
evaluate(`
g()

View File

@ -1,4 +1,4 @@
function reportCompare(actual) - ++actual + "'";
function reportCompare(actual) { return - ++actual + "'"; }
var UBound = 0;
var actualvalues = [];
for (var li = 0; li < 6; ++li) addThis();

View File

@ -1,5 +1,6 @@
function TestCase(n, d, e, a)
function writeHeaderToLog( string ) {}
function TestCase(n, d, e, a) {
return function writeHeaderToLog( string ) {};
}
var SECTION = "15.1.2.5-2";
for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) {
new TestCase( SECTION, unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) );

View File

@ -1,5 +1,6 @@
function TestCase(n, d, e, a)
function writeHeaderToLog( string ) {}
function TestCase(n, d, e, a) {
return function writeHeaderToLog( string ) {};
}
var SECTION = "11.7.2";
for ( power = 0; power <= 32; power++ ) {
shiftexp = Math.pow( 2, power );

View File

@ -8,7 +8,7 @@ function YearFromTime(t) {
}
function MonthFromTime(t) {
DayWithinYear(t)
function DayWithinYear(t) Day(t) - YearFromTime()
function DayWithinYear(t) { return Day(t) - YearFromTime(); }
function WeekDay(t) {
weekday = Day(t) + 4
return (weekday < 0 ? weekday : weekday);

View File

@ -2,8 +2,9 @@ var OMIT = {};
var WRITABLES = [true, false, OMIT];
{
var desc = {};
function put(field, value)
desc[field] = value;
function put(field, value) {
return desc[field] = value;
}
WRITABLES.forEach(function(writable) {
put("writable", writable)
});

View File

@ -1,5 +1,6 @@
function TestCase(n, d, e, a)
function writeHeaderToLog( string ) {}
function TestCase(n, d, e, a) {
return function writeHeaderToLog( string ) {};
}
var SECTION = "15.1.2.4";
for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) {
new TestCase( SECTION, "%"+ToHexString(CHARCODE), escape(String.fromCharCode(CHARCODE)));

View File

@ -4,5 +4,6 @@ var status = '';
var statusmessages = new Array();
addThis();
addThis();
function addThis()
statusmessages[i] = status;
function addThis() {
return statusmessages[i] = status;
}

View File

@ -1,2 +1,2 @@
(function x() (x == x))();
(function x() { return (x == x); })();

View File

@ -1,7 +1,8 @@
function reportCompare (expected, actual) {
if (expected != actual) {}
}
function exitFunc (funcName)
reportCompare(undefined, '');
function exitFunc (funcName) {
return reportCompare(undefined, '');
}
reportCompare('', '');
exitFunc();

View File

@ -1,9 +1,12 @@
function eval()
isPrototypeOf[Iterator.length]
function DoWhile_3()
eval();
function eval() {
return isPrototypeOf[Iterator.length];
}
function DoWhile_3() {
return eval();
}
DoWhile_3();
function f()
DoWhile_3(f - 0);
function f() {
return DoWhile_3(f - 0);
}
for (var i in f());

View File

@ -9,6 +9,6 @@ evaluate("\
function TestCase(n, d, e, a) {}\
test_negation(-2147483648, 2147483648);\
test_negation(2147483647, -2147483647);\
function test_negation(value, expected)\
function test_negation(value, expected) {\
reportCompare(expected, '', '-(' + value + ') == ' + expected);\
");
}");

View File

@ -1,6 +1,7 @@
// |jit-test| error: ReferenceError
function TestCase(e, a)
this.passed = (e == a);
function TestCase(e, a) {
return this.passed = (e == a);
}
function reportCompare (expected, actual) {
var expected_t = typeof expected;
var actual_t = typeof actual;

View File

@ -1,7 +1,8 @@
function test() {
function f()
k.apply(this, arguments);
function f() {
return k.apply(this, arguments);
}
if (undefined >> undefined !== 0) {}
for (var [ v , c ] in this.tracemonkey) { }
}

View File

@ -1 +1 @@
x = this.__defineSetter__("x", function(z) function() { z })
x = this.__defineSetter__("x", function(z) { return function() { z }; })

View File

@ -8,7 +8,7 @@
(function () {
(function r(t) {
t !== u,
sum(t, function (v) r(v) );
sum(t, function (v) { return r(v); } );
})(arguments);
})(a);
}) (

View File

@ -1,5 +1,5 @@
test();
function test() {
var t = function () function printStatus() {};
var t = function () { return function printStatus() {}; };
for (var j = 0; j < 10; j++) t["-1"]
}

View File

@ -2,7 +2,7 @@ TryInWhile( new TryObject( "hello", ThrowException, true ) );
function TryObject( value, throwFunction, result ) {
this.thrower=throwFunction
}
function ThrowException() TryInWhile(1);
function ThrowException() { return TryInWhile(1); }
function TryInWhile( object ) {
try {
object.thrower()

View File

@ -3,10 +3,13 @@ function TestCase(n, d, e, a) {
this.description = d
gTestcases[gTc] = this
}
TestCase.prototype.dump=function () + + +
TestCase.prototype.dump=function () { return + + +
+ this.description + +
+ + '\n';function printStatus (msg)
function toPrinted(value) {
+ + '\n';
};
function printStatus (msg) {
return function toPrinted(value) {
};
}
function reportCompare(expected, actual, description) {
new TestCase("unknown-test-name", description, expected, actual)

View File

@ -1,5 +1,5 @@
var s1 = 'xx';
for (var x = 0; x < 10 ; ++x ) {
new function() s1++;
new function() { return s1++; };
gc();
}

View File

@ -1,4 +1,4 @@
function Employee(name, dept) this.name = name || "";
function Employee(name, dept) { return this.name = name || ""; }
function WorkerBee(name, dept, projs) {
this.base = Employee
this.base(name, dept)

View File

@ -5,8 +5,8 @@ function TestCase(n, d, e, a) {
this.reason=''
gTestcases[gTc++]=this
}
TestCase.prototype.dump=function () + toPrinted(this.description) + toPrinted(this.reason) + '\n';
function toPrinted(value) value=value.replace(/\\n/g, 'NL').replace(/[^\x20-\x7E]+/g, escapeString);
TestCase.prototype.dump=function () { return + toPrinted(this.description) + toPrinted(this.reason) + '\n'; };
function toPrinted(value) { return value=value.replace(/\\n/g, 'NL').replace(/[^\x20-\x7E]+/g, escapeString); }
function escapeString (str) {
try {
err
@ -18,7 +18,7 @@ function jsTestDriverEnd() {
}
var SECTION = "dowhile-007";
DoWhile();
function DoWhile( object ) result1=false;
function DoWhile( object ) { return result1=false; }
new TestCase(
SECTION,
"break one: ",

View File

@ -1,4 +1,4 @@
function TestCase(n, d, e, a) this.expect = e;
function TestCase(n, d, e, a) { return this.expect = e; }
function reportCompare(expected, actual, description) {
typeof actual
}
@ -15,7 +15,7 @@ function notInlined(f) {
}
function test(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) {
try {
p = [1].some(notInlined(function (y) test())) ? 4 : 0x0041;
p = [1].some(notInlined(function (y) { return test(); })) ? 4 : 0x0041;
} catch (ex) {}
reportCompare(expect, actual, summary)
}

View File

@ -2,8 +2,9 @@ g = newGlobal();
g.parent = this;
g.eval("(" + function() {
Debugger(parent)
.onExceptionUnwind = function(frame)
frame.eval("")
.onExceptionUnwind = function(frame) {
return frame.eval("");
};
} + ")()");
m = parseModule(` s1 `);
m.declarationInstantiation();

View File

@ -8,7 +8,7 @@ evalInFrame = function(global) {
}
}(this);
m = parseModule(`
function g() this.hours = 0;
function g() { return this.hours = 0; }
evalInFrame.call(0, 0, "g()")
`);
m.declarationInstantiation();

View File

@ -3,8 +3,9 @@
let m = parseModule(`
var i = 0;
addThis();
function addThis()
statusmessages[i] = Number;
function addThis() {
return statusmessages[i] = Number;
}
`);
m.declarationInstantiation();
m.evaluation();

View File

@ -18,6 +18,6 @@ function g(arg) {
return r;
}
assertEq(g((function () arguments).call(null, 1, 2, 3)), 3);
assertEq(g((function () { return arguments; }).call(null, 1, 2, 3)), 3);
assertEq(g(new Float32Array(3)), 0.0);
assertEq(g([1, 2, 3, 4]), 4);

View File

@ -1,6 +1,6 @@
// |jit-test| need-for-each
(function()[function() function() function() function() function() function() {}]);
(function() { return [function() { return function() { return function() { return function() { return function() { return function() {}; }; }; }; }; }]; });
foo = [{
text: "(function(){if(d){(1)}})",
s: function() {},
@ -47,9 +47,9 @@ foo = [{
if (a.test()) {}
}
} ());
s = [function() function() function() function() function() function() {}]
[function() function() function() function() {}];
(function() { [function() function() {}] });
s = [function() { return function() { return function() { return function() { return function() { return function() {}; }; }; }; }; }]
[function() { return function() { return function() { return function() {}; }; }; }];
(function() { [function() { return function() {}; }] });
(function() {});
(eval("\
(function(){\

View File

@ -2,8 +2,9 @@
print = function(s) { return s.toString(); }
var gTestcases = new Array();
function TestCase(n, d, e, a)
gTestcases[gTc++] = this;
function TestCase(n, d, e, a) {
return gTestcases[gTc++] = this;
}
dump = print;
for ( gTc=0; gTc < gTestcases.length; gTc++ ) {}
function jsTestDriverEnd() {

View File

@ -10,7 +10,7 @@ oomTest(() => {
case 0:
let x
case 1:
(function() x)()
(function() { return x; })()
}
}
})

Some files were not shown because too many files have changed in this diff Show More