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