Bug 1056410 - Add edge between internal destructors. r=terrence, a=2.2+
authorSteve Fink <sfink@mozilla.com>
Fri, 29 Aug 2014 15:59:06 -0700
changeset 238399 af7478dd5b99928c980de0afe0f95fc4b18021d9
parent 238398 3258b987e82308da8dc5d2197a9ac77a5432b192
child 238400 bb9c9ed29fdd8d310f2f26ada432b60f32c75e39
push id609
push userryanvm@gmail.com
push dateTue, 19 May 2015 01:35:34 +0000
treeherdermozilla-b2g37_v2_2@bab8e4f5cbe8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence, 2.2
bugs1056410
milestone37.0
Bug 1056410 - Add edge between internal destructors. r=terrence, a=2.2+
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);
 }