summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-15.js
blob: d8af3c9319ccd4ff9d681019c3aed6ef64f4c740 (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
30
// Test drainAllocationsLog() and [[Class]] names.
const root = newGlobal({newCompartment: true});
const dbg = new Debugger();
const wrappedRoot = dbg.addDebuggee(root)

root.eval(
  `
  this.tests = [
    { expected: "Object",    test: () => new Object    },
    { expected: "Array",     test: () => []            },
    { expected: "Date",      test: () => new Date      },
    { expected: "RegExp",    test: () => /problems/    },
    { expected: "Int8Array", test: () => new Int8Array },
    { expected: "Promise",   test: () => new Promise(function (){})},
  ];
  `
);


for (let { expected, test } of root.tests) {
  print(expected);

  dbg.memory.trackingAllocationSites = true;
  test();
  let allocs = dbg.memory.drainAllocationsLog();
  dbg.memory.trackingAllocationSites = false;

  assertEq(allocs.some(a => a.class === expected), true);
}