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)
36 lines
675 B
JavaScript
36 lines
675 B
JavaScript
function assert(b) {
|
|
if (!b)
|
|
throw new Error;
|
|
}
|
|
noInline(assert);
|
|
|
|
function getProperties(obj) {
|
|
let properties = [];
|
|
for (let name of Object.getOwnPropertyNames(obj)) {
|
|
properties.push(name);
|
|
}
|
|
return properties;
|
|
}
|
|
|
|
function theFunc(obj, index) {
|
|
let args = [42, 20];
|
|
let functions = getProperties(obj);
|
|
let func = functions[index % functions.length];
|
|
obj[func](...args);
|
|
}
|
|
|
|
let obj = {
|
|
valueOf: function (x, y) {
|
|
assert(x === 42);
|
|
assert(y === 20);
|
|
try {
|
|
} catch (e) {}
|
|
}
|
|
};
|
|
|
|
for (let i = 0; i < 1e5; ++i) {
|
|
for (let _i = 0; _i < 100; _i++) {
|
|
}
|
|
theFunc(obj, 897989);
|
|
}
|