Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / HeapSnapshot.js
index ecccf31..287c968 100644 (file)
@@ -535,8 +535,7 @@ WebInspector.HeapSnapshotNode.prototype = {
      */
     retainedSize: function()
     {
-        var snapshot = this._snapshot;
-        return snapshot._nodes[this.nodeIndex + snapshot._nodeRetainedSizeOffset];
+        return this._snapshot._retainedSizes[this._ordinal()];
     },
 
     /**
@@ -706,7 +705,6 @@ WebInspector.HeapSnapshotProgress.prototype = {
  */
 WebInspector.HeapSnapshot = function(profile, progress)
 {
-    this.uid = profile.snapshot.uid;
     this._nodes = profile.nodes;
     this._containmentEdges = profile.edges;
     /** @type {!HeapSnapshotMetainfo} */
@@ -724,15 +722,13 @@ WebInspector.HeapSnapshot = function(profile, progress)
 
     this._init();
 
-    if (WebInspector.HeapSnapshot.enableAllocationProfiler) {
+    if (profile.snapshot.trace_function_count) {
         this._progress.updateStatus("Buiding allocation statistics\u2026");
         this._allocationProfile = new WebInspector.AllocationProfile(profile);
         this._progress.updateStatus("Done");
     }
 }
 
-WebInspector.HeapSnapshot.enableAllocationProfiler = false;
-
 /**
  * @constructor
  */
@@ -755,7 +751,6 @@ function HeapSnapshotHeader()
 {
     // New format.
     this.title = "";
-    this.uid = 0;
     this.meta = new HeapSnapshotMetainfo();
     this.node_count = 0;
     this.edge_count = 0;
@@ -1474,19 +1469,16 @@ WebInspector.HeapSnapshot.prototype = {
         var nodeSelfSizeOffset = this._nodeSelfSizeOffset;
         var nodeFieldCount = this._nodeFieldCount;
         var dominatorsTree = this._dominatorsTree;
-        // Reuse now unused edge_count field to store retained size.
-        var nodeRetainedSizeOffset = this._nodeRetainedSizeOffset = this._nodeEdgeCountOffset;
-        delete this._nodeEdgeCountOffset;
+        var retainedSizes = this._retainedSizes = new Float64Array(nodeCount);
 
-        for (var nodeIndex = 0, l = nodes.length; nodeIndex < l; nodeIndex += nodeFieldCount)
-            nodes[nodeIndex + nodeRetainedSizeOffset] = nodes[nodeIndex + nodeSelfSizeOffset];
+        for (var nodeOrdinal = 0; nodeOrdinal < nodeCount; ++nodeOrdinal)
+            retainedSizes[nodeOrdinal] = nodes[nodeOrdinal * nodeFieldCount + nodeSelfSizeOffset];
 
         // Propagate retained sizes for each node excluding root.
         for (var postOrderIndex = 0; postOrderIndex < nodeCount - 1; ++postOrderIndex) {
             var nodeOrdinal = postOrderIndex2NodeOrdinal[postOrderIndex];
-            var nodeIndex = nodeOrdinal * nodeFieldCount;
-            var dominatorIndex = dominatorsTree[nodeOrdinal] * nodeFieldCount;
-            nodes[dominatorIndex + nodeRetainedSizeOffset] += nodes[nodeIndex + nodeRetainedSizeOffset];
+            var dominatorOrdinal = dominatorsTree[nodeOrdinal];
+            retainedSizes[dominatorOrdinal] += retainedSizes[nodeOrdinal];
         }
     },
 
@@ -1821,7 +1813,7 @@ WebInspector.HeapSnapshot.prototype = {
      */
     updateStaticData: function()
     {
-        return new WebInspector.HeapSnapshotCommon.StaticData(this.nodeCount, this._rootNodeIndex, this.totalSize, this.uid, this._maxJsNodeId());
+        return new WebInspector.HeapSnapshotCommon.StaticData(this.nodeCount, this._rootNodeIndex, this.totalSize, this._maxJsNodeId());
     }
 };