mirror of https://github.com/tc39/test262.git
[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha 671be37db3 on Sat Sep 01 2018 18:17:03 GMT+0000 (Coordinated Universal Time)
This commit is contained in:
parent
f98218f831
commit
199f6b3154
|
@ -0,0 +1,137 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function assert(b) {
|
||||||
|
if (!b)
|
||||||
|
throw new Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function test1() {
|
||||||
|
function foo(dv) {
|
||||||
|
return [dv.getFloat32(0), dv.getFloat64(0)];
|
||||||
|
}
|
||||||
|
noInline(foo);
|
||||||
|
|
||||||
|
let ab = new ArrayBuffer(8);
|
||||||
|
let dv = new DataView(ab);
|
||||||
|
dv.setFloat64(0, 128431.42342189432, false);
|
||||||
|
for (let i = 0; i < 10000; ++i) {
|
||||||
|
let result = foo(dv);
|
||||||
|
assert(result[0] !== result[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
test1();
|
||||||
|
|
||||||
|
function test2() {
|
||||||
|
function foo(dv) {
|
||||||
|
return [dv.getFloat32(0), dv.getFloat32(0)];
|
||||||
|
}
|
||||||
|
noInline(foo);
|
||||||
|
|
||||||
|
let ab = new ArrayBuffer(8);
|
||||||
|
let dv = new DataView(ab);
|
||||||
|
dv.setFloat64(0, 128431.42342189432, false);
|
||||||
|
for (let i = 0; i < 10000; ++i) {
|
||||||
|
let result = foo(dv);
|
||||||
|
assert(result[0] === result[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
test2();
|
||||||
|
|
||||||
|
function test3() {
|
||||||
|
function foo(dv, ta) {
|
||||||
|
let a = dv.getFloat64(0, true);
|
||||||
|
ta[0] = Math.PI;
|
||||||
|
let b = dv.getFloat64(0, true);
|
||||||
|
return [a, b];
|
||||||
|
}
|
||||||
|
noInline(foo);
|
||||||
|
|
||||||
|
let ab = new ArrayBuffer(8);
|
||||||
|
let dv = new DataView(ab);
|
||||||
|
let ta = new Float64Array(ab);
|
||||||
|
for (let i = 0; i < 40000; ++i) {
|
||||||
|
dv.setFloat64(0, 0.0, true);
|
||||||
|
let result = foo(dv, ta);
|
||||||
|
assert(result[0] === 0.0);
|
||||||
|
assert(result[1] === Math.PI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
test3();
|
||||||
|
|
||||||
|
function test4() {
|
||||||
|
function foo(dv) {
|
||||||
|
let a = dv.getInt32(0, true);
|
||||||
|
let b = dv.getInt32(0, false);
|
||||||
|
return [a, b];
|
||||||
|
}
|
||||||
|
noInline(foo);
|
||||||
|
|
||||||
|
let ab = new ArrayBuffer(8);
|
||||||
|
let dv = new DataView(ab);
|
||||||
|
dv.setInt32(0, 0x11223344, true);
|
||||||
|
for (let i = 0; i < 40000; ++i) {
|
||||||
|
let result = foo(dv);
|
||||||
|
assert(result[0] === 0x11223344);
|
||||||
|
assert(result[1] === 0x44332211)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
test4();
|
||||||
|
|
||||||
|
function test5() {
|
||||||
|
function foo(dv, littleEndian) {
|
||||||
|
let a = dv.getInt32(0, littleEndian);
|
||||||
|
let b = dv.getInt32(0, !littleEndian);
|
||||||
|
return [a, b];
|
||||||
|
}
|
||||||
|
noInline(foo);
|
||||||
|
|
||||||
|
let ab = new ArrayBuffer(8);
|
||||||
|
let dv = new DataView(ab);
|
||||||
|
dv.setInt32(0, 0x11223344, true);
|
||||||
|
for (let i = 0; i < 40000; ++i) {
|
||||||
|
let result = foo(dv, true);
|
||||||
|
assert(result[0] === 0x11223344);
|
||||||
|
assert(result[1] === 0x44332211)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
test5();
|
||||||
|
|
||||||
|
function test6() {
|
||||||
|
function foo(dv, littleEndian) {
|
||||||
|
let a = dv.getInt32(0, littleEndian);
|
||||||
|
let b = dv.getInt32(0, littleEndian);
|
||||||
|
return [a, b];
|
||||||
|
}
|
||||||
|
noInline(foo);
|
||||||
|
|
||||||
|
let ab = new ArrayBuffer(8);
|
||||||
|
let dv = new DataView(ab);
|
||||||
|
dv.setInt32(0, 0x11223344, true);
|
||||||
|
for (let i = 0; i < 40000; ++i) {
|
||||||
|
let result = foo(dv, true);
|
||||||
|
assert(result[0] === 0x11223344);
|
||||||
|
assert(result[1] === 0x11223344)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
test6();
|
||||||
|
|
||||||
|
function test7() {
|
||||||
|
function foo(dv) {
|
||||||
|
let a = dv.getInt32(0, true);
|
||||||
|
let b = dv.getInt32(4, true);
|
||||||
|
return [a, b];
|
||||||
|
}
|
||||||
|
noInline(foo);
|
||||||
|
|
||||||
|
let ab = new ArrayBuffer(8);
|
||||||
|
let dv = new DataView(ab);
|
||||||
|
dv.setInt32(0, 0x11223344, true);
|
||||||
|
dv.setInt32(4, 0x12121212, true);
|
||||||
|
for (let i = 0; i < 40000; ++i) {
|
||||||
|
let result = foo(dv, true);
|
||||||
|
assert(result[0] === 0x11223344);
|
||||||
|
assert(result[1] === 0x12121212);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
test7();
|
|
@ -0,0 +1,60 @@
|
||||||
|
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)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldThrow(() => {
|
||||||
|
Function("@", { toString() { throw 42; } })
|
||||||
|
}, `42`);
|
||||||
|
|
||||||
|
var counter = 0;
|
||||||
|
class Parameter {
|
||||||
|
constructor(index)
|
||||||
|
{
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
toString() {
|
||||||
|
shouldBe(this.index, counter);
|
||||||
|
counter++;
|
||||||
|
return `x${this.index}`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Body {
|
||||||
|
constructor(index)
|
||||||
|
{
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
toString() {
|
||||||
|
shouldBe(this.index, counter);
|
||||||
|
counter++;
|
||||||
|
return `42`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var parameters = [];
|
||||||
|
for (var i = 0; i < 50; ++i) {
|
||||||
|
parameters.push(new Parameter(parameters.length));
|
||||||
|
var args = parameters.slice();
|
||||||
|
args.push(new Body(args.length));
|
||||||
|
counter = 0;
|
||||||
|
Function.apply(this, args);
|
||||||
|
shouldBe(counter, args.length);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
function shouldBe(actual, expected) {
|
||||||
|
if (actual !== expected)
|
||||||
|
throw new Error('bad value: ' + actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldBe((function test() { }).toString(), `function test() { }`);
|
||||||
|
shouldBe((() => { }).toString(), `() => { }`);
|
||||||
|
shouldBe((function* test() { }).toString(), `function* test() { }`);
|
||||||
|
shouldBe((async function* test() { }).toString(), `async function* test() { }`);
|
||||||
|
shouldBe((async function test() { }).toString(), `async function test() { }`);
|
||||||
|
shouldBe((async () => { }).toString(), `async () => { }`);
|
|
@ -0,0 +1,25 @@
|
||||||
|
//@ runDefault("--jitPolicyScale=0", "--useConcurrentJIT=0", "--validateGraphAtEachPhase=1")
|
||||||
|
|
||||||
|
let re0 = /a/;
|
||||||
|
let str0 = 'b';
|
||||||
|
function foo() {
|
||||||
|
/a/.exec('b');
|
||||||
|
for (var i = 0; i < 6; i++) {
|
||||||
|
}
|
||||||
|
for (var i = 0; i < 3; i++) {
|
||||||
|
re0.exec('a');
|
||||||
|
}
|
||||||
|
str0.match(/a/);
|
||||||
|
for (var i = 0; i < 2; i++) {
|
||||||
|
str0.match(/a/g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function bar() {
|
||||||
|
for (var i = 0; i < 6; i++) {
|
||||||
|
'a'.match(/b/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foo();
|
||||||
|
bar();
|
||||||
|
foo();
|
|
@ -0,0 +1,12 @@
|
||||||
|
try {
|
||||||
|
var a0 = '\ud801';
|
||||||
|
var a1 = [];
|
||||||
|
a2 = a0.padEnd(2147483644,'x');
|
||||||
|
a1[a2];
|
||||||
|
} catch (e) {
|
||||||
|
exception = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exception != "Error: Out of memory")
|
||||||
|
throw "FAILED";
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
//@ runDefault
|
||||||
|
// This test passes if it does not crash.
|
||||||
|
['a'+0].lastIndexOf('a0');
|
|
@ -0,0 +1,7 @@
|
||||||
|
//@ runDefault
|
||||||
|
// This passes if it does not crash.
|
||||||
|
new WebAssembly.CompileError({
|
||||||
|
valueOf() {
|
||||||
|
throw new Error();
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,4 @@
|
||||||
|
//@ runDefault
|
||||||
|
// This test passes if it does not crash.
|
||||||
|
let x = new DataView(new ArrayBuffer(1));
|
||||||
|
Object.defineProperty(x, 'foo', {});
|
Loading…
Reference in New Issue