Bug 1120655 - Label various compartment iters as GCPointers, r=terrence
☠☠ backed out by ea3e5ea5c6f2 ☠ ☠
authorSteve Fink <sfink@mozilla.com>
Mon, 12 Jan 2015 14:09:21 -0800
changeset 231950 f88b64c38d3dce82ac051ed3407136c830bf87f7
parent 231949 483a3749115b2a1f90470df4582c241851788899
child 231951 09ef352a85366921b93aa5c06a7cc722ab161218
push id28364
push usercbook@mozilla.com
push dateThu, 05 Mar 2015 14:12:01 +0000
treeherdermozilla-central@fa59461863f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1120655
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1120655 - Label various compartment iters as GCPointers, r=terrence
js/src/devtools/rootAnalysis/annotations.js
js/src/devtools/rootAnalysis/computeGCTypes.js
--- a/js/src/devtools/rootAnalysis/annotations.js
+++ b/js/src/devtools/rootAnalysis/annotations.js
@@ -276,8 +276,13 @@ function isOverridableField(initialCSU, 
         return false;
     if (initialCSU == 'nsIScriptContext') {
         if (field == 'GetWindowProxy' || field == 'GetWindowProxyPreserveColor')
             return false;
     }
 
     return true;
 }
+
+function isGCPointer(typeName)
+{
+    return typeName.indexOf("CompartmentsIter") != -1;
+}
--- a/js/src/devtools/rootAnalysis/computeGCTypes.js
+++ b/js/src/devtools/rootAnalysis/computeGCTypes.js
@@ -1,15 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 
 "use strict";
 
 loadRelativeToScript('utility.js');
 loadRelativeToScript('annotations.js');
 
+var annotatedGCPointers = [];
+
 function processCSU(csu, body)
 {
     if (!("DataField" in body))
         return;
     for (var field of body.DataField) {
         var type = field.Field.Type;
         var fieldName = field.Field.Name[0];
         if (type.Kind == "Pointer") {
@@ -20,16 +22,18 @@ function processCSU(csu, body)
         if (type.Kind == "CSU") {
             // Ignore nesting in classes which are AutoGCRooters. We only consider
             // types with fields that may not be properly rooted.
             if (type.Name == "JS::AutoGCRooter" || type.Name == "JS::CustomAutoRooter")
                 return;
             addNestedStructure(csu, type.Name, fieldName);
         }
     }
+    if (isGCPointer(csu))
+        annotatedGCPointers.push(csu);
 }
 
 var structureParents = {}; // Map from field => list of <parent, fieldName>
 var pointerParents = {}; // Map from field => list of <parent, fieldName>
 
 function addNestedStructure(csu, inner, field)
 {
     if (!(inner in structureParents))
@@ -138,16 +142,19 @@ addGCType('JSString');
 addGCType('js::Shape');
 addGCType('js::BaseShape');
 addGCType('JSScript');
 addGCType('js::LazyScript');
 addGCType('js::ion::IonCode');
 addGCPointer('JS::Value');
 addGCPointer('jsid');
 
+for (var typeName of annotatedGCPointers)
+    addGCPointer(typeName);
+
 // AutoCheckCannotGC should also not be held live across a GC function.
 addGCPointer('JS::AutoCheckCannotGC');
 
 function explain(csu, indent, seen) {
     if (!seen)
         seen = new Set();
     seen.add(csu);
     if (!(csu in gcFields))