Index: Source/devtools/front_end/AllocationProfile.js |
diff --git a/Source/devtools/front_end/AllocationProfile.js b/Source/devtools/front_end/AllocationProfile.js |
index bbba6e6d90ce3974a8eef9252d8cf701540cff3e..0a61140fd4e8b7e942b307ac1bbfd601d9790906 100644 |
--- a/Source/devtools/front_end/AllocationProfile.js |
+++ b/Source/devtools/front_end/AllocationProfile.js |
@@ -151,14 +151,7 @@ WebInspector.AllocationProfile.prototype = { |
*/ |
serializeCallers: function(nodeId) |
{ |
- var node = this._idToNode[nodeId]; |
- if (!node) { |
- var functionInfo = this._collapsedTopNodeIdToFunctionInfo[nodeId]; |
- node = functionInfo.bottomUpRoot(); |
- delete this._collapsedTopNodeIdToFunctionInfo[nodeId]; |
- this._idToNode[nodeId] = node; |
- } |
- |
+ var node = this._ensureBottomUpNode(nodeId); |
var nodesWithSingleCaller = []; |
while (node.callers().length === 1) { |
node = node.callers()[0]; |
@@ -173,6 +166,27 @@ WebInspector.AllocationProfile.prototype = { |
return new WebInspector.HeapSnapshotCommon.AllocationNodeCallers(nodesWithSingleCaller, branchingCallers); |
}, |
+ /** |
+ * @param {number} allocationNodeId |
+ * @return {!Array.<number>} |
+ */ |
+ traceIds: function(allocationNodeId) |
+ { |
+ return this._ensureBottomUpNode(allocationNodeId).traceTopIds; |
+ }, |
+ |
+ _ensureBottomUpNode: function(nodeId) |
alph
2014/03/18 12:28:22
annotate?
yurys
2014/03/18 12:30:47
Done.
|
+ { |
+ var node = this._idToNode[nodeId]; |
+ if (!node) { |
+ var functionInfo = this._collapsedTopNodeIdToFunctionInfo[nodeId]; |
+ node = functionInfo.bottomUpRoot(); |
+ delete this._collapsedTopNodeIdToFunctionInfo[nodeId]; |
+ this._idToNode[nodeId] = node; |
+ } |
+ return node; |
+ }, |
+ |
_serializeCaller: function(node) |
{ |
var callerId = this._nextNodeId++; |
@@ -249,6 +263,7 @@ WebInspector.BottomUpAllocationNode = function(functionInfo) |
this.allocationSize = 0; |
this.liveCount = 0; |
this.liveSize = 0; |
+ this.traceTopIds = []; |
this._callers = []; |
} |
@@ -256,7 +271,7 @@ WebInspector.BottomUpAllocationNode = function(functionInfo) |
WebInspector.BottomUpAllocationNode.prototype = { |
/** |
* @param {!WebInspector.TopDownAllocationNode} traceNode |
- * @return {!WebInspector.TopDownAllocationNode} |
+ * @return {!WebInspector.BottomUpAllocationNode} |
*/ |
addCaller: function(traceNode) |
{ |
@@ -354,11 +369,13 @@ WebInspector.FunctionAllocationInfo.prototype = { |
var size = node.allocationSize; |
var liveCount = node.liveCount; |
var liveSize = node.liveSize; |
+ var traceId = node.id; |
while (true) { |
bottomUpNode.allocationCount += count; |
bottomUpNode.allocationSize += size; |
bottomUpNode.liveCount += liveCount; |
bottomUpNode.liveSize += liveSize; |
+ bottomUpNode.traceTopIds.push(traceId); |
node = node.parent; |
if (node === null) { |
break; |