Bug 1311227 - Annotate ffi_call as a GC function, r=jonco
authorSteve Fink <sfink@mozilla.com>
Wed, 19 Oct 2016 11:24:48 -0700
changeset 453591 7ab404ffffc6b813dc7491cf076c8c40e91abbec
parent 453590 4e9f3f0d6d8e2c7e8aa0037decd8405d5024bfa0
child 453592 5ff2c66f4020dbe9f77d5fe5187f9316ca7605df
push id39711
push userdmitchell@mozilla.com
push dateFri, 23 Dec 2016 21:59:47 +0000
reviewersjonco
bugs1311227
milestone53.0a1
Bug 1311227 - Annotate ffi_call as a GC function, r=jonco
js/src/devtools/rootAnalysis/annotations.js
js/src/devtools/rootAnalysis/loadCallgraph.js
--- a/js/src/devtools/rootAnalysis/annotations.js
+++ b/js/src/devtools/rootAnalysis/annotations.js
@@ -223,16 +223,20 @@ var ignoreFunctions = {
     "EntryType* nsTHashtable<EntryType>::PutEntry(nsTHashtable<EntryType>::KeyType) [with EntryType = nsBaseHashtableET<nsPtrHashKey<const mozilla::BlockingResourceBase>, nsAutoPtr<mozilla::DeadlockDetector<mozilla::BlockingResourceBase>::OrderingEntry> >; nsTHashtable<EntryType>::KeyType = const mozilla::BlockingResourceBase*]" : true,
     "EntryType* nsTHashtable<EntryType>::GetEntry(nsTHashtable<EntryType>::KeyType) const [with EntryType = nsBaseHashtableET<nsPtrHashKey<const mozilla::BlockingResourceBase>, nsAutoPtr<mozilla::DeadlockDetector<mozilla::BlockingResourceBase>::OrderingEntry> >; nsTHashtable<EntryType>::KeyType = const mozilla::BlockingResourceBase*]" : true,
 
     // The big hammers.
     "PR_GetCurrentThread" : true,
     "calloc" : true,
 };
 
+function extraGCFunctions() {
+    return ["ffi_call"];
+}
+
 function isProtobuf(name)
 {
     return name.match(/\bgoogle::protobuf\b/) ||
            name.match(/\bmozilla::devtools::protobuf\b/);
 }
 
 function isHeapSnapshotMockClass(name)
 {
--- a/js/src/devtools/rootAnalysis/loadCallgraph.js
+++ b/js/src/devtools/rootAnalysis/loadCallgraph.js
@@ -121,16 +121,21 @@ function loadCallgraph(file)
             var tag = match[2];
             if (tag == 'GC Call') {
                 addGCFunction(mangled, "GC");
                 numGCCalls++;
             }
         }
     }
 
+    // Add in any extra functions at the end. (If we did this early, it would
+    // mess up the id <-> name correspondence.)
+    for (var func of extraGCFunctions())
+        addGCFunction(func, "annotation");
+
     // Initialize suppressedFunctions to the set of all functions, and the
     // worklist to all toplevel callers.
     var worklist = [];
     for (var callee in callerGraph)
         suppressedFunctions[callee] = true;
     for (var caller in calleeGraph) {
         if (!(caller in callerGraph)) {
             suppressedFunctions[caller] = true;