test262/implementation-contributed/javascriptcore/stress/ftl-try-catch-getter-ic-fail-to-call-operation-throw-error.js
test262-automation e9a5a7f918 [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) (#1620)
* [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)
2018-07-03 15:59:58 -04:00

50 lines
726 B
JavaScript

function assert(b) {
if (!b)
throw new Error("bad value")
}
noInline(assert);
let oThrow = {
x: 20,
y: 40,
z: 50,
get f() { throw new Error("Hello World!"); }
};
let o1 = {
x: 20,
f: 40
};
let o2 = {
x: 20,
y: 50,
get f() { return 20; }
};
function foo(f) {
let o = f();
try {
o = o.f;
} catch(e) {
assert(o === oThrow); // Make sure this is not undefined when we have an IC miss and an exception at the same time.
}
}
noInline(foo);
let i;
let flag = false;
function f() {
if (flag)
return oThrow;
if (i % 2)
return o1;
return o2;
}
noInline(f);
for (i = 0; i < 100000; i++) {
foo(f);
}
flag = true;
foo(f);