Title: [117953] trunk
Revision
117953
Author
[email protected]
Date
2012-05-22 04:54:50 -0700 (Tue, 22 May 2012)

Log Message

Web Inspector: HeapProfiler: upstream retainedSize calculation.
https://bugs.webkit.org/show_bug.cgi?id=87107

This patch upstreams V8::HeapSnapshotGenerator::CalculateRetainedSizes function to front-end.
After that we will be able to drop retainedSize field from the snapshot serialized data.
See meta-bug https://bugs.webkit.org/show_bug.cgi?id=87089

Reviewed by Yury Semikhatsky.

PerformanceTests:

* inspector/heap-snapshot.html: add counter for the _calculateRetainedSize method.

Source/WebCore:

* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshotNode.prototype.get retainedSize):
(WebInspector.HeapSnapshot.prototype._init):
(WebInspector.HeapSnapshot.prototype._calculateRetainedSizes):

LayoutTests:

* inspector/profiler/heap-snapshot-expected.txt:
* inspector/profiler/heap-snapshot.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117952 => 117953)


--- trunk/LayoutTests/ChangeLog	2012-05-22 11:54:17 UTC (rev 117952)
+++ trunk/LayoutTests/ChangeLog	2012-05-22 11:54:50 UTC (rev 117953)
@@ -1,3 +1,17 @@
+2012-05-22  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: HeapProfiler: upstream retainedSize calculation.
+        https://bugs.webkit.org/show_bug.cgi?id=87107
+
+        This patch upstreams V8::HeapSnapshotGenerator::CalculateRetainedSizes function to front-end.
+        After that we will be able to drop retainedSize field from the snapshot serialized data.
+        See meta-bug https://bugs.webkit.org/show_bug.cgi?id=87089
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/profiler/heap-snapshot-expected.txt:
+        * inspector/profiler/heap-snapshot.html:
+
 2012-05-22  Kristóf Kosztyó  <[email protected]>
 
         NRWT results.html page should show a count of the number of tests in each category

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-expected.txt (117952 => 117953)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot-expected.txt	2012-05-22 11:54:17 UTC (rev 117952)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-expected.txt	2012-05-22 11:54:50 UTC (rev 117953)
@@ -17,6 +17,8 @@
 
 Running: heapSnapshotDominatorsTreeTest
 
+Running: heapSnapshotRetainedSizeTest
+
 Running: heapSnapshotDominatedNodesTest
 
 Running: heapSnapshotPageOwnedTest

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot.html (117952 => 117953)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot.html	2012-05-22 11:54:17 UTC (rev 117952)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot.html	2012-05-22 11:54:50 UTC (rev 117953)
@@ -116,6 +116,17 @@
             next();
         },
 
+        function heapSnapshotRetainedSizeTest(next)
+        {
+            var snapshot = new WebInspector.HeapSnapshot(InspectorTest.createHeapSnapshotMock());
+            var actualRetainedSizes = new Array(snapshot.nodeCount);
+            for (var nodeOrdinal = 0; nodeOrdinal < snapshot.nodeCount; ++nodeOrdinal)
+                actualRetainedSizes[nodeOrdinal] = snapshot._retainedSizes[nodeOrdinal];
+            var expectedRetainedSizes = [20, 2, 8, 10, 5, 6];
+            InspectorTest.assertEquals(JSON.stringify(expectedRetainedSizes), JSON.stringify(actualRetainedSizes), "Retained sizes");
+            next();
+        },
+
         function heapSnapshotDominatedNodesTest(next)
         {
             var snapshot = new WebInspector.HeapSnapshot(InspectorTest.createHeapSnapshotMock());

Modified: trunk/PerformanceTests/ChangeLog (117952 => 117953)


--- trunk/PerformanceTests/ChangeLog	2012-05-22 11:54:17 UTC (rev 117952)
+++ trunk/PerformanceTests/ChangeLog	2012-05-22 11:54:50 UTC (rev 117953)
@@ -1,3 +1,16 @@
+2012-05-22  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: HeapProfiler: upstream retainedSize calculation.
+        https://bugs.webkit.org/show_bug.cgi?id=87107
+
+        This patch upstreams V8::HeapSnapshotGenerator::CalculateRetainedSizes function to front-end.
+        After that we will be able to drop retainedSize field from the snapshot serialized data.
+        See meta-bug https://bugs.webkit.org/show_bug.cgi?id=87089
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/heap-snapshot.html: add counter for the _calculateRetainedSize method.
+
 2012-05-21  Kent Tamura  <[email protected]>
 
         Add performance tests for <textarea>

Modified: trunk/PerformanceTests/inspector/heap-snapshot.html (117952 => 117953)


--- trunk/PerformanceTests/inspector/heap-snapshot.html	2012-05-22 11:54:17 UTC (rev 117952)
+++ trunk/PerformanceTests/inspector/heap-snapshot.html	2012-05-22 11:54:50 UTC (rev 117953)
@@ -26,6 +26,7 @@
             InspectorTest.measureFunction(WebInspector.HeapSnapshot.prototype, "_buildAggregates");
             InspectorTest.measureFunction(WebInspector.HeapSnapshot.prototype, "_calculateClassesRetainedSize");
             InspectorTest.measureFunction(WebInspector.HeapSnapshot.prototype, "_calculateObjectToWindowDistance");
+            InspectorTest.measureFunction(WebInspector.HeapSnapshot.prototype, "_calculateRetainedSizes");
             InspectorTest.measureFunction(WebInspector.HeapSnapshot.prototype, "_markDetachedDOMTreeNodes");
             InspectorTest.measureFunction(WebInspector.HeapSnapshot.prototype, "_markQueriableHeapObjects");
             InspectorTest.measureFunction(WebInspector.HeapSnapshot.prototype, "_markPageOwnedNodes");

Modified: trunk/Source/WebCore/ChangeLog (117952 => 117953)


--- trunk/Source/WebCore/ChangeLog	2012-05-22 11:54:17 UTC (rev 117952)
+++ trunk/Source/WebCore/ChangeLog	2012-05-22 11:54:50 UTC (rev 117953)
@@ -1,3 +1,19 @@
+2012-05-22  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: HeapProfiler: upstream retainedSize calculation.
+        https://bugs.webkit.org/show_bug.cgi?id=87107
+
+        This patch upstreams V8::HeapSnapshotGenerator::CalculateRetainedSizes function to front-end.
+        After that we will be able to drop retainedSize field from the snapshot serialized data.
+        See meta-bug https://bugs.webkit.org/show_bug.cgi?id=87089
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshotNode.prototype.get retainedSize):
+        (WebInspector.HeapSnapshot.prototype._init):
+        (WebInspector.HeapSnapshot.prototype._calculateRetainedSizes):
+
 2012-05-22  Emil A Eklund  <[email protected]>
 
         Change RenderBlock to user RenderBox/RenderInline writing mode logic

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (117952 => 117953)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-05-22 11:54:17 UTC (rev 117952)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-05-22 11:54:50 UTC (rev 117953)
@@ -530,7 +530,7 @@
 
     get retainedSize()
     {
-        return this._nodes[this.nodeIndex + this._snapshot._nodeRetainedSizeOffset];
+        return this._snapshot._retainedSizes[this.nodeIndex / this._snapshot._nodeFieldCount];
     },
 
     get retainers()
