Debian Codegraph @

js/src/jit-test/tests/debug/envChain_frame-eval-relazify.js

raw
1 // |jit-test| skip-if: isLcovEnabled()
2
3 function func(doEval) {
4 if (doEval) {
5 const dbg = this.newGlobal({sameZoneAs: {}}).Debugger({});
6 dbg.getNewestFrame().eval(`
7 function reaction() {
8 // Access global variable to walk through the environment chain.
9 return Map;
10 };
11 Promise.resolve(1).then(reaction);
12 `);
13 }
14 }
15
16 assertEq(isLazyFunction(func), true);
17 assertEq(isRelazifiableFunction(func), false);
18
19 // Delazify here.
20 func(false);
21
22 // Delazified function should be marked relazifiable.
23 assertEq(isLazyFunction(func), false);
24 assertEq(isRelazifiableFunction(func), true);
25
26 // Perform Frame.prototype.eval
27 func(true);
28
29 // Frame.prototype.eval should mark the enclosing script non-relazifiable.
30 assertEq(isLazyFunction(func), false);
31 assertEq(isRelazifiableFunction(func), false);
32
33 // This shouldn't relazify `func`.
34 relazifyFunctions();
35 relazifyFunctions();
36
37 assertEq(isLazyFunction(func), false);
38 assertEq(isRelazifiableFunction(func), false);
39
40 // Execute the inner function to make sure the enclosing script is not lazy.
41 drainJobQueue();