Bug 1149015 - Part 3: Remove some use of expression closure from jit-test r=luke

This commit is contained in:
Tooru Fujisawa 2015-04-01 18:34:02 +09:00
Родитель 7a59b1808b
Коммит ec0a99d3dd
16 изменённых файлов: 125 добавлений и 125 удалений

Просмотреть файл

@ -9,7 +9,7 @@ function Range(start, stop) {
this.stop = stop;
}
Range.prototype = {
__iterator__: function() this,
__iterator__: function() { return this; },
next: function() {
if (this.i >= this.stop)
throw StopIteration;

Просмотреть файл

@ -17,9 +17,9 @@ function main() { // once a C programmer, always a C programmer.
var uints = new Uints();
assertEq(uints.__proto__, p);
assertThrowsInstanceOf(function() uints.__proto__ = {},
assertThrowsInstanceOf(() => uints.__proto__ = {},
TypeError);
assertThrowsInstanceOf(function() Object.setPrototypeOf(uints, {}),
assertThrowsInstanceOf(() => Object.setPrototypeOf(uints, {}),
TypeError);
assertEq(uints.__proto__, p);

Просмотреть файл

@ -1,6 +1,6 @@
function forVarInWith() {
function foo() ({notk:42});
function bar() ({p:1, q:2, r:3, s:4, t:5});
function foo() { return {notk:42}; }
function bar() { return {p:1, q:2, r:3, s:4, t:5}; };
var o = foo();
var a = [];
with (o) {

Просмотреть файл

@ -3,6 +3,6 @@ function newArrayTest()
var a = [];
for (var i = 0; i < 10; i++)
a[i] = new Array();
return a.map(function(x) x.length).toString();
return a.map(x => x.length).toString();
}
assertEq(newArrayTest(), "0,0,0,0,0,0,0,0,0,0");

Просмотреть файл

@ -23,7 +23,7 @@ assertEq("abc".contains("ab", -Infinity), true);
assertEq("abc".contains("cd", -Infinity), false);
assertEq("abc".contains("ab", NaN), true);
assertEq("abc".contains("cd", NaN), false);
var myobj = {toString : (function () "abc"), contains : String.prototype.contains};
var myobj = {toString : () => "abc", contains : String.prototype.contains};
assertEq(myobj.contains("abc"), true);
assertEq(myobj.contains("cd"), false);
var gotStr = false, gotPos = false;

Просмотреть файл

@ -9,7 +9,7 @@ assertEq("a".repeat(10), "aaaaaaaaaa");
assertEq("abc".repeat(0), "");
assertEq("abc".repeat(2.9), "abcabc");
var myobj = {toString : (function () "abc"), repeat : String.prototype.repeat};
var myobj = {toString : () => "abc", repeat : String.prototype.repeat};
assertEq(myobj.repeat(1), "abc");
assertEq(myobj.repeat(2), "abcabc");

Просмотреть файл

@ -3,13 +3,13 @@
var g1 = newGlobal('same-compartment');
var g2 = newGlobal();
var proxyStr = "Proxy.create( "+
" { getOwnPropertyDescriptor: function() assertEq(true,false), "+
" getPropertyDescriptor: function() assertEq(true,false), "+
" getOwnPropertyNames: function() assertEq(true,false), "+
" getPropertyNames: function() assertEq(true,false), "+
" defineProperty: function() assertEq(true,false), "+
" delete: function() assertEq(true,false), "+
" fix: function() assertEq(true,false), }, "+
" { getOwnPropertyDescriptor: () =>assertEq(true,false), "+
" getPropertyDescriptor: () =>assertEq(true,false), "+
" getOwnPropertyNames: () =>assertEq(true,false), "+
" getPropertyNames: () =>assertEq(true,false), "+
" defineProperty: () =>assertEq(true,false), "+
" delete: () =>assertEq(true,false), "+
" fix: () =>assertEq(true,false), }, "+
" Object.prototype "+
"); ";
var proxy1 = g1.eval(proxyStr);
@ -56,105 +56,105 @@ function test(str, f) {
assertEq(threw, true);
}
test("new Boolean(true)", function(b) Boolean.prototype.toSource.call(b));
test("new Boolean(true)", function(b) Boolean.prototype.toString.call(b));
test("new Boolean(true)", function(b) Boolean.prototype.valueOf.call(b));
test("new Number(1)", function(n) Number.prototype.toSource.call(n));
test("new Number(1)", function(n) Number.prototype.toString.call(n));
test("new Number(1)", function(n) Number.prototype.valueOf.call(n));
test("new Number(1)", function(n) Number.prototype.toFixed.call(n));
test("new Number(1)", function(n) Number.prototype.toExponential.call(n));
test("new Number(1)", function(n) Number.prototype.toPrecision.call(n));
test("new Iterator({x:1})", function(i) Iterator.prototype.next.call(i).toString());
test("(function(){yield 1})()", function(i) (function(){yield})().next.call(i).toString());
test("new String('one')", function(s) String.prototype.toSource.call(s));
test("new String('one')", function(s) String.prototype.toString.call(s));
test("new RegExp('1')", function(r) RegExp.prototype.exec.call(r, '1').toString());
test("new RegExp('1')", function(r) RegExp.prototype.test.call(r, '1'));
test("new RegExp('1')", function(r) RegExp.prototype.compile.call(r, '1').toString());
test("new RegExp('1')", function(r) assertEq("a1".search(r), 1));
test("new RegExp('1')", function(r) assertEq("a1".match(r)[0], '1'));
test("new RegExp('1')", function(r) assertEq("a1".replace(r, 'A'), 'aA'));
test("new RegExp('1')", function(r) assertEq(String("a1b".split(r)), "a,b"));
test("new RegExp('1')", function(r) assertEq(r, RegExp(r)));
test("new RegExp('1')", function(r) assertEq(String(new RegExp(r)), String(r)));
test("new RegExp('1')", function(r) assertEq(String(/x/.compile(r)), String(r)));
test("new WeakMap()", function(w) WeakMap.prototype.has.call(w, {}));
test("new WeakMap()", function(w) WeakMap.prototype.get.call(w, {}));
test("new WeakMap()", function(w) WeakMap.prototype.delete.call(w, {}));
test("new WeakMap()", function(w) WeakMap.prototype.set.call(w, {}).toString());
test("new Map()", function(w) Map.prototype.has.call(w, {}));
test("new Map()", function(w) Map.prototype.get.call(w, {}));
test("new Map()", function(w) Map.prototype.delete.call(w, {}));
test("new Map()", function(w) Map.prototype.set.call(w, {}).toString());
test("new Set()", function(w) Set.prototype.has.call(w, {}));
test("new Set()", function(w) Set.prototype.add.call(w, {}).toString());
test("new Set()", function(w) Set.prototype.delete.call(w, {}));
test("new Boolean(true)", b => Boolean.prototype.toSource.call(b));
test("new Boolean(true)", b => Boolean.prototype.toString.call(b));
test("new Boolean(true)", b => Boolean.prototype.valueOf.call(b));
test("new Number(1)", n => Number.prototype.toSource.call(n));
test("new Number(1)", n => Number.prototype.toString.call(n));
test("new Number(1)", n => Number.prototype.valueOf.call(n));
test("new Number(1)", n => Number.prototype.toFixed.call(n));
test("new Number(1)", n => Number.prototype.toExponential.call(n));
test("new Number(1)", n => Number.prototype.toPrecision.call(n));
test("new Iterator({x:1})", i => Iterator.prototype.next.call(i).toString());
test("(function(){yield 1})()", i => (function(){yield})().next.call(i).toString());
test("new String('one')", s => String.prototype.toSource.call(s));
test("new String('one')", s => String.prototype.toString.call(s));
test("new RegExp('1')", r => RegExp.prototype.exec.call(r, '1').toString());
test("new RegExp('1')", r => RegExp.prototype.test.call(r, '1'));
test("new RegExp('1')", r => RegExp.prototype.compile.call(r, '1').toString());
test("new RegExp('1')", r => assertEq("a1".search(r), 1));
test("new RegExp('1')", r => assertEq("a1".match(r)[0], '1'));
test("new RegExp('1')", r => assertEq("a1".replace(r, 'A'), 'aA'));
test("new RegExp('1')", r => assertEq(String("a1b".split(r)), "a,b"));
test("new RegExp('1')", r => assertEq(r, RegExp(r)));
test("new RegExp('1')", r => assertEq(String(new RegExp(r)), String(r)));
test("new RegExp('1')", r => assertEq(String(/x/.compile(r)), String(r)));
test("new WeakMap()", w => WeakMap.prototype.has.call(w, {}));
test("new WeakMap()", w => WeakMap.prototype.get.call(w, {}));
test("new WeakMap()", w => WeakMap.prototype.delete.call(w, {}));
test("new WeakMap()", w => WeakMap.prototype.set.call(w, {}).toString());
test("new Map()", w => Map.prototype.has.call(w, {}));
test("new Map()", w => Map.prototype.get.call(w, {}));
test("new Map()", w => Map.prototype.delete.call(w, {}));
test("new Map()", w => Map.prototype.set.call(w, {}).toString());
test("new Set()", w => Set.prototype.has.call(w, {}));
test("new Set()", w => Set.prototype.add.call(w, {}).toString());
test("new Set()", w => Set.prototype.delete.call(w, {}));
test("new Int8Array(1)", function(a) Int8Array.prototype.subarray.call(a).toString());
test("new Uint8Array(1)", function(a) Uint8Array.prototype.subarray.call(a).toString());
test("new Int16Array(1)", function(a) Int16Array.prototype.subarray.call(a).toString());
test("new Uint16Array(1)", function(a) Uint16Array.prototype.subarray.call(a).toString());
test("new Int32Array(1)", function(a) Int32Array.prototype.subarray.call(a).toString());
test("new Uint32Array(1)", function(a) Uint32Array.prototype.subarray.call(a).toString());
test("new Float32Array(1)", function(a) Float32Array.prototype.subarray.call(a).toString());
test("new Float64Array(1)", function(a) Float64Array.prototype.subarray.call(a).toString());
test("new Uint8ClampedArray(1)", function(a) Uint8ClampedArray.prototype.subarray.call(a).toString());
test("new Int8Array(1)", a => Int8Array.prototype.subarray.call(a).toString());
test("new Uint8Array(1)", a => Uint8Array.prototype.subarray.call(a).toString());
test("new Int16Array(1)", a => Int16Array.prototype.subarray.call(a).toString());
test("new Uint16Array(1)", a => Uint16Array.prototype.subarray.call(a).toString());
test("new Int32Array(1)", a => Int32Array.prototype.subarray.call(a).toString());
test("new Uint32Array(1)", a => Uint32Array.prototype.subarray.call(a).toString());
test("new Float32Array(1)", a => Float32Array.prototype.subarray.call(a).toString());
test("new Float64Array(1)", a => Float64Array.prototype.subarray.call(a).toString());
test("new Uint8ClampedArray(1)", a => Uint8ClampedArray.prototype.subarray.call(a).toString());
test("new Int8Array(1)", function(a) Int8Array.prototype.set.call(a, []));
test("new Uint8Array(1)", function(a) Uint8Array.prototype.set.call(a, []));
test("new Int16Array(1)", function(a) Int16Array.prototype.set.call(a, []));
test("new Uint16Array(1)", function(a) Uint16Array.prototype.set.call(a, []));
test("new Int32Array(1)", function(a) Int32Array.prototype.set.call(a, []));
test("new Uint32Array(1)", function(a) Uint32Array.prototype.set.call(a, []));
test("new Float32Array(1)", function(a) Float32Array.prototype.set.call(a, []));
test("new Float64Array(1)", function(a) Float64Array.prototype.set.call(a, []));
test("new Uint8ClampedArray(1)", function(a) Uint8ClampedArray.prototype.set.call(a, []));
test("new Int8Array(1)", a => Int8Array.prototype.set.call(a, []));
test("new Uint8Array(1)", a => Uint8Array.prototype.set.call(a, []));
test("new Int16Array(1)", a => Int16Array.prototype.set.call(a, []));
test("new Uint16Array(1)", a => Uint16Array.prototype.set.call(a, []));
test("new Int32Array(1)", a => Int32Array.prototype.set.call(a, []));
test("new Uint32Array(1)", a => Uint32Array.prototype.set.call(a, []));
test("new Float32Array(1)", a => Float32Array.prototype.set.call(a, []));
test("new Float64Array(1)", a => Float64Array.prototype.set.call(a, []));
test("new Uint8ClampedArray(1)", a => Uint8ClampedArray.prototype.set.call(a, []));
function justDontThrow() {}
test("new Date()", function(d) justDontThrow(Date.prototype.getTime.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getYear.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getFullYear.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getUTCFullYear.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getMonth.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getUTCMonth.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getDate.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getUTCDate.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getDay.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getUTCDay.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getHours.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getUTCHours.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getMinutes.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getUTCMinutes.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getSeconds.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getUTCSeconds.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.getTimezoneOffset.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setTime.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setMilliseconds.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setUTCMilliseconds.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setSeconds.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setUTCSeconds.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setMinutes.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setUTCMinutes.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setHours.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setUTCHours.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setDate.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setUTCDate.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setMonth.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setUTCMonth.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setFullYear.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setUTCFullYear.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.setYear.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toGMTString.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toISOString.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toLocaleString.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toLocaleDateString.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toLocaleTimeString.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toLocaleFormat.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toTimeString.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toDateString.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toSource.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.toString.call(d)));
test("new Date()", function(d) justDontThrow(Date.prototype.valueOf.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getTime.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getYear.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getFullYear.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getUTCFullYear.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getMonth.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getUTCMonth.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getDate.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getUTCDate.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getDay.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getUTCDay.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getHours.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getUTCHours.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getMinutes.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getUTCMinutes.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getSeconds.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getUTCSeconds.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.getTimezoneOffset.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setTime.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setMilliseconds.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setUTCMilliseconds.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setSeconds.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setUTCSeconds.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setMinutes.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setUTCMinutes.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setHours.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setUTCHours.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setDate.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setUTCDate.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setMonth.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setUTCMonth.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setFullYear.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setUTCFullYear.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.setYear.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toGMTString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toISOString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toLocaleString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toLocaleDateString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toLocaleTimeString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toLocaleFormat.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toTimeString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toDateString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toSource.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.valueOf.call(d)));
throw "done";

Просмотреть файл

@ -1,7 +1,7 @@
function heavyFn1(i) {
if (i == 3) {
var x = 3;
return [0, i].map(function (i) i + x);
return [0, i].map(function (i) { return i + x; });
}
return [];
}

Просмотреть файл

@ -1,7 +1,7 @@
function heavyFn1(i) {
if (i == 3) {
var x = 3;
return [0, i].map(function (i) i + x);
return [0, i].map(function (i) { return i + x; });
}
return [];
}
@ -9,7 +9,7 @@ function heavyFn1(i) {
function heavyFn2(i) {
if (i < 1000)
return heavyFn1(i);
return function () i;
return function () { return i; };
}
function testHeavy2() {

Просмотреть файл

@ -1,5 +1,5 @@
function testInterpreterReentry4() {
var obj = {a:1, b:1, c:1, d:1, get e() 1000 };
var obj = {a:1, b:1, c:1, d:1, get e() { return 1000; } };
for (var p in obj)
obj[p];
}

Просмотреть файл

@ -1,6 +1,6 @@
function testInterpreterReentry5() {
var arr = [0, 1, 2, 3, 4];
arr.__defineGetter__("4", function() 1000);
arr.__defineGetter__("4", function() { return 1000; });
for (var i = 0; i < 5; i++)
arr[i];
for (var p in arr)

Просмотреть файл

@ -1,5 +1,5 @@
function testObjectToNumber() {
var o = {valueOf: function()-3};
var o = {valueOf: () => -3};
var x = 0;
for (var i = 0; i < 10; i++)
x -= o;

Просмотреть файл

@ -1,5 +1,5 @@
function testObjectToString() {
var o = {toString: function()"foo"};
var o = {toString: () => "foo"};
var s = "";
for (var i = 0; i < 10; i++)
s += o;

Просмотреть файл

@ -6,11 +6,11 @@ var url2 = scriptdir + 'Debugger-findScripts-12-script2';
// Three globals: two with code, one with nothing.
var g1 = newGlobal();
g1.toSource = function () "[global g1]";
g1.toSource = () => "[global g1]";
g1.load(url1);
g1.load(url2);
var g2 = newGlobal();
g2.toSource = function () "[global g2]";
g2.toSource = () => "[global g2]";
g2.load(url1);
g2.load(url2);
var g3 = newGlobal();

Просмотреть файл

@ -16,7 +16,7 @@ log = '';
assertEq(typeof newGlobal({invisibleToDebugger: true}), "object");
assertEq(log, '');
assertThrowsInstanceOf(function() dbg.addDebuggee(newGlobal({invisibleToDebugger: true})), Error);
assertThrowsInstanceOf(() => dbg.addDebuggee(newGlobal({invisibleToDebugger: true})), Error);
var glob = newGlobal({invisibleToDebugger: true});
dbg.addAllGlobalsAsDebuggees();

Просмотреть файл

@ -16,7 +16,7 @@ var it = Proxy.create({
get: function (receiver, name) {
if (name == 'toSource') {
s += '?';
return function () 'it';
return () => 'it';
}
assertEq(name, "next");
s += "N";