Diff
Modified: trunk/LayoutTests/ChangeLog (117785 => 117786)
--- trunk/LayoutTests/ChangeLog 2012-05-21 15:54:58 UTC (rev 117785)
+++ trunk/LayoutTests/ChangeLog 2012-05-21 16:02:07 UTC (rev 117786)
@@ -1,5 +1,17 @@
2012-05-21 Ilya Tikhonovsky <[email protected]>
+ Web Inspector: switch buildDominatedNodes function to front-end calculated _dominatorsTree
+ https://bugs.webkit.org/show_bug.cgi?id=87022
+
+ The new version is using _dominatorsTree array that was build at front-end.
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/profiler/heap-snapshot-expected.txt:
+ * inspector/profiler/heap-snapshot.html:
+
+2012-05-21 Ilya Tikhonovsky <[email protected]>
+
Web Inspector: introduce a helper for HeapSnapshot post-processing tests.
https://bugs.webkit.org/show_bug.cgi?id=87009
Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-expected.txt (117785 => 117786)
--- trunk/LayoutTests/inspector/profiler/heap-snapshot-expected.txt 2012-05-21 15:54:58 UTC (rev 117785)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-expected.txt 2012-05-21 16:02:07 UTC (rev 117786)
@@ -17,6 +17,8 @@
Running: heapSnapshotDominatorsTreeTest
+Running: heapSnapshotDominatedNodesTest
+
Running: heapSnapshotPageOwnedTest
Running: heapSnapshotRetainersTest
Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot.html (117785 => 117786)
--- trunk/LayoutTests/inspector/profiler/heap-snapshot.html 2012-05-21 15:54:58 UTC (rev 117785)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot.html 2012-05-21 16:02:07 UTC (rev 117786)
@@ -116,6 +116,24 @@
next();
},
+ function heapSnapshotDominatedNodesTest(next)
+ {
+ var snapshot = new WebInspector.HeapSnapshot(InspectorTest.createHeapSnapshotMock());
+
+ var expectedDominatedNodes = [21, 14, 7, 28, 35];
+ var actualDominatedNodes = snapshot._dominatedNodes;
+ InspectorTest.assertEquals(expectedDominatedNodes.length, actualDominatedNodes.length, "Dominated Nodes length");
+ for (var i = 0; i < expectedDominatedNodes.length; ++i)
+ InspectorTest.assertEquals(expectedDominatedNodes[i], actualDominatedNodes[i], "Dominated Nodes");
+
+ var expectedDominatedNodeIndex = [0, 3, 3, 4, 5, 5, 5];
+ var actualDominatedNodeIndex = snapshot._firstDominatedNodeIndex;
+ InspectorTest.assertEquals(expectedDominatedNodeIndex.length, actualDominatedNodeIndex.length, "Dominated Nodes Index length");
+ for (var i = 0; i < expectedDominatedNodeIndex.length; ++i)
+ InspectorTest.assertEquals(expectedDominatedNodeIndex[i], actualDominatedNodeIndex[i], "Dominated Nodes Index");
+ next();
+ },
+
function heapSnapshotPageOwnedTest(next)
{
var builder = new InspectorTest.HeapSnapshotBuilder();
Modified: trunk/Source/WebCore/ChangeLog (117785 => 117786)
--- trunk/Source/WebCore/ChangeLog 2012-05-21 15:54:58 UTC (rev 117785)
+++ trunk/Source/WebCore/ChangeLog 2012-05-21 16:02:07 UTC (rev 117786)
@@ -1,3 +1,16 @@
+2012-05-21 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: switch buildDominatedNodes function to front-end calculated _dominatorsTree
+ https://bugs.webkit.org/show_bug.cgi?id=87022
+
+ The new version is using _dominatorsTree array that was build at front-end.
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/front-end/HeapSnapshot.js:
+ (WebInspector.HeapSnapshot.prototype._init):
+ (WebInspector.HeapSnapshot.prototype._buildDominatedNodes):
+
2012-05-21 Pavel Feldman <[email protected]>
Web Inspector: change WebCore/English.lproj/locallizedStrings encoding from UTF-16 to UTF-8.
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (117785 => 117786)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2012-05-21 15:54:58 UTC (rev 117785)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2012-05-21 16:02:07 UTC (rev 117786)
@@ -719,12 +719,11 @@
this._markInvisibleEdges();
this._buildRetainers();
- if (this._dominatorOffset !== -1) // For tests where we may not have dominator field.
- this._buildDominatedNodes()
this._calculateFlags();
this._calculateObjectToWindowDistance();
var result = this._buildPostOrderIndex();
this._dominatorsTree = this._buildDominatorTree(result.postOrderIndex2NodeIndex, result.nodeOrdinal2PostOrderIndex);
+ this._buildDominatedNodes();
},
_buildRetainers: function()
@@ -1270,16 +1269,14 @@
// Count the number of dominated nodes for each node. Skip the root (node at
// index 0) as it is the only node that dominates itself.
- for (var nodeIndex = this._nodeFieldCount; nodeIndex < this._nodes.length; nodeIndex += this._nodeFieldCount) {
- var dominatorIndex = this._nodes[nodeIndex + this._dominatorOffset];
- if (dominatorIndex % this._nodeFieldCount)
- throw new Error("Wrong dominatorIndex " + dominatorIndex + " nodeIndex = " + nodeIndex + " nodeCount = " + this.nodeCount);
- ++indexArray[dominatorIndex / this._nodeFieldCount];
- }
+ var nodeFieldCount = this._nodeFieldCount;
+ var dominatorsTree = this._dominatorsTree;
+ for (var nodeOrdinal = 1, l = this.nodeCount; nodeOrdinal < l; ++nodeOrdinal)
+ ++indexArray[dominatorsTree[nodeOrdinal] / this._nodeFieldCount];
// Put in the first slot of each dominatedNodes slice the count of entries
// that will be filled.
var firstDominatedNodeIndex = 0;
- for (var i = 0; i < this.nodeCount; ++i) {
+ for (var i = 0, l = this.nodeCount; i < l; ++i) {
var dominatedCount = dominatedNodes[firstDominatedNodeIndex] = indexArray[i];
indexArray[i] = firstDominatedNodeIndex;
firstDominatedNodeIndex += dominatedCount;
@@ -1287,14 +1284,11 @@
indexArray[this.nodeCount] = dominatedNodes.length;
// Fill up the dominatedNodes array with indexes of dominated nodes. Skip the root (node at
// index 0) as it is the only node that dominates itself.
- for (var nodeIndex = this._nodeFieldCount; nodeIndex < this._nodes.length; nodeIndex += this._nodeFieldCount) {
- var dominatorIndex = this._nodes[nodeIndex + this._dominatorOffset];
- if (dominatorIndex % this._nodeFieldCount)
- throw new Error("Wrong dominatorIndex " + dominatorIndex);
- var dominatorPos = dominatorIndex / this._nodeFieldCount;
- var dominatedRefIndex = indexArray[dominatorPos];
+ for (var nodeOrdinal = 1, l = this.nodeCount; nodeOrdinal < l; ++nodeOrdinal) {
+ var dominatorOrdinal = dominatorsTree[nodeOrdinal] / nodeFieldCount;
+ var dominatedRefIndex = indexArray[dominatorOrdinal];
dominatedRefIndex += (--dominatedNodes[dominatedRefIndex]);
- dominatedNodes[dominatedRefIndex] = nodeIndex;
+ dominatedNodes[dominatedRefIndex] = nodeOrdinal * nodeFieldCount;
}
},