+2012-05-17 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Web Inspector: speed-up markQueriableHeapObjects function.
+ https://bugs.webkit.org/show_bug.cgi?id=86732
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/front-end/HeapSnapshot.js:
+ (WebInspector.HeapSnapshot.prototype._flagsOfNode):
+ (WebInspector.HeapSnapshot.prototype._markDetachedDOMTreeNodes):
+ (WebInspector.HeapSnapshot.prototype._markQueriableHeapObjects):
+ (WebInspector.HeapSnapshot.prototype._calculateFlags):
+
2012-05-15 Kinuko Yasuda <kinuko@chromium.org>
Some Spelling Mistakes Result in Compile Errors with ENABLE(FILE_SYSTEM) in LocalFileSystem.cpp
_flagsOfNode: function(node)
{
- return this._flags[node.nodeIndex];
+ return this._flags[node.nodeIndex / this._nodeFieldCount];
},
/**
var node = iter.edge.node;
if (node.isDetachedDOMTree) {
for (var edgesIter = node.edges; edgesIter.hasNext(); edgesIter.next())
- this._flags[edgesIter.edge.node.nodeIndex] |= flag;
+ this._flags[edgesIter.edge.node.nodeIndex / this._nodeFieldCount] |= flag;
}
}
},
var edgeToNodeOffset = this._edgeToNodeOffset;
var edgeTypeOffset = this._edgeTypeOffset;
var edgeFieldsCount = this._edgeFieldsCount;
+ var containmentEdges = this._containmentEdges;
+ var nodes = this._nodes;
+ var nodeCount = this.nodeCount;
+ var nodeFieldCount = this._nodeFieldCount;
+ var firstEdgeIndexOffset = this._firstEdgeIndexOffset;
var flags = this._flags;
var list = [];
list.push(iter.edge.node.nodeIndex);
}
- var node = new WebInspector.HeapSnapshotNode(this);
while (list.length) {
var nodeIndex = list.pop();
- if (flags[nodeIndex] & flag)
+ var nodeOrdinal = nodeIndex / nodeFieldCount;
+ if (flags[nodeOrdinal] & flag)
continue;
- node.nodeIndex = nodeIndex;
- flags[nodeIndex] |= flag;
- var edgesCount = node.edgesCount;
- var edges = node.rawEdges;
- for (var j = 0; j < edgesCount; ++j) {
- var edgeIndex = j * edgeFieldsCount;
- nodeIndex = edges.item(edgeIndex + edgeToNodeOffset);
- if (flags[nodeIndex] & flag)
+ flags[nodeOrdinal] |= flag;
+ var beginEdgeIndex = nodes[nodeIndex + firstEdgeIndexOffset];
+ var endEdgeIndex = nodeOrdinal < nodeCount - 1
+ ? nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount]
+ : containmentEdges.length;
+ for (var edgeIndex = beginEdgeIndex; edgeIndex < endEdgeIndex; edgeIndex += edgeFieldsCount) {
+ var childNodeIndex = containmentEdges[edgeIndex + edgeToNodeOffset];
+ if (flags[childNodeIndex / nodeFieldCount] & flag)
continue;
- var type = edges.item(edgeIndex + edgeTypeOffset);
+ var type = containmentEdges[edgeIndex + edgeTypeOffset];
if (type === hiddenEdgeType || type === invisibleEdgeType || type === internalEdgeType)
continue;
- list.push(nodeIndex);
+ list.push(childNodeIndex);
}
}
},
_calculateFlags: function()
{
- this._flags = new Array(this.nodeCount);
+ this._flags = new Uint32Array(this.nodeCount);
this._markDetachedDOMTreeNodes();
this._markQueriableHeapObjects();
},