blob: fbfcdbf804e949daec41b52279c544a71e2a6ca2 [file] [log] [blame]
//@ requireOptions("--usePublicClassFields=true")
//@ if isFTLEnabled then runFTLNoCJIT else skip end
let ftlTrue = $vm.ftlTrue;
let didFTLCompile = false;
function stringObjectToString(i) {
class C {
[new String("foo")] = i;
}
didFTLCompile = ftlTrue();
let c = new C();
if (c.foo !== i)
throw new Error(`Failed on iteration ${i}\n${JSON.stringify(c)}`);
}
noInline(stringObjectToString);
let i = 0;
let maxTries = 30000;
for (; i < maxTries && !numberOfDFGCompiles(stringObjectToString) && !didFTLCompile; ++i) {
optimizeNextInvocation(stringObjectToString);
stringObjectToString(i);
}
if (i >= maxTries)
throw new Error("Failed to compile stringObjectToString with DFG JIT");