Debian Codegraph @

js/src/jit-test/tests/debug/ExecutionTracer-oom-test.js

raw
1
2 if (typeof enableExecutionTracing == "undefined") {
3 quit();
4 }
5
6
7 var g = newGlobal({ newCompartment: true });
8 var dbg = new Debugger();
9 dbg.addDebuggee(g);
10
11 g.enableExecutionTracing();
12
13 oomTest(function () {
14 g.eval(`[100].map(function f3(x) { return x; });`);
15 });
16
17 gc();
18
19 const trace = g.getExecutionTrace();
20
21 g.disableExecutionTracing();
22
23 assertEq(trace.length, 1);
24
25 const events = trace[0].events;
26 var err = events.find(e => e.kind == "Error");
27 // Guaranteeing an error is tricky. We don't have a ton of allocations inside
28 // the tracer to fail, and so with --ion we tend to get skipped over by
29 // oomTest's iterative failure logic. Accordingly, we just assert that if
30 // there is an error, it needs to be the last entry.
31 if (err) {
32 assertEq(err, events[events.length - 1]);
33 }