summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js')
-rw-r--r--js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js
new file mode 100644
index 000000000..c48afc0f5
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js
@@ -0,0 +1,55 @@
+// Test drainAllocationsLog() and byte sizes.
+
+const root = newGlobal();
+const dbg = new Debugger();
+const wrappedRoot = dbg.addDebuggee(root);
+
+root.eval(
+ `
+ function AsmModule(stdlib, foreign, heap) {
+ "use asm";
+
+ function test() {
+ return 5|0;
+ }
+
+ return { test: test };
+ }
+ const buf = new ArrayBuffer(1024*8);
+
+ function Ctor() {}
+ this.tests = [
+ { name: "new UInt8Array(256)", fn: () => new Uint8Array(256) },
+ { name: "arguments", fn: function () { return arguments; } },
+ { name: "asm.js module", fn: () => AsmModule(this, {}, buf) },
+ { name: "/2manyproblemz/g", fn: () => /2manyproblemz/g },
+ { name: "iterator", fn: () => [1,2,3][Symbol.iterator]() },
+ { name: "Error()", fn: () => Error() },
+ { name: "new Ctor", fn: () => new Ctor },
+ { name: "{}", fn: () => ({}) },
+ { name: "new Date", fn: () => new Date },
+ { name: "[1,2,3]", fn: () => [1,2,3] },
+ ];
+ `
+);
+
+for (let { name, fn } of root.tests) {
+ print("Test: " + name);
+
+ dbg.memory.trackingAllocationSites = true;
+
+ fn();
+
+ let entries = dbg.memory.drainAllocationsLog();
+
+ for (let {size} of entries) {
+ print(" " + size + " bytes");
+ // We should get some kind of byte size. We aren't testing that in depth
+ // here, it is tested pretty thoroughly in
+ // js/src/jit-test/tests/heap-analysis/byteSize-of-object.js.
+ assertEq(typeof size, "number");
+ assertEq(size > 0, true);
+ }
+
+ dbg.memory.trackingAllocationSites = false;
+}