[javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time) (#1620)

* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
This commit is contained in:
test262-automation 2018-07-03 15:59:58 -04:00 committed by Leo Balter
parent 8bc4e38a48
commit e9a5a7f918
3397 changed files with 289665 additions and 5 deletions

View File

@ -1,7 +1,5 @@
{
"targetRevisionAtLastExport": "master",
"sourceRevisionAtLastExport": "949e26452cfa153a7f4afe593da97e2fe9e1b706",
"curatedFiles": {
}
"sourceRevisionAtLastExport": "8bfa53d50",
"targetRevisionAtLastExport": "8bc4e38a",
"curatedFiles": {}
}

View File

@ -0,0 +1,63 @@
load("./driver/driver.js");
var afSimple = y => y + 1,
afBlock = y => { y++; return y + 1;},
afBlockWithCondition = x => { x > 0 ? x++ : x--; return x;};
checkBasicBlock(afSimple, "y + 1", ShouldNotHaveExecuted);
afSimple(1);
checkBasicBlock(afSimple, "y + 1", ShouldHaveExecuted);
checkBasicBlock(afBlock, "y++", ShouldNotHaveExecuted);
afBlock(2);
checkBasicBlock(afBlock, "y++", ShouldHaveExecuted);
checkBasicBlock(afBlock, "return y + 1", ShouldHaveExecuted);
checkBasicBlock(afBlockWithCondition,'x++', ShouldNotHaveExecuted);
afBlockWithCondition(10);
checkBasicBlock(afBlockWithCondition,'x++', ShouldHaveExecuted);
checkBasicBlock(afBlockWithCondition,'return x', ShouldHaveExecuted);
checkBasicBlock(afBlockWithCondition,'x--', ShouldNotHaveExecuted);
afBlockWithCondition(-10);
checkBasicBlock(afBlockWithCondition,'x--', ShouldHaveExecuted);
function foo1(test) {
var f1 = () => { "hello"; }
if (test)
f1();
}
foo1(false);
checkBasicBlock(foo1, '() =>', ShouldNotHaveExecuted);
checkBasicBlock(foo1, '; }', ShouldNotHaveExecuted);
foo1(true);
checkBasicBlock(foo1, '() =>', ShouldHaveExecuted);
checkBasicBlock(foo1, '; }', ShouldHaveExecuted);
function foo2(test) {
var f1 = x => { "hello"; }
if (test)
f1();
}
foo2(false);
checkBasicBlock(foo2, 'x =>', ShouldNotHaveExecuted);
checkBasicBlock(foo2, '; }', ShouldNotHaveExecuted);
foo2(true);
checkBasicBlock(foo2, 'x =>', ShouldHaveExecuted);
checkBasicBlock(foo2, '; }', ShouldHaveExecuted);
function foo3(test) {
var f1 = (xyz) => { "hello"; }
if (test)
f1();
}
foo3(false);
checkBasicBlock(foo3, '(xyz) =>', ShouldNotHaveExecuted);
checkBasicBlock(foo3, '; }', ShouldNotHaveExecuted);
foo3(true);
checkBasicBlock(foo3, '(xyz) =>', ShouldHaveExecuted);
checkBasicBlock(foo3, '; }', ShouldHaveExecuted);

View File

@ -0,0 +1,159 @@
load("./driver/driver.js");
function foo() {}
function bar() {}
function baz() {}
function testIf(x) {
if (x < 10) { foo(); } else if (x < 20) { bar(); } else { baz() }
}
testIf(9);
// Note, the check will be against the basic block that contains the first matched character.
// So in this following case, the block that contains the '{'.
checkBasicBlock(testIf, "{ foo", ShouldHaveExecuted);
// In this case, it will test the basic block that contains the ' ' character.
checkBasicBlock(testIf, " foo", ShouldHaveExecuted);
checkBasicBlock(testIf, "} else if", ShouldHaveExecuted);
checkBasicBlock(testIf, "else if", ShouldNotHaveExecuted);
checkBasicBlock(testIf, "{ bar", ShouldNotHaveExecuted);
checkBasicBlock(testIf, " bar", ShouldNotHaveExecuted);
checkBasicBlock(testIf, "else {", ShouldNotHaveExecuted);
checkBasicBlock(testIf, "{ baz", ShouldNotHaveExecuted);
checkBasicBlock(testIf, " baz", ShouldNotHaveExecuted);
testIf(21);
checkBasicBlock(testIf, "else if (x < 20)", ShouldHaveExecuted);
checkBasicBlock(testIf, "{ bar", ShouldNotHaveExecuted);
checkBasicBlock(testIf, " bar", ShouldNotHaveExecuted);
checkBasicBlock(testIf, "else {", ShouldHaveExecuted);
checkBasicBlock(testIf, "{ baz", ShouldHaveExecuted);
checkBasicBlock(testIf, " baz", ShouldHaveExecuted);
testIf(11);
checkBasicBlock(testIf, "{ bar", ShouldHaveExecuted);
checkBasicBlock(testIf, " bar", ShouldHaveExecuted);
function testForRegular(x) {
for (var i = 0; i < x; i++) { foo(); } bar();
}
testForRegular(0);
checkBasicBlock(testForRegular, "{ foo", ShouldNotHaveExecuted);
checkBasicBlock(testForRegular, "} bar", ShouldNotHaveExecuted);
checkBasicBlock(testForRegular, " bar", ShouldHaveExecuted);
testForRegular(1);
checkBasicBlock(testForRegular, "{ foo", ShouldHaveExecuted);
checkBasicBlock(testForRegular, "} bar", ShouldHaveExecuted);
function testForIn(x) {
for (var i in x) { foo(); } bar();
}
testForIn({});
checkBasicBlock(testForIn, "{ foo", ShouldNotHaveExecuted);
checkBasicBlock(testForIn, "} bar", ShouldNotHaveExecuted);
checkBasicBlock(testForIn, " bar", ShouldHaveExecuted);
testForIn({foo: 20});
checkBasicBlock(testForIn, "{ foo", ShouldHaveExecuted);
checkBasicBlock(testForIn, "} bar", ShouldHaveExecuted);
function testForOf(x) {
for (var i of x) { foo(); } bar();
}
testForOf([]);
checkBasicBlock(testForOf, "{ foo", ShouldNotHaveExecuted);
checkBasicBlock(testForOf, " foo", ShouldNotHaveExecuted);
checkBasicBlock(testForOf, "} bar", ShouldNotHaveExecuted);
checkBasicBlock(testForOf, " bar", ShouldHaveExecuted);
testForOf([20]);
checkBasicBlock(testForOf, "{ foo", ShouldHaveExecuted);
checkBasicBlock(testForOf, "} bar", ShouldHaveExecuted);
function testWhile(x) {
var i = 0; while (i++ < x) { foo(); } bar();
}
testWhile(0);
checkBasicBlock(testWhile, "{ foo", ShouldNotHaveExecuted);
checkBasicBlock(testWhile, " foo", ShouldNotHaveExecuted);
checkBasicBlock(testWhile, "} bar", ShouldNotHaveExecuted);
checkBasicBlock(testWhile, " bar", ShouldHaveExecuted);
testWhile(1);
checkBasicBlock(testWhile, "{ foo", ShouldHaveExecuted);
checkBasicBlock(testWhile, "} bar", ShouldHaveExecuted);
// No braces tests.
function testIfNoBraces(x) {
if (x < 10) foo(); else if (x < 20) bar(); else baz();
}
testIfNoBraces(9);
checkBasicBlock(testIfNoBraces, "foo", ShouldHaveExecuted);
checkBasicBlock(testIfNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testIfNoBraces, "; else if", ShouldHaveExecuted);
checkBasicBlock(testIfNoBraces, " else if", ShouldNotHaveExecuted);
checkBasicBlock(testIfNoBraces, " bar", ShouldNotHaveExecuted);
checkBasicBlock(testIfNoBraces, "bar", ShouldNotHaveExecuted);
checkBasicBlock(testIfNoBraces, "else baz", ShouldNotHaveExecuted);
checkBasicBlock(testIfNoBraces, "baz", ShouldNotHaveExecuted);
testIfNoBraces(21);
checkBasicBlock(testIfNoBraces, "else baz", ShouldHaveExecuted);
checkBasicBlock(testIfNoBraces, "baz", ShouldHaveExecuted);
checkBasicBlock(testIfNoBraces, "; else baz", ShouldNotHaveExecuted);
checkBasicBlock(testIfNoBraces, "else if (x < 20)", ShouldHaveExecuted);
// Note that the whitespace preceding bar is part of the previous basic block.
// An if statement's if-true basic block text offset begins at the start offset
// of the if-true block, in this case, just the expression "bar()".
checkBasicBlock(testIfNoBraces, " bar", ShouldHaveExecuted);
checkBasicBlock(testIfNoBraces, "bar", ShouldNotHaveExecuted);
testIfNoBraces(11);
checkBasicBlock(testIfNoBraces, " bar", ShouldHaveExecuted);
checkBasicBlock(testIfNoBraces, "bar", ShouldHaveExecuted);
function testForRegularNoBraces(x) {
for (var i = 0; i < x; i++) foo(); bar();
}
testForRegularNoBraces(0);
checkBasicBlock(testForRegularNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testForRegularNoBraces, "foo", ShouldNotHaveExecuted);
checkBasicBlock(testForRegularNoBraces, "; bar", ShouldNotHaveExecuted);
checkBasicBlock(testForRegularNoBraces, " bar", ShouldHaveExecuted);
testForRegularNoBraces(1);
checkBasicBlock(testForRegularNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testForRegularNoBraces, "foo", ShouldHaveExecuted);
checkBasicBlock(testForRegularNoBraces, " bar", ShouldHaveExecuted);
function testForInNoBraces(x) {
for (var i in x) foo(); bar();
}
testForInNoBraces({});
checkBasicBlock(testForInNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testForInNoBraces, "foo", ShouldNotHaveExecuted);
checkBasicBlock(testForInNoBraces, "; bar", ShouldNotHaveExecuted);
checkBasicBlock(testForInNoBraces, " bar", ShouldHaveExecuted);
testForInNoBraces({foo: 20});
checkBasicBlock(testForInNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testForInNoBraces, "foo", ShouldHaveExecuted);
checkBasicBlock(testForInNoBraces, "; bar", ShouldHaveExecuted);
function testForOfNoBraces(x) {
for (var i of x) foo(); bar();
}
testForOfNoBraces([]);
checkBasicBlock(testForOfNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testForOfNoBraces, "foo", ShouldNotHaveExecuted);
checkBasicBlock(testForOfNoBraces, "; bar", ShouldNotHaveExecuted);
checkBasicBlock(testForOfNoBraces, " bar", ShouldHaveExecuted);
testForOfNoBraces([20]);
checkBasicBlock(testForOfNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testForOfNoBraces, "foo", ShouldHaveExecuted);
checkBasicBlock(testForOfNoBraces, "; bar", ShouldHaveExecuted);
function testWhileNoBraces(x) {
var i = 0; while (i++ < x) foo(); bar();
}
testWhileNoBraces(0);
checkBasicBlock(testWhileNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testWhileNoBraces, "foo", ShouldNotHaveExecuted);
checkBasicBlock(testWhileNoBraces, "; bar", ShouldNotHaveExecuted);
checkBasicBlock(testWhileNoBraces, " bar", ShouldHaveExecuted);
testWhileNoBraces(1);
checkBasicBlock(testWhileNoBraces, " foo", ShouldHaveExecuted);
checkBasicBlock(testWhileNoBraces, "foo", ShouldHaveExecuted);
checkBasicBlock(testWhileNoBraces, "; bar", ShouldHaveExecuted);

View File

@ -0,0 +1,44 @@
load("./driver/driver.js");
function foo(){ }
function bar(){ }
function baz(){ }
function testConditionalBasic(x) {
return x ? 10 : 20;
}
testConditionalBasic(false);
checkBasicBlock(testConditionalBasic, "x", ShouldHaveExecuted);
checkBasicBlock(testConditionalBasic, "20", ShouldHaveExecuted);
checkBasicBlock(testConditionalBasic, "10", ShouldNotHaveExecuted);
testConditionalBasic(true);
checkBasicBlock(testConditionalBasic, "10", ShouldHaveExecuted);
function testConditionalFunctionCall(x, y) {
x ? y ? foo()
: baz()
: bar()
}
testConditionalFunctionCall(false, false);
checkBasicBlock(testConditionalFunctionCall, "x ?", ShouldHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "? y", ShouldHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "bar", ShouldHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, ": bar", ShouldHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "y ?", ShouldNotHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "? foo", ShouldNotHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "foo", ShouldNotHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "baz", ShouldNotHaveExecuted);
testConditionalFunctionCall(true, false);
checkBasicBlock(testConditionalFunctionCall, "y ?", ShouldHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "? foo", ShouldHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, ": baz", ShouldHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "baz", ShouldHaveExecuted);
checkBasicBlock(testConditionalFunctionCall, "foo", ShouldNotHaveExecuted);
testConditionalFunctionCall(true, true);
checkBasicBlock(testConditionalFunctionCall, "foo", ShouldHaveExecuted);

View File

@ -0,0 +1,16 @@
var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted;
function assert(condition, reason) {
if (!condition)
throw new Error(reason);
}
var ShouldHaveExecuted = true;
var ShouldNotHaveExecuted = false;
function checkBasicBlock(func, expr, expectation) {
if (expectation === ShouldHaveExecuted)
assert(hasBasicBlockExecuted(func, expr, "should have executed"));
else
assert(!hasBasicBlockExecuted(func, expr, "should not have executed"));
}

View File

@ -0,0 +1,72 @@
var basicBlockExecutionCount = $vm.basicBlockExecutionCount;
load("./driver/driver.js");
function noop() { ; }
function foo(num) {
for (let i = 0; i < num; i++) {
noop();
}
}
function a() { ; }
function b() { ; }
function baz(num) {
for (let i = 0; i < num; i++) {
i % 2 ? a() : b();
}
}
function jaz(num) {
for (let i = 0; i < num; i++) {
if (i % 2)
a();
else
b();
}
}
function testWhile(num) {
let i = num;
while (i--) {
noop();
if (i % 2)
a();
else
b();
}
}
foo(120);
assert(basicBlockExecutionCount(foo, "noop()") === 120);
noop();
assert(basicBlockExecutionCount(noop, ";") === 121);
baz(140);
assert(basicBlockExecutionCount(baz, "a()") === 140/2);
assert(basicBlockExecutionCount(baz, "b()") === 140/2);
assert(basicBlockExecutionCount(a, ";") === 140/2);
assert(basicBlockExecutionCount(b, ";") === 140/2);
jaz(140);
assert(basicBlockExecutionCount(jaz, "a()") === 140/2);
assert(basicBlockExecutionCount(jaz, "b()") === 140/2);
testWhile(140);
assert(basicBlockExecutionCount(testWhile, "noop()") === 140);
assert(basicBlockExecutionCount(testWhile, "a()") === 140/2);
assert(basicBlockExecutionCount(testWhile, "b()") === 140/2);
if (is32BitPlatform()) {
function testMax() {
let j = 0;
let numIters = Math.pow(2, 32) + 10;
for (let i = 0; i < numIters; i++) {
j++;
}
}
testMax();
assert(basicBlockExecutionCount(testMax, "j++") === Math.pow(2, 32) - 1);
}

View File

@ -0,0 +1,58 @@
var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted;
load("./driver/driver.js");
var a, b, c, d;
function testIf(x) {
if (x > 10 && x < 20) {
return a;
} else if (x > 20 && x < 30) {
return b;
} else if (x > 30 && x < 40) {
return c;
} else {
return d;
}
return null;
}
function noMatches(x) {
if (x > 10 && x < 20) {
return a;
} else if (x > 20 && x < 30) {
return b;
} else {
return c;
}
}
assert(!hasBasicBlockExecuted(testIf, "return a"), "should not have executed yet.");
assert(!hasBasicBlockExecuted(testIf, "return b"), "should not have executed yet.");
assert(!hasBasicBlockExecuted(testIf, "return c"), "should not have executed yet.");
assert(!hasBasicBlockExecuted(testIf, "return d"), "should not have executed yet.");
testIf(11);
assert(hasBasicBlockExecuted(testIf, "return a"), "should have executed.");
assert(hasBasicBlockExecuted(testIf, "x > 10"), "should have executed.");
assert(!hasBasicBlockExecuted(testIf, "return b"), "should not have executed yet.");
testIf(21);
assert(hasBasicBlockExecuted(testIf, "return b"), "should have executed.");
assert(!hasBasicBlockExecuted(testIf, "return c"), "should not have executed yet.");
testIf(31);
assert(hasBasicBlockExecuted(testIf, "return c"), "should have executed.");
assert(!hasBasicBlockExecuted(testIf, "return d"), "should not have executed yet.");
testIf(0);
assert(hasBasicBlockExecuted(testIf, "return d"), "should have executed.");
noMatches(0);
assert(!hasBasicBlockExecuted(noMatches, "return a"), "should not have executed yet.");
assert(hasBasicBlockExecuted(noMatches, "x > 10"), "should have executed.");
assert(!hasBasicBlockExecuted(noMatches, "return b"), "should not have executed yet.");
assert(hasBasicBlockExecuted(noMatches, "x > 20"), "should have executed.");
assert(hasBasicBlockExecuted(noMatches, "return c"), "should have executed.");

View File

@ -0,0 +1,78 @@
var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted;
load("./driver/driver.js");
function forRegular(limit) {
var sum = 0;
for (var i = 0; i < limit; i++) {
sum += i;
}
return sum;
}
function forIn(o) {
var s = "";
var p;
for (p in o) {
s += p;
}
}
function forOf(a) {
var s = "";
var p;
for (p of a) {
s += p;
}
}
function whileLoop(limit) {
var i = 0;
var sum = 0;
while (i < limit) {
sum += i;
i++;
}
return sum;
}
assert(!hasBasicBlockExecuted(forRegular, "var sum"), "should not have executed yet.");
forRegular(0);
assert(hasBasicBlockExecuted(forRegular, "var sum"), "should have executed.");
assert(!hasBasicBlockExecuted(forRegular, "sum += i"), "should not have executed yet.");
forRegular(1);
assert(hasBasicBlockExecuted(forRegular, "sum += i"), "should have executed.");
assert(!hasBasicBlockExecuted(forIn, "var s"), "should not have executed yet.");
forIn({});
assert(hasBasicBlockExecuted(forIn, "var s"), "should have executed.");
assert(!hasBasicBlockExecuted(forIn, "s += p"), "should not have executed yet.");
forIn({foo: "bar"});
assert(hasBasicBlockExecuted(forIn, "s += p"), "should have executed.");
assert(!hasBasicBlockExecuted(forOf, "var s"), "should not have executed yet.");
forOf([]);
assert(hasBasicBlockExecuted(forOf, "var s"), "should have executed.");
assert(!hasBasicBlockExecuted(forOf, "s += p"), "should not have executed yet.");
forOf(["a"]);
assert(hasBasicBlockExecuted(forOf, "s += p"), "should have executed.");
assert(!hasBasicBlockExecuted(whileLoop, "var sum"), "should not have executed yet.");
whileLoop(0);
assert(hasBasicBlockExecuted(whileLoop, "var sum"), "should have executed.");
assert(!hasBasicBlockExecuted(whileLoop, "sum += i"), "should not have executed yet.");
whileLoop(1);
assert(hasBasicBlockExecuted(whileLoop, "sum += i"), "should have executed.");

View File

@ -0,0 +1,30 @@
var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted;
load("./driver/driver.js");
var a, b, c;
function testSwitch(s) {
switch (s) {
case "foo":
return a;
case "bar":
return b;
default:
return c;
}
}
assert(!hasBasicBlockExecuted(testSwitch, "switch"), "should not have executed yet.");
testSwitch("foo");
assert(hasBasicBlockExecuted(testSwitch, "switch"), "should have executed.");
assert(hasBasicBlockExecuted(testSwitch, "return a"), "should have executed.");
assert(!hasBasicBlockExecuted(testSwitch, "return b"), "should not have executed yet.");
assert(!hasBasicBlockExecuted(testSwitch, "return c"), "should not have executed yet.");
testSwitch("bar");
assert(hasBasicBlockExecuted(testSwitch, "return b"), "should have executed.");
assert(!hasBasicBlockExecuted(testSwitch, "return c"), "should not have executed yet.");
testSwitch("");
assert(hasBasicBlockExecuted(testSwitch, "return c"), "should have executed.");

View File

@ -0,0 +1,48 @@
var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted;
load("./driver/driver.js");
function tierUpToBaseline(func, arg)
{
for (var i = 0; i < 50; i++)
func(arg);
}
function tierUpToDFG(func, arg)
{
for (var i = 0; i < 50; i++)
func(arg);
}
function baselineTest(arg) {
if (arg > 20) {
return 20;
} else {
return 30;
}
}
function dfgTest(arg) {
if (arg > 20) {
return 20;
} else {
return 30;
}
}
noInline(baselineTest);
noInline(dfgTest);
tierUpToBaseline(baselineTest, 10);
tierUpToDFG(dfgTest, 10);
assert(!hasBasicBlockExecuted(baselineTest, "return 20"), "should not have executed yet.");
assert(hasBasicBlockExecuted(baselineTest, "return 30"), "should have executed.");
baselineTest(25);
assert(hasBasicBlockExecuted(baselineTest, "return 20"), "should have executed.");
assert(!hasBasicBlockExecuted(dfgTest, "return 20"), "should not have executed yet.");
assert(hasBasicBlockExecuted(dfgTest, "return 30"), "should have executed.");
dfgTest(25);
assert(hasBasicBlockExecuted(dfgTest, "return 20"), "should have executed.");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Array.prototype.copyWithin === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Array.prototype.entries === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Array.prototype.fill === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Array.prototype.find === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Array.prototype.findIndex === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Array.prototype.keys === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Array.prototype.values === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Array.prototype[Symbol.iterator] === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,17 @@
function test() {
var unscopables = Array.prototype[Symbol.unscopables];
if (!unscopables) {
return false;
}
var ns = "find,findIndex,fill,copyWithin,entries,keys,values".split(",");
for (var i = 0; i < ns.length; i++) {
if (Array.prototype[ns[i]] && !unscopables[ns[i]]) return false;
}
return true;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,19 @@
function test() {
// Iterator instance
var iterator = [][Symbol.iterator]();
// %ArrayIteratorPrototype%
var proto1 = Object.getPrototypeOf(iterator);
// %IteratorPrototype%
var proto2 = Object.getPrototypeOf(proto1);
return proto2.hasOwnProperty(Symbol.iterator) &&
!proto1 .hasOwnProperty(Symbol.iterator) &&
!iterator .hasOwnProperty(Symbol.iterator) &&
iterator[Symbol.iterator]() === iterator;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
class C extends Array {}
return C.from({ length: 0 }) instanceof C;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
class C extends Array {}
return Array.isArray(new C());
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
class C extends Array {}
return C.of(0) instanceof C;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Array {}
var c = new C();
return c.concat(1) instanceof C;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Array {}
var c = new C();
return c.filter(Boolean) instanceof C;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Array {}
var c = new C();
return c.map(Boolean) instanceof C;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,12 @@
function test() {
class C extends Array {}
var c = new C();
c.push(2,4,6);
return c.slice(1,2) instanceof C;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,12 @@
function test() {
class C extends Array {}
var c = new C();
c.push(2,4,6);
return c.splice(1,2) instanceof C;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Array {}
var c = new C();
return c instanceof C && c instanceof Array && Object.getPrototypeOf(C) === Array;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,14 @@
function test() {
class C extends Array {}
var c = new C();
var len1 = c.length;
c[2] = 'foo';
var len2 = c.length;
return len1 === 0 && len2 === 3;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,13 @@
function test() {
class C extends Array {}
var c = new C();
c[2] = 'foo';
c.length = 1;
return c.length === 1 && !(2 in c);
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return Array.from({ 0: "foo", 1: "bar", length: 2 }) + '' === "foo,bar";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
var iterable = (function*(){ yield 1; yield 2; yield 3; }());
return Array.from(iterable) + '' === "1,2,3";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,30 @@
var global = this;
function __createIterableObject(arr, methods) {
methods = methods || {};
if (typeof Symbol !== 'function' || !Symbol.iterator) {
return {};
}
arr.length++;
var iterator = {
next: function() {
return { value: arr.shift(), done: arr.length <= 0 };
},
'return': methods['return'],
'throw': methods['throw']
};
var iterable = {};
iterable[Symbol.iterator] = function(){ return iterator; }
return iterable;
}
function test() {
var iterable = global.__createIterableObject([1, 2, 3]);
return Array.from(iterable) + '' === "1,2,3";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,30 @@
var global = this;
function __createIterableObject(arr, methods) {
methods = methods || {};
if (typeof Symbol !== 'function' || !Symbol.iterator) {
return {};
}
arr.length++;
var iterator = {
next: function() {
return { value: arr.shift(), done: arr.length <= 0 };
},
'return': methods['return'],
'throw': methods['throw']
};
var iterable = {};
iterable[Symbol.iterator] = function(){ return iterator; }
return iterable;
}
function test() {
var iterable = global.__createIterableObject([1, 2, 3]);
return Array.from(Object.create(iterable)) + '' === "1,2,3";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,36 @@
var global = this;
function __createIterableObject(arr, methods) {
methods = methods || {};
if (typeof Symbol !== 'function' || !Symbol.iterator) {
return {};
}
arr.length++;
var iterator = {
next: function() {
return { value: arr.shift(), done: arr.length <= 0 };
},
'return': methods['return'],
'throw': methods['throw']
};
var iterable = {};
iterable[Symbol.iterator] = function(){ return iterator; }
return iterable;
}
function test() {
var closed = false;
var iter = global.__createIterableObject([1, 2, 3], {
'return': function(){ closed = true; return {}; }
});
try {
Array.from(iter, function() { throw 42 });
} catch(e){}
return closed;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
return Array.from({ 0: "foo", 1: "bar", length: 2 }, function(e, i) {
return e + this.baz + i;
}, { baz: "d" }) + '' === "food0,bard1";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,12 @@
function test() {
var iterable = (function*(){ yield "foo"; yield "bar"; yield "bal"; }());
return Array.from(iterable, function(e, i) {
return e + this.baz + i;
}, { baz: "d" }) + '' === "food0,bard1,bald2";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,32 @@
var global = this;
function __createIterableObject(arr, methods) {
methods = methods || {};
if (typeof Symbol !== 'function' || !Symbol.iterator) {
return {};
}
arr.length++;
var iterator = {
next: function() {
return { value: arr.shift(), done: arr.length <= 0 };
},
'return': methods['return'],
'throw': methods['throw']
};
var iterable = {};
iterable[Symbol.iterator] = function(){ return iterator; }
return iterable;
}
function test() {
var iterable = global.__createIterableObject(["foo", "bar", "bal"]);
return Array.from(iterable, function(e, i) {
return e + this.baz + i;
}, { baz: "d" }) + '' === "food0,bard1,bald2";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,32 @@
var global = this;
function __createIterableObject(arr, methods) {
methods = methods || {};
if (typeof Symbol !== 'function' || !Symbol.iterator) {
return {};
}
arr.length++;
var iterator = {
next: function() {
return { value: arr.shift(), done: arr.length <= 0 };
},
'return': methods['return'],
'throw': methods['throw']
};
var iterable = {};
iterable[Symbol.iterator] = function(){ return iterator; }
return iterable;
}
function test() {
var iterable = global.__createIterableObject(["foo", "bar", "bal"]);
return Array.from(Object.create(iterable), function(e, i) {
return e + this.baz + i;
}, { baz: "d" }) + '' === "food0,bard1,bald2";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
return typeof Array.of === 'function' &&
Array.of(2)[0] === 2;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
var prop = Object.getOwnPropertyDescriptor(Array, Symbol.species);
return 'get' in prop && Array[Symbol.species] === Array;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Function {}
var c = new C("x", "return this.bar + x;");
return c.apply({bar:1}, [2]) === 3;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Function {}
var c = new C("x", "y", "return this.bar + x + y;").bind({bar:1}, 2);
return c(6) === 9 && c instanceof C;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Function {}
var c = new C("x", "return this.bar + x;");
return c.call({bar:1}, 2) === 3;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Function {}
var c = new C("return 'foo';");
return c() === 'foo';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,12 @@
function test() {
class C extends Function {}
var c = new C("this.bar = 2;");
c.prototype.baz = 3;
return new c().bar === 2 && new c().baz === 3;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
class C extends Function {}
var c = new C("return 'foo';");
return c instanceof C && c instanceof Function && Object.getPrototypeOf(C) === Function;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
--> A comment
<!-- Another comment
var a = 3; <!-- Another comment
return a === 3;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,15 @@
function test() {
var map = new Map();
map.set(-0, "foo");
var k;
map.forEach(function (value, key) {
k = 1 / key;
});
return k === Infinity && map.get(+0) == "foo";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Map.prototype.clear === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Map.prototype.delete === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Map.prototype.entries === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Map.prototype.forEach === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Map.prototype.keys === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
var map = new Map();
return map.set(0, 0) === map;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,14 @@
function test() {
var key = {};
var map = new Map();
map.set(key, 123);
return map.size === 1;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Map.prototype.values === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Map.prototype[Symbol.iterator] === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
var prop = Object.getOwnPropertyDescriptor(Map, Symbol.species);
return 'get' in prop && Map[Symbol.species] === Map;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,19 @@
function test() {
// Iterator instance
var iterator = new Map()[Symbol.iterator]();
// %MapIteratorPrototype%
var proto1 = Object.getPrototypeOf(iterator);
// %IteratorPrototype%
var proto2 = Object.getPrototypeOf(proto1);
return proto2.hasOwnProperty(Symbol.iterator) &&
!proto1 .hasOwnProperty(Symbol.iterator) &&
!iterator .hasOwnProperty(Symbol.iterator) &&
iterator[Symbol.iterator]() === iterator;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,14 @@
function test() {
var key = {};
var map = new Map();
map.set(key, 123);
return map.has(key) && map.get(key) === 123;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
new Map(null);
return true;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,14 @@
function test() {
var key1 = {};
var key2 = {};
var map = new Map([[key1, 123], [key2, 456]]);
return map.has(key1) && map.get(key1) === 123 &&
map.has(key2) && map.get(key2) === 456;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,19 @@
function test() {
var passed = false;
var _set = Map.prototype.set;
Map.prototype.set = function(k, v) {
passed = true;
};
new Map([ [1, 2] ]);
Map.prototype.set = _set;
return passed;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,15 @@
function test() {
new Map();
try {
Map();
return false;
} catch(e) {
return true;
}
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,36 @@
var global = this;
function __createIterableObject(arr, methods) {
methods = methods || {};
if (typeof Symbol !== 'function' || !Symbol.iterator) {
return {};
}
arr.length++;
var iterator = {
next: function() {
return { value: arr.shift(), done: arr.length <= 0 };
},
'return': methods['return'],
'throw': methods['throw']
};
var iterable = {};
iterable[Symbol.iterator] = function(){ return iterator; }
return iterable;
}
function test() {
var closed = false;
var iter = global.__createIterableObject([1, 2, 3], {
'return': function(){ closed = true; return {}; }
});
try {
new Map(iter);
} catch(e){}
return closed;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.acosh === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.asinh === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.atanh === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.cbrt === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.clz32 === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.cosh === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.expm1 === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.fround === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,12 @@
function test() {
return Math.hypot() === 0 &&
Math.hypot(1) === 1 &&
Math.hypot(9, 12, 20) === 25 &&
Math.hypot(27, 36, 60, 100) === 125;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.imul === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.log10 === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.log1p === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.log2 === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.sign === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.sinh === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.tanh === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Math.trunc === "function";
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Number.EPSILON === 'number';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Number.MAX_SAFE_INTEGER === 'number';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Number.MIN_SAFE_INTEGER === 'number';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Number.isFinite === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Number.isInteger === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Number.isNaN === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return typeof Number.isSafeInteger === 'function';
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
var o = Object.create(null), p = {};
o.__proto__ = p;
return Object.getPrototypeOf(o) !== p;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,16 @@
function test() {
var desc = Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");
var A = function(){};
return (desc
&& "get" in desc
&& "set" in desc
&& desc.configurable
&& !desc.enumerable);
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
var A = function(){};
return (new A()).__proto__ === A.prototype;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return Object.getOwnPropertyNames(Object.prototype).indexOf('__proto__') > -1;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,9 @@
function test() {
return Object.prototype.hasOwnProperty('__proto__');
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
var o = {};
o.__proto__ = Array.prototype;
return o instanceof Array;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,10 @@
function test() {
var o = Object.assign({a:true}, {b:true}, {c:true});
return "a" in o && "b" in o && "c" in o;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,17 @@
function test() {
var o = {};
var sym = Symbol(), sym2 = Symbol(), sym3 = Symbol();
o[sym] = true;
o[sym2] = true;
o[sym3] = true;
var result = Object.getOwnPropertySymbols(o);
return result[0] === sym
&& result[1] === sym2
&& result[2] === sym3;
}
if (!test())
throw new Error("Test failed");

View File

@ -0,0 +1,11 @@
function test() {
return typeof Object.is === 'function' &&
Object.is(NaN, NaN) &&
!Object.is(-0, 0);
}
if (!test())
throw new Error("Test failed");

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