@@ -679,7 +679,6 @@
         this._nodeNameOffset = meta.node_fields.indexOf("name");
         this._nodeIdOffset = meta.node_fields.indexOf("id");
         this._nodeSelfSizeOffset = meta.node_fields.indexOf("self_size");
-        this._nodeRetainedSizeOffset = meta.node_fields.indexOf("retained_size");
         this._firstEdgeIndexOffset = meta.node_fields.indexOf("edges_index");
         this._nodeFieldCount = meta.node_fields.length;
 
@@ -722,6 +721,7 @@
         this._calculateObjectToWindowDistance();
         var result = this._buildPostOrderIndex();
         this._dominatorsTree = this._buildDominatorTree(result.postOrderIndex2NodeIndex, result.nodeOrdinal2PostOrderIndex);
+        this._calculateRetainedSizes();
         this._buildDominatedNodes();
     },
 
@@ -1255,6 +1255,32 @@
         return dominatorsTree;
     },
 
+    _calculateRetainedSizes: function()
+    {
+        // As for the dominators tree we only know parent nodes, not
+        // children, to sum up total sizes we "bubble" node's self size
+        // adding it to all of its parents.
+        var nodes = this._nodes;
+        var nodeSelfSizeOffset = this._nodeSelfSizeOffset;
+        var nodeFieldCount = this._nodeFieldCount;
+        var dominatorsTree = this._dominatorsTree;
+        var retainedSizes = new Uint32Array(this.nodeCount);
+        var rootNodeOrdinal = this._rootNodeIndex / nodeFieldCount;
+
+        for (var nodeOrdinal = 0, nodeSelfSizeIndex = nodeSelfSizeOffset, l = this.nodeCount;
+             nodeOrdinal < l;
+             ++nodeOrdinal, nodeSelfSizeIndex += nodeFieldCount) {
+            var nodeSelfSize = nodes[nodeSelfSizeIndex];
+            var currentNodeOrdinal = nodeOrdinal;
+            retainedSizes[currentNodeOrdinal] += nodeSelfSize;
+            do {
+                currentNodeOrdinal = dominatorsTree[currentNodeOrdinal] / nodeFieldCount;
+                retainedSizes[currentNodeOrdinal] += nodeSelfSize;
+            } while (currentNodeOrdinal !== rootNodeOrdinal);
+        }
+        this._retainedSizes = retainedSizes;
+    },
+
     _buildDominatedNodes: function()
     {
         // Builds up two arrays:

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js (117952 => 117953)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2012-05-22 11:54:17 UTC (rev 117952)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2012-05-22 11:54:50 UTC (rev 117953)
@@ -168,7 +168,7 @@
     this._callbacks = [];
     this._previousCallbacks = [];
     // There is no support for workers in Chromium DRT.
-    this._worker = typeof InspectorTest === "undefined" ? new WebInspector.HeapSnapshotRealWorker() : new WebInspector.HeapSnapshotFakeWorker();
+    this._worker = /*typeof InspectorTest === "undefined" ? new WebInspector.HeapSnapshotRealWorker() : */new WebInspector.HeapSnapshotFakeWorker();
     this._worker.addEventListener("message", this._messageReceived, this);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to