Debian Codegraph @

js/src/jit-test/tests/debug/Debugger-debuggees-31.js

raw
1 // |jit-test| skip-if: !hasFunction["gczeal"]
2 // Removing and adding debuggees during an incremental sweep should not confuse
3 // the generatorFrames map.
4
5 // Let any ongoing incremental GC finish, and then clear any ambient zeal
6 // settings established by the harness (the JS_GC_ZEAL env var, shell arguments,
7 // etc.)
8 gczeal(0);
9
10 let g = newGlobal({newCompartment: true});
11 g.eval('function* f() { yield 123; }');
12
13 let dbg = Debugger(g);
14 dbg.onEnterFrame = frame => {
15 dbg.removeDebuggee(g);
16 dbg.addDebuggee(g);
17 };
18
19 // Select GCZeal mode 10 (IncrementalMultipleSlices: Incremental GC in many
20 // slices) and use long slices, to make sure that the debuggee removal occurs
21 // during a slice.
22 gczeal(10, 0);
23 gcslice(1);
24 while (gcstate() !== "NotAcctive" && gcstate() !== "Sweep") {
25 gcslice(1000);
26 }
27
28 let genObj = g.f();
29 genObj.return();
30 assertEq(gcstate(), "Sweep");