[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha 8e5433b70f on Tue Dec 18 2018 19:16:11 GMT+0000 (Coordinated Universal Time)

This commit is contained in:
test262-automation 2018-12-18 19:19:38 +00:00
parent 7054805941
commit f8bd9710a3
13 changed files with 351 additions and 0 deletions

View File

@ -0,0 +1,7 @@
let x = [];
for (let i = 0; i < 30; ++i) {
for (let j = 0; j < 20000; ++j) {
x[0]
x.unshift(undefined);
}
}

View File

@ -0,0 +1,25 @@
//@ skip if $architecture != "arm64" and $architecture != "x86-64"
function sumOfArithSeries(limit) {
return limit * (limit + 1) / 2;
}
var n = 1000000;
var array = [42, "hello"];
function foo() {
var result = 0;
var q;
for (var i = 0; i < n; ++i) {
var o = {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: i}}}}}}}}}}}}}}}}}}};
var p = {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: i + 1}}}}}}}}}}}}}}}}}}};
q = array[(i > n - 100) | 0] + 1;
result += o.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f + p.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f;
}
return q + result;
}
var result = foo();
if (result != "hello" + 1 + (sumOfArithSeries(n - 1) + sumOfArithSeries(n)))
throw "Error: bad result: " + result;

View File

@ -0,0 +1,16 @@
//@ requireOptions("--jitPolicyScale=0.1")
function foo(a) {
a.length;
}
for (let i = 0; i < 100; i++) {
let a = i % 2 ? new Uint8Array() : new Uint16Array();
for (let j = 0; j < 2; j++)
foo(a);
gc();
foo('');
foo(a);
}

View File

@ -0,0 +1,48 @@
//@ skip if $architecture != "arm64" and $architecture != "x86-64"
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function test(num)
{
var regexp = /hello world/;
var world = /World/;
regexp.lastIndex = world;
world.lastIndex = regexp;
if (num === 0)
return regexp;
if (num === 1)
return regexp.lastIndex;
return regexp.lastIndex.lastIndex;
}
noInline(test);
for (var i = 0; i < 1e6; ++i) {
var num = i % 3;
switch (num) {
case 0:
var regexp = test(num);
shouldBe(regexp instanceof RegExp, true);
shouldBe(regexp.toString(), "/hello world/");
shouldBe(regexp.lastIndex instanceof RegExp, true);
shouldBe(regexp.lastIndex.toString(), "/World/");
break;
case 1:
var regexp = test(num);
shouldBe(regexp instanceof RegExp, true);
shouldBe(regexp.toString(), "/World/");
shouldBe(regexp.lastIndex instanceof RegExp, true);
shouldBe(regexp.lastIndex.toString(), "/hello world/");
break;
case 2:
var regexp = test(num);
shouldBe(regexp instanceof RegExp, true);
shouldBe(regexp.toString(), "/hello world/");
shouldBe(regexp.lastIndex instanceof RegExp, true);
shouldBe(regexp.lastIndex.toString(), "/World/");
break;
}
}

View File

@ -0,0 +1,30 @@
//@ skip if $architecture != "arm64" and $architecture != "x86-64"
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function test(flag, string)
{
var regexp = /hello/g;
regexp.lastIndex = "Cocoa";
var result = string.match(regexp);
if (flag)
return [result, regexp];
return regexp.lastIndex;
}
noInline(test);
for (var i = 0; i < 1e6; ++i) {
if (i & 0x1) {
var [result, regexp] = test(true, "hellohello");
shouldBe(regexp instanceof RegExp, true);
shouldBe(regexp.lastIndex, 0);
shouldBe(result.length, 2);
shouldBe(result[0], "hello");
shouldBe(result[1], "hello");
} else
shouldBe(test(false, "hellohello"), 0);
}

View File

@ -0,0 +1,21 @@
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function test(object)
{
return Object.keys(object);
}
noInline(test);
var object = {};
for (var i = 0; i < 1e6; ++i) {
var result = test(object);
shouldBe(result.length, 0);
shouldBe(result[0], undefined);
result[0] = i;
shouldBe(result.length, 1);
shouldBe(result[0], i);
}

View File

