mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 22:40:28 +02:00
* [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)
42 lines
652 B
JavaScript
42 lines
652 B
JavaScript
function assert(b, m = "Bad!") {
|
|
if (!b) {
|
|
throw new Error(m);
|
|
}
|
|
}
|
|
|
|
function test(f, iters = 1000) {
|
|
for (let i = 0; i < iters; i++)
|
|
f(i);
|
|
}
|
|
|
|
function func(x) {
|
|
return x;
|
|
}
|
|
noInline(func);
|
|
|
|
function check(index, arr, B)
|
|
{
|
|
for (let i = 0; i < 1000; i++)
|
|
assert(arr[i] instanceof B);
|
|
}
|
|
noInline(check);
|
|
|
|
test(function body(index) {
|
|
class A {
|
|
constructor(x, f = func)
|
|
{
|
|
this._value = x;
|
|
this._func = f;
|
|
}
|
|
}
|
|
|
|
class B extends A {
|
|
}
|
|
|
|
let arr = [];
|
|
for (let i = 0; i < 1000; i++)
|
|
arr.push(new B(20));
|
|
|
|
check(index, arr, B);
|
|
}, 8);
|