summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-18.js
blob: 781e300f937a221a20d9de060012abf734a3378c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Test drainAllocationsLog() entries' inNursery flag.

gczeal(0);

const root = newGlobal({newCompartment: true});
const dbg = new Debugger();
const wrappedRoot = dbg.addDebuggee(root);

dbg.memory.trackingAllocationSites = true;

root.eval(
  `
  for (let i = 0; i < 10; i++)
    allocationMarker({ nursery: true });

  for (let i = 0; i < 10; i++)
    allocationMarker({ nursery: false });
  `
);

let entries = dbg.memory.drainAllocationsLog().filter(e => e.class == "AllocationMarker");

assertEq(entries.length, 20);

for (let i = 0; i < 10; i++)
  assertEq(entries[i].inNursery, true);

for (let i = 10; i < 20; i++)
  assertEq(entries[i].inNursery, false);