Title: [140535] trunk/Source/WebCore
- Revision
- 140535
- Author
- [email protected]
- Date
- 2013-01-23 07:01:51 -0800 (Wed, 23 Jan 2013)
Log Message
Web Inspector: heap profiler shows nodes with distance 0
https://bugs.webkit.org/show_bug.cgi?id=107425
Reviewed by Pavel Feldman.
"Document DOM tree" entities now have distance 1. So if there is a DOM
wrapper that is not referenced from _javascript_ it will anyways be shown
in the heap snapshot and will have distance 2. Also such DOM wrappers
are considered to be reachable from user roots (e.g. global Window objects)
otherwice they are not event shown in the heap snapshots.
* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshot.prototype.distanceForUserRoot):
(WebInspector.HeapSnapshot.prototype._calculateDistances):
* inspector/front-end/JSHeapSnapshot.js:
(WebInspector.JSHeapSnapshot.prototype.distanceForUserRoot): distance for
"(Document DOM trees)" is set to 0 to make sure distance of "Ddocument DOM tree" is 1.
(WebInspector.JSHeapSnapshot.prototype._markPageOwnedNodes):
(WebInspector.JSHeapSnapshotNode.prototype.isDocumentDOMTreesRoot):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (140534 => 140535)
--- trunk/Source/WebCore/ChangeLog 2013-01-23 14:58:44 UTC (rev 140534)
+++ trunk/Source/WebCore/ChangeLog 2013-01-23 15:01:51 UTC (rev 140535)
@@ -1,3 +1,25 @@
+2013-01-23 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: heap profiler shows nodes with distance 0
+ https://bugs.webkit.org/show_bug.cgi?id=107425
+
+ Reviewed by Pavel Feldman.
+
+ "Document DOM tree" entities now have distance 1. So if there is a DOM
+ wrapper that is not referenced from _javascript_ it will anyways be shown
+ in the heap snapshot and will have distance 2. Also such DOM wrappers
+ are considered to be reachable from user roots (e.g. global Window objects)
+ otherwice they are not event shown in the heap snapshots.
+
+ * inspector/front-end/HeapSnapshot.js:
+ (WebInspector.HeapSnapshot.prototype.distanceForUserRoot):
+ (WebInspector.HeapSnapshot.prototype._calculateDistances):
+ * inspector/front-end/JSHeapSnapshot.js:
+ (WebInspector.JSHeapSnapshot.prototype.distanceForUserRoot): distance for
+ "(Document DOM trees)" is set to 0 to make sure distance of "Ddocument DOM tree" is 1.
+ (WebInspector.JSHeapSnapshot.prototype._markPageOwnedNodes):
+ (WebInspector.JSHeapSnapshotNode.prototype.isDocumentDOMTreesRoot):
+
2013-01-23 Adrian Perez de Castro <[email protected]>
[GStreamer] Add Opus MIME type to the list of supported ones
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (140534 => 140535)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2013-01-23 14:58:44 UTC (rev 140534)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2013-01-23 15:01:51 UTC (rev 140535)
@@ -778,9 +778,9 @@
return this._aggregatesForDiff;
},
- canHaveDistanceOne: function(node)
+ distanceForUserRoot: function(node)
{
- return true;
+ return 1;
},
_calculateDistances: function()
@@ -793,9 +793,10 @@
var nodesToVisitLength = 0;
for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) {
var node = iter.edge.node();
- if (this.canHaveDistanceOne(node)) {
+ var distance = this.distanceForUserRoot(node);
+ if (distance !== -1) {
nodesToVisit[nodesToVisitLength++] = node.nodeIndex;
- distances[node.nodeIndex / nodeFieldCount] = 1;
+ distances[node.nodeIndex / nodeFieldCount] = distance;
}
}
this._bfs(nodesToVisit, nodesToVisitLength, distances);
Modified: trunk/Source/WebCore/inspector/front-end/JSHeapSnapshot.js (140534 => 140535)
--- trunk/Source/WebCore/inspector/front-end/JSHeapSnapshot.js 2013-01-23 14:58:44 UTC (rev 140534)
+++ trunk/Source/WebCore/inspector/front-end/JSHeapSnapshot.js 2013-01-23 15:01:51 UTC (rev 140535)
@@ -102,9 +102,13 @@
this._markPageOwnedNodes();
},
- canHaveDistanceOne: function(node)
+ distanceForUserRoot: function(node)
{
- return node.isWindow();
+ if (node.isWindow())
+ return 1;
+ if (node.isDocumentDOMTreesRoot())
+ return 0;
+ return -1;
},
userObjectsMapAndFlag: function()
@@ -194,6 +198,7 @@
_markPageOwnedNodes: function()
{
var edgeShortcutType = this._edgeShortcutType;
+ var edgeElementType = this._edgeElementType;
var edgeToNodeOffset = this._edgeToNodeOffset;
var edgeTypeOffset = this._edgeTypeOffset;
var edgeFieldsCount = this._edgeFieldsCount;
@@ -215,14 +220,21 @@
var nodesToVisitLength = 0;
var rootNodeOrdinal = this._rootNodeIndex / nodeFieldCount;
+ var node = this.rootNode();
for (var edgeIndex = firstEdgeIndexes[rootNodeOrdinal], endEdgeIndex = firstEdgeIndexes[rootNodeOrdinal + 1];
edgeIndex < endEdgeIndex;
edgeIndex += edgeFieldsCount) {
- if (containmentEdges[edgeIndex + edgeTypeOffset] === edgeShortcutType) {
- var nodeOrdinal = containmentEdges[edgeIndex + edgeToNodeOffset] / nodeFieldCount;
- nodesToVisit[nodesToVisitLength++] = nodeOrdinal;
- flags[nodeOrdinal] |= visitedMarker;
- }
+ var edgeType = containmentEdges[edgeIndex + edgeTypeOffset];
+ var nodeIndex = containmentEdges[edgeIndex + edgeToNodeOffset];
+ if (edgeType === edgeElementType) {
+ node.nodeIndex = nodeIndex;
+ if (!node.isDocumentDOMTreesRoot())
+ continue;
+ } else if (edgeType !== edgeShortcutType)
+ continue;
+ var nodeOrdinal = nodeIndex / nodeFieldCount;
+ nodesToVisit[nodesToVisitLength++] = nodeOrdinal;
+ flags[nodeOrdinal] |= visitedMarker;
}
while (nodesToVisitLength) {
@@ -325,6 +337,11 @@
return this.name() === "(Detached DOM trees)";
},
+ isDocumentDOMTreesRoot: function()
+ {
+ return this.isSynthetic() && this.name() === "(Document DOM trees)";
+ },
+
isDetachedDOMTree: function()
{
const detachedDOMTreeRE = /^Detached DOM tree/;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes