Debian Codegraph @

js/src/jit-test/tests/self-hosting/oom-toplevel.js

raw
1 // |jit-test| skip-if: !hasFunction.oomAtAllocation
2
3 function code(n) {
4 return `
5 // Trigger top-level execution with an OOM in the middle.
6 oomAtAllocation(${n});
7 try { getSelfHostedValue("numberFormatCache") } catch (e) { }
8 resetOOMFailure();
9
10 // Read current value of "dateTimeFormatCache".
11 var initVal = getSelfHostedValue("dateTimeFormatCache");
12 assertEq(typeof initVal, "object");
13
14 // Retrigger top-level execution by reading a later value in the file.
15 // Then compare that "dateTimeFormatCache" was not clobbered.
16 getSelfHostedValue("collatorCache");
17 assertEq(initVal, getSelfHostedValue("dateTimeFormatCache"));
18 `;
19 }
20
21 // We cannot use `oomTest` here because of divergence issues from things like
22 // `RegisterShapeCache` absorbing OOMs.
23 for (var i = 1; i < 300; ++i) {
24 evaluate(code(i), { global: newGlobal() });
25 }