Title: [117973] trunk/Source/WebCore
Revision
117973
Author
[email protected]
Date
2012-05-22 07:48:38 -0700 (Tue, 22 May 2012)

Log Message

Web Inspector: HeapSnapshot: speedUp buildAggregates.
https://bugs.webkit.org/show_bug.cgi?id=87131

Engine can't inline getters and use fast-case if the function has for(i in object) loops.

Reviewed by Yury Semikhatsky.

No logic changes.

* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshotNode.prototype.classIndex):
(WebInspector.HeapSnapshot.prototype._buildAggregates):
(WebInspector.HeapSnapshot.prototype._calculateClassesRetainedSize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117972 => 117973)


--- trunk/Source/WebCore/ChangeLog	2012-05-22 14:44:56 UTC (rev 117972)
+++ trunk/Source/WebCore/ChangeLog	2012-05-22 14:48:38 UTC (rev 117973)
@@ -1,3 +1,19 @@
+2012-05-22  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: HeapSnapshot: speedUp buildAggregates.
+        https://bugs.webkit.org/show_bug.cgi?id=87131
+
+        Engine can't inline getters and use fast-case if the function has for(i in object) loops.
+
+        Reviewed by Yury Semikhatsky.
+
+        No logic changes.
+
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshotNode.prototype.classIndex):
+        (WebInspector.HeapSnapshot.prototype._buildAggregates):
+        (WebInspector.HeapSnapshot.prototype._calculateClassesRetainedSize):
+
 2012-05-22  Nikolas Zimmermann  <[email protected]>
 
         Crash in WebCore::RenderSVGContainer::paint

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


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-05-22 14:44:56 UTC (rev 117972)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-05-22 14:48:38 UTC (rev 117973)
@@ -444,13 +444,15 @@
         }
     },
 
-    get classIndex()
+    classIndex: function()
     {
-        var type = this._type();
+        var snapshot = this._snapshot;
+        var nodes = snapshot._nodes;
+        var type = nodes[this.nodeIndex + snapshot._nodeTypeOffset];;
         switch (type) {
-        case this._snapshot._nodeObjectType:
-        case this._snapshot._nodeNativeType:
-            return this._name();
+        case snapshot._nodeObjectType:
+        case snapshot._nodeNativeType:
+            return nodes[this.nodeIndex + snapshot._nodeNameOffset];
         default:
             return -1 - type;
         }
@@ -963,6 +965,7 @@
     {
         var aggregates = {};
         var aggregatesByClassName = {};
+        var classIndexes = [];
         var nodes = this._nodes;
         var nodesLength = nodes.length;
         var nodeNativeType = this._nodeNativeType;
@@ -980,7 +983,7 @@
                 continue;
             if (!selfSize && nodes[nodeIndex + nodeTypeOffset] !== nodeNativeType)
                 continue;
-            var classIndex = node.classIndex;
+            var classIndex = node.classIndex();
             if (!(classIndex in aggregates)) {
                 var nodeType = node.type;
                 var nameMatters = nodeType === "object" || nodeType === "native";
@@ -994,6 +997,7 @@
                     idxs: [nodeIndex]
                 };
                 aggregates[classIndex] = value;
+                classIndexes.push(classIndex);
                 aggregatesByClassName[node.className] = value;
             } else {
                 var clss = aggregates[classIndex];
@@ -1005,8 +1009,10 @@
         }
 
         // Shave off provisionally allocated space.
-        for (var classIndex in aggregates)
-            aggregates[classIndex].idxs = aggregates[classIndex].idxs.slice(0);
+        for (var i = 0, l = classIndexes.length; i < l; ++i) {
+            var classIndex = classIndexes[i];
+            aggregates[classIndex].idxs = aggregates[classIndex].idxs.slice();
+        }
         return {aggregatesByClassName: aggregatesByClassName, aggregatesByClassIndex: aggregates};
     },
 
@@ -1028,7 +1034,7 @@
         while (list.length) {
             var nodeIndex = list.pop();
             node.nodeIndex = nodeIndex;
-            var classIndex = node.classIndex;
+            var classIndex = node.classIndex();
             var seen = !!seenClassNameIndexes[classIndex];
             var nodeOrdinal = nodeIndex / nodeFieldCount;
             var dominatedIndexFrom = firstDominatedNodeIndex[nodeOrdinal];
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to