Bug 1056410 - Add edge between internal destructors. r=terrence, a=lizzard
authorSteve Fink <sfink@mozilla.com>
Fri, 29 Aug 2014 15:59:06 -0700
changeset 267473 0296484f4f84bc937223e8defd0b6e5f6c5ea5f1
parent 267472 1291a13c1fc5ea7e47ce4c985ed54edfae46f69f
child 267474 b964c317dbff7a62d214ae51f960e8bef3e3aab1
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence, lizzard
bugs1056410
milestone39.0
Bug 1056410 - Add edge between internal destructors. r=terrence, a=lizzard
js/src/devtools/rootAnalysis/computeCallgraph.js
--- a/js/src/devtools/rootAnalysis/computeCallgraph.js
+++ b/js/src/devtools/rootAnalysis/computeCallgraph.js
@@ -283,15 +283,26 @@ for (var nameIndex = minStream; nameInde
     // add a dummy call edge from "foo" -> "foo *INTERNAL* ", since only "foo"
     // will show up as called but only "foo *INTERNAL* " will be emitted in the
     // case where the constructors are identical.
     //
     // This is slightly conservative in the case where they are *not*
     // identical, but that should be rare enough that we don't care.
     var markerPos = functionName.indexOf(internalMarker);
     if (markerPos > 0) {
-        var inChargeXTor = functionName.substr(0, markerPos) + functionName.substr(markerPos + internalMarker.length);
+        var inChargeXTor = functionName.replace(internalMarker, "");
         print("D " + memo(inChargeXTor) + " " + memo(functionName));
+
+        // Bug 1056410: Oh joy. GCC does something even funkier internally,
+        // where it generates calls to ~Foo() but a body for ~Foo(int32) even
+        // though it uses the same mangled name for both. So we need to add a
+        // synthetic edge from the former to the latter.
+        //
+        // inChargeXTor will have the (int32).
+        if (functionName.indexOf("::~") > 0) {
+            var calledDestructor = inChargeXTor.replace("(int32)", "()");
+            print("D " + memo(calledDestructor) + " " + memo(inChargeXTor));
+        }
     }
 
     xdb.free_string(name);
     xdb.free_string(data);
 }