Debian Codegraph @

js/src/jit-test/tests/gc/bug-1603330.js

raw
1 // Allocate the object in the function to prevent marked as a singleton so the
2 // object won't be kept alive by IC stub.
3 function allocObj() { return {}; }
4
5 let wr;
6 {
7 let obj = allocObj();
8 wr = new WeakRef(obj);
9 }
10
11 assertEq(wr.deref() !== undefined, true);
12
13 clearKeptObjects();
14 gc();
15
16 assertEq(wr.deref(), undefined);