summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/gc/finalizationRegistry-gray.js
blob: 5411a1a9ad6d6ba05ca78a927d833eb1947e6a87 (plain)
1
2
3
4
5
6
7
8
9
10
// Test gray finalization registry is correctly barrired.
target = {};
registry = new FinalizationRegistry(value => undefined);
registry.register(target, 1);
grayRoot()[0] = registry;
registry = undefined;
gc(); // Registry is now marked gray.
target = undefined;
gc(); // Target dies, registry is queued.
drainJobQueue();