blob: cf6d07544cb6b084d65bc24a0da46c1d1971dad5 [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 = o / 1n;
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);
}
}