@ -0,0 +1,28 @@
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function test(object)
{
return Object.keys(object);
}
noInline(test);
var object = { Cocoa: 42 };
for (var i = 0; i < 1e6; ++i) {
var result = test(object);
shouldBe(result.length, 1);
shouldBe(result[0], 'Cocoa');
}
Reflect.defineProperty(object, 'Cocoa', {
enumerable: false
});
for (var i = 0; i < 1e6; ++i) {
var result = test(object);
shouldBe(result.length, 0);
shouldBe(result[0], undefined);
}

View File

@ -0,0 +1,28 @@
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function test(object)
{
return Object.keys(object);
}
noInline(test);
var object = {};
for (var i = 0; i < 1e6; ++i) {
var result = test(object);
shouldBe(result.length, 0);
shouldBe(result[0], undefined);
result[0] = i;
shouldBe(result.length, 1);
shouldBe(result[0], i);
}
object[0] = 42;
for (var i = 0; i < 1e6; ++i) {
var result = test(object);
shouldBe(result.length, 1);
shouldBe(result[0], '0');
}

View File

@ -0,0 +1,28 @@
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function test(object)
{
return Object.keys(object);
}
noInline(test);
var object = {};
for (var i = 0; i < 1e6; ++i) {
var result = test(object);
shouldBe(result.length, 0);
shouldBe(result[0], undefined);
result[0] = i;
shouldBe(result.length, 1);
shouldBe(result[0], i);
}
object.Cocoa = 42;
for (var i = 0; i < 1e6; ++i) {
var result = test(object);
shouldBe(result.length, 1);
shouldBe(result[0], 'Cocoa');
}

View File

@ -0,0 +1,25 @@
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function test(object)
{
return Object.keys(object);
}
noInline(test);
var object = {0: 42};
for (var i = 0; i < 1e3; ++i) {
var result = test(object);
shouldBe(result.length, 1);
shouldBe(result[0], '0');
}
object[1] = 44;
for (var i = 0; i < 1e3; ++i) {
var result = test(object);
shouldBe(result.length, 2);
shouldBe(result[0], '0');
shouldBe(result[1], '1');
}

View File

@ -0,0 +1,57 @@
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function test(object)
{
return Object.keys(object);
}
noInline(test);
{
let object = new String("Cocoa");
for (let i = 0; i < 1e3; ++i) {
let result = test(object);
shouldBe(result.length, 5);
shouldBe(result[0], '0');
shouldBe(result[1], '1');
shouldBe(result[2], '2');
shouldBe(result[3], '3');
shouldBe(result[4], '4');
}
object.Cocoa = 42;
let result = test(object);
shouldBe(result.length, 6);
shouldBe(result[0], '0');
shouldBe(result[1], '1');
shouldBe(result[2], '2');
shouldBe(result[3], '3');
shouldBe(result[4], '4');
shouldBe(result[5], 'Cocoa');
}
{
let object = new String("Cocoa");
for (let i = 0; i < 1e3; ++i) {
let result = test(object);
shouldBe(result.length, 5);
shouldBe(result[0], '0');
shouldBe(result[1], '1');
shouldBe(result[2], '2');
shouldBe(result[3], '3');
shouldBe(result[4], '4');
}
object[8] = 42;
let result = test(object);
shouldBe(result.length, 6);
shouldBe(result[0], '0');
shouldBe(result[1], '1');
shouldBe(result[2], '2');
shouldBe(result[3], '3');
shouldBe(result[4], '4');
shouldBe(result[5], '8');
}

View File

@ -0,0 +1,14 @@
//@ requireOptions("--useProbeOSRExit=true", "--forceEagerCompilation=true")
// This test passes if it does not crash especially on ASAN builds.
let x = 0;
function Foo(a) {
a === a;
'' + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x;
}
for (let i=0; i<8; i++)
new Foo(0);
new Foo({});

View File

@ -0,0 +1,24 @@
//@ requireOptions("--useSamplingProfiler=true", "--useProbeOSRExit=true", "--useObjectAllocationSinking=false", "--sampleInterval=10")
function foo(ranges) {
const CHUNK_SIZE = 95;
for (const [start, end] of ranges) {
const codePoints = [];
for (let length = 0, codePoint = start; codePoint <= end; codePoint++) {
codePoints[length++] = codePoint;
if (length === CHUNK_SIZE) {
length = 0;
codePoints.length = 0;
String.fromCodePoint(...[]);
}
}
String.fromCodePoint(...codePoints);
}
}
for (let i=0; i<3; i++) {
let x = foo([
[ 0, 10000 ],
[ 68000, 1114111 ]
]);
}