Changeset 117786 in webkit
- Timestamp:
- May 21, 2012, 9:02:07 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/profiler/heap-snapshot-expected.txt (modified) (1 diff)
-
LayoutTests/inspector/profiler/heap-snapshot.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/inspector/front-end/HeapSnapshot.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117780 r117786 1 2012-05-21 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: switch buildDominatedNodes function to front-end calculated _dominatorsTree 4 https://bugs.webkit.org/show_bug.cgi?id=87022 5 6 The new version is using _dominatorsTree array that was build at front-end. 7 8 Reviewed by Yury Semikhatsky. 9 10 * inspector/profiler/heap-snapshot-expected.txt: 11 * inspector/profiler/heap-snapshot.html: 12 1 13 2012-05-21 Ilya Tikhonovsky <loislo@chromium.org> 2 14 -
trunk/LayoutTests/inspector/profiler/heap-snapshot-expected.txt
r117780 r117786 18 18 Running: heapSnapshotDominatorsTreeTest 19 19 20 Running: heapSnapshotDominatedNodesTest 21 20 22 Running: heapSnapshotPageOwnedTest 21 23 -
trunk/LayoutTests/inspector/profiler/heap-snapshot.html
r117780 r117786 114 114 for (var i = 0; i < expected.length; ++i) 115 115 InspectorTest.assertEquals(expected[i], dominatorsTree[i], "Dominators Tree"); 116 next(); 117 }, 118 119 function heapSnapshotDominatedNodesTest(next) 120 { 121 var snapshot = new WebInspector.HeapSnapshot(InspectorTest.createHeapSnapshotMock()); 122 123 var expectedDominatedNodes = [21, 14, 7, 28, 35]; 124 var actualDominatedNodes = snapshot._dominatedNodes; 125 InspectorTest.assertEquals(expectedDominatedNodes.length, actualDominatedNodes.length, "Dominated Nodes length"); 126 for (var i = 0; i < expectedDominatedNodes.length; ++i) 127 InspectorTest.assertEquals(expectedDominatedNodes[i], actualDominatedNodes[i], "Dominated Nodes"); 128 129 var expectedDominatedNodeIndex = [0, 3, 3, 4, 5, 5, 5]; 130 var actualDominatedNodeIndex = snapshot._firstDominatedNodeIndex; 131 InspectorTest.assertEquals(expectedDominatedNodeIndex.length, actualDominatedNodeIndex.length, "Dominated Nodes Index length"); 132 for (var i = 0; i < expectedDominatedNodeIndex.length; ++i) 133 InspectorTest.assertEquals(expectedDominatedNodeIndex[i], actualDominatedNodeIndex[i], "Dominated Nodes Index"); 116 134 next(); 117 135 }, -
trunk/Source/WebCore/ChangeLog
r117784 r117786 1 2012-05-21 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: switch buildDominatedNodes function to front-end calculated _dominatorsTree 4 https://bugs.webkit.org/show_bug.cgi?id=87022 5 6 The new version is using _dominatorsTree array that was build at front-end. 7 8 Reviewed by Yury Semikhatsky. 9 10 * inspector/front-end/HeapSnapshot.js: 11 (WebInspector.HeapSnapshot.prototype._init): 12 (WebInspector.HeapSnapshot.prototype._buildDominatedNodes): 13 1 14 2012-05-21 Pavel Feldman <pfeldman@chromium.org> 2 15 -
trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js
r117749 r117786 720 720 this._markInvisibleEdges(); 721 721 this._buildRetainers(); 722 if (this._dominatorOffset !== -1) // For tests where we may not have dominator field.723 this._buildDominatedNodes()724 722 this._calculateFlags(); 725 723 this._calculateObjectToWindowDistance(); 726 724 var result = this._buildPostOrderIndex(); 727 725 this._dominatorsTree = this._buildDominatorTree(result.postOrderIndex2NodeIndex, result.nodeOrdinal2PostOrderIndex); 726 this._buildDominatedNodes(); 728 727 }, 729 728 … … 1271 1270 // Count the number of dominated nodes for each node. Skip the root (node at 1272 1271 // index 0) as it is the only node that dominates itself. 1273 for (var nodeIndex = this._nodeFieldCount; nodeIndex < this._nodes.length; nodeIndex += this._nodeFieldCount) { 1274 var dominatorIndex = this._nodes[nodeIndex + this._dominatorOffset]; 1275 if (dominatorIndex % this._nodeFieldCount) 1276 throw new Error("Wrong dominatorIndex " + dominatorIndex + " nodeIndex = " + nodeIndex + " nodeCount = " + this.nodeCount); 1277 ++indexArray[dominatorIndex / this._nodeFieldCount]; 1278 } 1272 var nodeFieldCount = this._nodeFieldCount; 1273 var dominatorsTree = this._dominatorsTree; 1274 for (var nodeOrdinal = 1, l = this.nodeCount; nodeOrdinal < l; ++nodeOrdinal) 1275 ++indexArray[dominatorsTree[nodeOrdinal] / this._nodeFieldCount]; 1279 1276 // Put in the first slot of each dominatedNodes slice the count of entries 1280 1277 // that will be filled. 1281 1278 var firstDominatedNodeIndex = 0; 1282 for (var i = 0 ; i < this.nodeCount; ++i) {1279 for (var i = 0, l = this.nodeCount; i < l; ++i) { 1283 1280 var dominatedCount = dominatedNodes[firstDominatedNodeIndex] = indexArray[i]; 1284 1281 indexArray[i] = firstDominatedNodeIndex; … … 1288 1285 // Fill up the dominatedNodes array with indexes of dominated nodes. Skip the root (node at 1289 1286 // index 0) as it is the only node that dominates itself. 1290 for (var nodeIndex = this._nodeFieldCount; nodeIndex < this._nodes.length; nodeIndex += this._nodeFieldCount) { 1291 var dominatorIndex = this._nodes[nodeIndex + this._dominatorOffset]; 1292 if (dominatorIndex % this._nodeFieldCount) 1293 throw new Error("Wrong dominatorIndex " + dominatorIndex); 1294 var dominatorPos = dominatorIndex / this._nodeFieldCount; 1295 var dominatedRefIndex = indexArray[dominatorPos]; 1287 for (var nodeOrdinal = 1, l = this.nodeCount; nodeOrdinal < l; ++nodeOrdinal) { 1288 var dominatorOrdinal = dominatorsTree[nodeOrdinal] / nodeFieldCount; 1289 var dominatedRefIndex = indexArray[dominatorOrdinal]; 1296 1290 dominatedRefIndex += (--dominatedNodes[dominatedRefIndex]); 1297 dominatedNodes[dominatedRefIndex] = node Index;1291 dominatedNodes[dominatedRefIndex] = nodeOrdinal * nodeFieldCount; 1298 1292 } 1299 1293 },
Note:
See TracChangeset
for help on using the changeset viewer.