blob: 9864044031306adf2bf367e45e73d4dcd61d7558 [file] [log] [blame]
//@ runBigIntEnabled
function assert(a, e) {
if (a !== e)
throw new Error("Bad!");
}
function foo(o) {
let c;
do {
let a = 2 * o;
o.bigInt = true;
let b = 1n * o;
for (let i = 0; i < 10000; i++) {
c = i;
}
let d = b * o;
c = a * d;
} while(false);
}
noInline(foo);
let o = {
valueOf: function () {
return this.bigInt ? 2n : 2;
}
}
for (let i = 0; i < 1000; i++) {
try {
o.bigInt = false;
foo(o);
} catch(e) {
assert(e instanceof TypeError, true);
}
}