[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha c52a480a12 on Tue Oct 23 2018 18:44:06 GMT+0000 (Coordinated Universal Time)

This commit is contained in:
test262-automation 2018-10-23 18:47:02 +00:00
parent adb58490f4
commit 2f41648a06
9 changed files with 323 additions and 76 deletions

View File

@ -0,0 +1,97 @@
//@ runBigIntEnabled
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
function assert(a) {
if (!a)
throw new Error("Bad assertion");
}
assert.sameValue = function (input, expected, message) {
if (input !== expected)
throw new Error(message);
}
assert.sameValue(0b00n ^ 0b00n, 0b00n, "0b00n ^ 0b00n === 0b00n");
assert.sameValue(0b00n ^ 0b01n, 0b01n, "0b00n ^ 0b01n === 0b01n");
assert.sameValue(0b01n ^ 0b00n, 0b01n, "0b01n ^ 0b00n === 0b01n");
assert.sameValue(0b00n ^ 0b10n, 0b10n, "0b00n ^ 0b10n === 0b10n");
assert.sameValue(0b10n ^ 0b00n, 0b10n, "0b10n ^ 0b00n === 0b10n");
assert.sameValue(0b00n ^ 0b11n, 0b11n, "0b00n ^ 0b11n === 0b11n");
assert.sameValue(0b11n ^ 0b00n, 0b11n, "0b11n ^ 0b00n === 0b11n");
assert.sameValue(0b01n ^ 0b01n, 0b00n, "0b01n ^ 0b01n === 0b00n");
assert.sameValue(0b01n ^ 0b10n, 0b11n, "0b01n ^ 0b10n === 0b11n");
assert.sameValue(0b10n ^ 0b01n, 0b11n, "0b10n ^ 0b01n === 0b11n");
assert.sameValue(0b01n ^ 0b11n, 0b10n, "0b01n ^ 0b11n === 0b10n");
assert.sameValue(0b11n ^ 0b01n, 0b10n, "0b11n ^ 0b01n === 0b10n");
assert.sameValue(0b10n ^ 0b10n, 0b00n, "0b10n ^ 0b10n === 0b00n");
assert.sameValue(0b10n ^ 0b11n, 0b01n, "0b10n ^ 0b11n === 0b01n");
assert.sameValue(0b11n ^ 0b10n, 0b01n, "0b11n ^ 0b10n === 0b01n");
assert.sameValue(0xffffffffn ^ 0n, 0xffffffffn, "0xffffffffn ^ 0n === 0xffffffffn");
assert.sameValue(0n ^ 0xffffffffn, 0xffffffffn, "0n ^ 0xffffffffn === 0xffffffffn");
assert.sameValue(0xffffffffn ^ 0xffffffffn, 0n, "0xffffffffn ^ 0xffffffffn === 0n");
assert.sameValue(0xffffffffffffffffn ^ 0n, 0xffffffffffffffffn, "0xffffffffffffffffn ^ 0n === 0xffffffffffffffffn");
assert.sameValue(0n ^ 0xffffffffffffffffn, 0xffffffffffffffffn, "0n ^ 0xffffffffffffffffn === 0xffffffffffffffffn");
assert.sameValue(0xffffffffffffffffn ^ 0xffffffffn, 0xffffffff00000000n, "0xffffffffffffffffn ^ 0xffffffffn === 0xffffffff00000000n");
assert.sameValue(0xffffffffn ^ 0xffffffffffffffffn, 0xffffffff00000000n, "0xffffffffn ^ 0xffffffffffffffffn === 0xffffffff00000000n");
assert.sameValue(
0xffffffffffffffffn ^ 0xffffffffffffffffn, 0n,
"0xffffffffffffffffn ^ 0xffffffffffffffffn === 0n");
assert.sameValue(
0xbf2ed51ff75d380fd3be813ec6185780n ^ 0x4aabef2324cedff5387f1f65n, 0xbf2ed51fbdf6d72cf7705ecbfe6748e5n,
"0xbf2ed51ff75d380fd3be813ec6185780n ^ 0x4aabef2324cedff5387f1f65n === 0xbf2ed51fbdf6d72cf7705ecbfe6748e5n");
assert.sameValue(
0x4aabef2324cedff5387f1f65n ^ 0xbf2ed51ff75d380fd3be813ec6185780n, 0xbf2ed51fbdf6d72cf7705ecbfe6748e5n,
"0x4aabef2324cedff5387f1f65n ^ 0xbf2ed51ff75d380fd3be813ec6185780n === 0xbf2ed51fbdf6d72cf7705ecbfe6748e5n");
assert.sameValue(0n ^ -1n, -1n, "0n ^ -1n === -1n");
assert.sameValue(-1n ^ 0n, -1n, "-1n ^ 0n === -1n");
assert.sameValue(0n ^ -2n, -2n, "0n ^ -2n === -2n");
assert.sameValue(-2n ^ 0n, -2n, "-2n ^ 0n === -2n");
assert.sameValue(1n ^ -2n, -1n, "1n ^ -2n === -1n");
assert.sameValue(-2n ^ 1n, -1n, "-2n ^ 1n === -1n");
assert.sameValue(2n ^ -2n, -4n, "2n ^ -2n === -4n");
assert.sameValue(-2n ^ 2n, -4n, "-2n ^ 2n === -4n");
assert.sameValue(2n ^ -3n, -1n, "2n ^ -3n === -1n");
assert.sameValue(-3n ^ 2n, -1n, "-3n ^ 2n === -1n");
assert.sameValue(-1n ^ -2n, 1n, "-1n ^ -2n === 1n");
assert.sameValue(-2n ^ -1n, 1n, "-2n ^ -1n === 1n");
assert.sameValue(-2n ^ -2n, 0n, "-2n ^ -2n === 0n");
assert.sameValue(-2n ^ -3n, 3n, "-2n ^ -3n === 3n");
assert.sameValue(-3n ^ -2n, 3n, "-3n ^ -2n === 3n");
assert.sameValue(0xffffffffn ^ -1n, -0x100000000n, "0xffffffffn ^ -1n === -0x100000000n");
assert.sameValue(-1n ^ 0xffffffffn, -0x100000000n, "-1n ^ 0xffffffffn === -0x100000000n");
assert.sameValue(0xffffffffffffffffn ^ -1n, -0x10000000000000000n, "0xffffffffffffffffn ^ -1n === -0x10000000000000000n");
assert.sameValue(-1n ^ 0xffffffffffffffffn, -0x10000000000000000n, "-1n ^ 0xffffffffffffffffn === -0x10000000000000000n");
assert.sameValue(
0xbf2ed51ff75d380fd3be813ec6185780n ^ -0x4aabef2324cedff5387f1f65n, -0xbf2ed51fbdf6d72cf7705ecbfe6748e5n,
"0xbf2ed51ff75d380fd3be813ec6185780n ^ -0x4aabef2324cedff5387f1f65n === -0xbf2ed51fbdf6d72cf7705ecbfe6748e5n");
assert.sameValue(
-0x4aabef2324cedff5387f1f65n ^ 0xbf2ed51ff75d380fd3be813ec6185780n, -0xbf2ed51fbdf6d72cf7705ecbfe6748e5n,
"-0x4aabef2324cedff5387f1f65n ^ 0xbf2ed51ff75d380fd3be813ec6185780n === -0xbf2ed51fbdf6d72cf7705ecbfe6748e5n");
assert.sameValue(
-0xbf2ed51ff75d380fd3be813ec6185780n ^ 0x4aabef2324cedff5387f1f65n, -0xbf2ed51fbdf6d72cf7705ecbfe67481bn,
"-0xbf2ed51ff75d380fd3be813ec6185780n ^ 0x4aabef2324cedff5387f1f65n === -0xbf2ed51fbdf6d72cf7705ecbfe67481bn");
assert.sameValue(
0x4aabef2324cedff5387f1f65n ^ -0xbf2ed51ff75d380fd3be813ec6185780n, -0xbf2ed51fbdf6d72cf7705ecbfe67481bn,
"0x4aabef2324cedff5387f1f65n ^ -0xbf2ed51ff75d380fd3be813ec6185780n === -0xbf2ed51fbdf6d72cf7705ecbfe67481bn");
assert.sameValue(
-0xbf2ed51ff75d380fd3be813ec6185780n ^ -0x4aabef2324cedff5387f1f65n, 0xbf2ed51fbdf6d72cf7705ecbfe67481bn,
"-0xbf2ed51ff75d380fd3be813ec6185780n ^ -0x4aabef2324cedff5387f1f65n === 0xbf2ed51fbdf6d72cf7705ecbfe67481bn");
assert.sameValue(
-0x4aabef2324cedff5387f1f65n ^ -0xbf2ed51ff75d380fd3be813ec6185780n, 0xbf2ed51fbdf6d72cf7705ecbfe67481bn,
"-0x4aabef2324cedff5387f1f65n ^ -0xbf2ed51ff75d380fd3be813ec6185780n === 0xbf2ed51fbdf6d72cf7705ecbfe67481bn");
assert.sameValue(-0xffffffffn ^ 0n, -0xffffffffn, "-0xffffffffn ^ 0n === -0xffffffffn");
assert.sameValue(0n ^ -0xffffffffn, -0xffffffffn, "0n ^ -0xffffffffn === -0xffffffffn");
assert.sameValue(
-0xffffffffffffffffn ^ 0x10000000000000000n, -0x1ffffffffffffffffn,
"-0xffffffffffffffffn ^ 0x10000000000000000n === -0x1ffffffffffffffffn");
assert.sameValue(
0x10000000000000000n ^ -0xffffffffffffffffn, -0x1ffffffffffffffffn,
"0x10000000000000000n ^ -0xffffffffffffffffn === -0x1ffffffffffffffffn");
assert.sameValue(
-0xffffffffffffffffffffffffn ^ 0x10000000000000000n, -0xfffffffeffffffffffffffffn,
"-0xffffffffffffffffffffffffn ^ 0x10000000000000000n === -0xfffffffeffffffffffffffffn");
assert.sameValue(
0x10000000000000000n ^ -0xffffffffffffffffffffffffn, -0xfffffffeffffffffffffffffn,
"0x10000000000000000n ^ -0xffffffffffffffffffffffffn === -0xfffffffeffffffffffffffffn");

View File

@ -0,0 +1,29 @@
//@ runBigIntEnabled
assert = {
sameValue: function (input, expected, message) {
if (input !== expected)
throw new Error(message);
}
};
let o = {
[Symbol.toPrimitive]: function() {
throw new Error("Bad");
}
};
try{
o ^ Symbol("2");
assert.sameValue(true, false, "Exception expected to be throwed, but executed without error");
} catch (e) {
assert.sameValue(e.message, "Bad", "Expected to throw Error('Bad'), but got: " + e);
}
try{
Symbol("2") ^ o;
assert.sameValue(true, false, "Exception expected to be throwed, but executed without error");
} catch (e) {
assert.sameValue(e instanceof TypeError, true, "Expected to throw TypeError, but got: " + e)
}

View File

@ -0,0 +1,104 @@
//@ runBigIntEnabled
function assert(a, message) {
if (!a)
throw new Error(message);
}
function assertThrowTypeError(a, b, message) {
try {
let n = a ^ b;
assert(false, message + ": Should throw TypeError, but executed without exception");
} catch (e) {
assert(e instanceof TypeError, message + ": expected TypeError, got: " + e);
}
}
assertThrowTypeError(30n, "foo", "BigInt ^ String");
assertThrowTypeError("bar", 18757382984821n, "String ^ BigInt");
assertThrowTypeError(30n, Symbol("foo"), "BigInt ^ Symbol");
assertThrowTypeError(Symbol("bar"), 18757382984821n, "Symbol ^ BigInt");
assertThrowTypeError(30n, 3320, "BigInt ^ Int32");
assertThrowTypeError(33256, 18757382984821n, "Int32 ^ BigInt");
assertThrowTypeError(30n, 0.543, "BigInt ^ Double");
assertThrowTypeError(230.19293, 18757382984821n, "Double ^ BigInt");
assertThrowTypeError(30n, NaN, "BigInt ^ NaN");
assertThrowTypeError(NaN, 18757382984821n, "NaN ^ BigInt");
assertThrowTypeError(30n, +Infinity, "BigInt ^ +Infinity");
assertThrowTypeError(+Infinity, 18757382984821n, "+Infinity ^ BigInt");
assertThrowTypeError(30n, -Infinity, "BigInt ^ -Infinity");
assertThrowTypeError(-Infinity, 18757382984821n, "-Infinity ^ BigInt");
assertThrowTypeError(30n, null, "BigInt ^ null");
assertThrowTypeError(null, 18757382984821n, "null ^ BigInt");
assertThrowTypeError(30n, undefined, "BigInt ^ undefined");
assertThrowTypeError(undefined, 18757382984821n, "undefined ^ BigInt");
assertThrowTypeError(30n, true, "BigInt ^ true");
assertThrowTypeError(true, 18757382984821n, "true ^ BigInt");
assertThrowTypeError(30n, false, "BigInt ^ false");
assertThrowTypeError(false, 18757382984821n, "false ^ BigInt");
// Error when returning from object
let o = {
valueOf: function () { return Symbol("Foo"); }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.valueOf returning Symbol");
assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Symbol ^ BigInt");
o = {
valueOf: function () { return 33256; }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.valueOf returning Int32");
assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Int32 ^ BigInt");
o = {
valueOf: function () { return 0.453; }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.valueOf returning Double");
assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Double ^ BigInt");
o = {
toString: function () { return Symbol("Foo"); }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.toString returning Symbol");
assertThrowTypeError(o, 18757382984821n, "Object.toString returning Symbol ^ BigInt");
o = {
toString: function () { return 33256; }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.toString returning Int32");
assertThrowTypeError(o, 18757382984821n, "Object.toString returning Int32 ^ BigInt");
o = {
toString: function () { return 0.453; }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.toString returning Double");
assertThrowTypeError(o, 18757382984821n, "Object.toString returning Double ^ BigInt");
o = {
[Symbol.toPrimitive]: function () { return Symbol("Foo"); }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.@@toPrimitive returning Symbol");
assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Symbol ^ BigInt");
o = {
[Symbol.toPrimitive]: function () { return 33256; }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.@@toPrimitive returning Int32");
assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Int32 ^ BigInt");
o = {
[Symbol.toPrimitive]: function () { return 0.453; }
};
assertThrowTypeError(30n, o, "BigInt ^ Object.@@toPrimitive returning Double");
assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Double ^ BigInt");

View File

@ -0,0 +1,37 @@
//@ runBigIntEnabled
assert = {
sameValue: function (input, expected, message) {
if (input !== expected)
throw new Error(message);
}
};
function testBitXor(x, y, z, message) {
assert.sameValue(x ^ y, z, message);
assert.sameValue(y ^ x, z, message);
}
testBitXor(Object(0b10n), 0b01n, 0b11n, "ToPrimitive: unbox object with internal slot");
let o = {
[Symbol.toPrimitive]: function() {
return 0b10n;
}
};
testBitXor(o, 0b01n, 0b11n, "ToPrimitive: @@toPrimitive");
o = {
valueOf: function() {
return 0b10n;
}
};
testBitXor(o, 0b01n, 0b11n, "ToPrimitive: valueOf");
o = {
toString: function() {
return 0b10n;
}
}
testBitXor(o, 0b01n, 0b11n, "ToPrimitive: toString");

View File

@ -0,0 +1,15 @@
//@ runDefault("--useConcurrentJIT=0", "--validateFTLOSRExitLiveness=1")
function foo(o, p) {
p = null;
try {
o.f = null;
p = null;
} catch (e) {
}
}
noInline(foo);
for (var i = 0; i < 1000000; ++i) {
foo({});
}

View File

@ -1,40 +0,0 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function shouldThrow(func, errorMessage) {
var errorThrown = false;
var error = null;
try {
func();
} catch (e) {
errorThrown = true;
error = e;
}
if (!errorThrown)
throw new Error('not thrown');
if (String(error) !== errorMessage)
throw new Error(`bad error: ${String(error)}`);
}
for (var i = 0; i < 10; ++i) {
var f = Function('/*) {\n*/', 'return 42');
shouldBe(f.toString(),
`function anonymous(/*) {
*/) {
return 42
}`);
}
shouldThrow(() => Function('/*', '*/){\nreturn 42'), `SyntaxError: Parameters should match arguments offered as parameters in Function constructor.`);
shouldThrow(() => Function('/*', '*/){\nreturn 43'), `SyntaxError: Parameters should match arguments offered as parameters in Function constructor.`);
for (var i = 0; i < 10; ++i) {
var f = Function('/*) {\n*/', 'return 43');
shouldBe(f.toString(),
`function anonymous(/*) {
*/) {
return 43
}`);
}

View File

@ -1,36 +0,0 @@
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var GeneratorFunction = function*(){}.constructor;
var AsyncFunction = async function(){}.constructor;
var AsyncGeneratorFunction = async function*(){}.constructor;
var f = Function(`return 42`);
shouldBe(typeof anonymous, `undefined`);
shouldBe(f.toString(),
`function anonymous() {
return 42
}`);
var gf = GeneratorFunction(`return 42`);
shouldBe(typeof anonymous, `undefined`);
shouldBe(gf.toString(),
`function* anonymous() {
return 42
}`);
var af = AsyncFunction(`return 42`);
shouldBe(typeof anonymous, `undefined`);
shouldBe(af.toString(),
`async function anonymous() {
return 42
}`);
var agf = AsyncGeneratorFunction(`return 42`);
shouldBe(typeof anonymous, `undefined`);
shouldBe(agf.toString(),
`async function* anonymous() {
return 42
}`);

View File

@ -0,0 +1,15 @@
//@ requireOptions("--jitPolicyScale=0")
// This test should not crash.
function test(array) {
return array.push(0, 0.1);
}
for (var i = 0; i < 100000; ++i) {
test([])
}
for (var i = 0; i < 100000; ++i) {
test([0])
}

View File

@ -0,0 +1,26 @@
function set(arr, value) {
arr[0] = value;
}
function getImmutableArrayOrSet(get) {
let arr = [1];
if (get)
return arr;
set(arr, 42);
set({}, 1);
}
noInline(getImmutableArrayOrSet);
function test() {
getImmutableArrayOrSet(true);
for (let i = 0; i < 10000; i++)
getImmutableArrayOrSet(false);
let arr = getImmutableArrayOrSet(true);
if (arr[0] != 1)
throw "FAILED";
}
test();