Bug 1056410 - Add edge between internal destructors. r=terrence, a=2.2+
--- 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);
}