blob: 77eb156f582bedd401f10615c5460d3b7812b92a [file] [log] [blame]
function assert(b) {
if (!b) throw new Error("bad value");
}
noInline(assert);
let i;
var o1 = {
get f() {
if (i === -1000)
throw new Error("hello");
return 20;
},
x: "x"
};
var o2 = {
f: 40
}
var o3 = {
x: 100,
f: "f"
}
function bar(i) {
if (i === -1000)
return o1;
if (i % 2)
return o3;
else
return o2;
}
noInline(bar);
function foo(i) {
var o = bar(i);
let v;
let v2;
let v3;
try {
v2 = o.x;
v = o.f;
} catch(e) {
assert(v2 === "x");
assert(o === o1);
}
}
noInline(foo);
foo(i);
for (i = 0; i < 1000; i++)
foo(i);
i = -1000;
for (let j = 0; j < 1000; j++)
foo(i);