summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-02.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Memory-trackingAllocationSites-02.js')
-rw-r--r--js/src/jit-test/tests/debug/Memory-trackingAllocationSites-02.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-02.js b/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-02.js
new file mode 100644
index 0000000000..5fa91f002a
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-02.js
@@ -0,0 +1,19 @@
+// Test that we don't get allocation sites when nobody has asked for them.
+
+const root = newGlobal({newCompartment: true});
+
+const dbg = new Debugger();
+const wrappedRoot = dbg.addDebuggee(root);
+
+dbg.memory.trackingAllocationSites = true;
+root.eval("this.obj = {};");
+dbg.memory.trackingAllocationSites = false;
+root.eval("this.obj2 = {};");
+
+let wrappedObj = wrappedRoot.makeDebuggeeValue(root.obj);
+let allocationSite = wrappedObj.allocationSite;
+assertEq(allocationSite != null && typeof allocationSite == "object", true);
+
+let wrappedObj2 = wrappedRoot.makeDebuggeeValue(root.obj2);
+let allocationSite2 = wrappedObj2.allocationSite;
+assertEq(allocationSite2, null);