OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 }, | 1076 }, |
1077 | 1077 |
1078 _getDominatedIndex: function(nodeIndex) | 1078 _getDominatedIndex: function(nodeIndex) |
1079 { | 1079 { |
1080 if (nodeIndex % this._nodeFieldCount) | 1080 if (nodeIndex % this._nodeFieldCount) |
1081 throw new Error("Invalid nodeIndex: " + nodeIndex); | 1081 throw new Error("Invalid nodeIndex: " + nodeIndex); |
1082 return this._firstDominatedNodeIndex[nodeIndex / this._nodeFieldCount]; | 1082 return this._firstDominatedNodeIndex[nodeIndex / this._nodeFieldCount]; |
1083 }, | 1083 }, |
1084 | 1084 |
1085 /** | 1085 /** |
1086 * @param {!WebInspector.HeapSnapshotNode} node | |
1087 * @return {!Uint32Array} | |
1088 */ | |
1089 _dominatedNodesOfNode: function(node) | |
1090 { | |
1091 var dominatedIndexFrom = this._getDominatedIndex(node.nodeIndex); | |
1092 var dominatedIndexTo = this._getDominatedIndex(node._nextNodeIndex()); | |
1093 return this._dominatedNodes.subarray(dominatedIndexFrom, dominatedIndexT
o); | |
1094 }, | |
1095 | |
1096 /** | |
1097 * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} nodeFilter | 1086 * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} nodeFilter |
1098 * @return {!Object.<string, !WebInspector.HeapSnapshotCommon.Aggregate>} | 1087 * @return {!Object.<string, !WebInspector.HeapSnapshotCommon.Aggregate>} |
1099 */ | 1088 */ |
1100 aggregatesWithFilter: function(nodeFilter) | 1089 aggregatesWithFilter: function(nodeFilter) |
1101 { | 1090 { |
1102 var minNodeId = nodeFilter.minNodeId; | 1091 var minNodeId = nodeFilter.minNodeId; |
1103 var maxNodeId = nodeFilter.maxNodeId; | 1092 var maxNodeId = nodeFilter.maxNodeId; |
1104 var allocationNodeId = nodeFilter.allocationNodeId; | 1093 var allocationNodeId = nodeFilter.allocationNodeId; |
1105 var key; | 1094 var key; |
1106 var filter; | 1095 var filter; |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 { | 1851 { |
1863 var ids = []; | 1852 var ids = []; |
1864 for (var it = this._allNodes(); it.hasNext(); it.next()) { | 1853 for (var it = this._allNodes(); it.hasNext(); it.next()) { |
1865 if (it.item().name() === name) | 1854 if (it.item().name() === name) |
1866 ids.push(it.item().id()); | 1855 ids.push(it.item().id()); |
1867 } | 1856 } |
1868 return ids; | 1857 return ids; |
1869 }, | 1858 }, |
1870 | 1859 |
1871 /** | 1860 /** |
1872 * @param {string} snapshotObjectId | |
1873 * @return {?Array.<string>} | |
1874 */ | |
1875 dominatorIdsForNode: function(snapshotObjectId) | |
1876 { | |
1877 var node = this._nodeForSnapshotObjectId(snapshotObjectId); | |
1878 if (!node) | |
1879 return null; | |
1880 var result = []; | |
1881 while (!node.isRoot()) { | |
1882 result.push(node.id()); | |
1883 node.nodeIndex = node.dominatorIndex(); | |
1884 } | |
1885 return result; | |
1886 }, | |
1887 | |
1888 /** | |
1889 * @param {number} nodeIndex | 1861 * @param {number} nodeIndex |
1890 * @return {!WebInspector.HeapSnapshotEdgesProvider} | 1862 * @return {!WebInspector.HeapSnapshotEdgesProvider} |
1891 */ | 1863 */ |
1892 createEdgesProvider: function(nodeIndex) | 1864 createEdgesProvider: function(nodeIndex) |
1893 { | 1865 { |
1894 var node = this.createNode(nodeIndex); | 1866 var node = this.createNode(nodeIndex); |
1895 var filter = this.containmentEdgesFilter(); | 1867 var filter = this.containmentEdgesFilter(); |
1896 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; | 1868 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; |
1897 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); | 1869 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); |
1898 }, | 1870 }, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 * @param {string} className | 1942 * @param {string} className |
1971 * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} nodeFilter | 1943 * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} nodeFilter |
1972 * @return {!WebInspector.HeapSnapshotNodesProvider} | 1944 * @return {!WebInspector.HeapSnapshotNodesProvider} |
1973 */ | 1945 */ |
1974 createNodesProviderForClass: function(className, nodeFilter) | 1946 createNodesProviderForClass: function(className, nodeFilter) |
1975 { | 1947 { |
1976 return new WebInspector.HeapSnapshotNodesProvider(this, this.classNodesF
ilter(), this.aggregatesWithFilter(nodeFilter)[className].idxs); | 1948 return new WebInspector.HeapSnapshotNodesProvider(this, this.classNodesF
ilter(), this.aggregatesWithFilter(nodeFilter)[className].idxs); |
1977 }, | 1949 }, |
1978 | 1950 |
1979 /** | 1951 /** |
1980 * @param {number} nodeIndex | |
1981 * @return {!WebInspector.HeapSnapshotNodesProvider} | |
1982 */ | |
1983 createNodesProviderForDominator: function(nodeIndex) | |
1984 { | |
1985 var node = this.createNode(nodeIndex); | |
1986 return new WebInspector.HeapSnapshotNodesProvider(this, null, this._domi
natedNodesOfNode(node)); | |
1987 }, | |
1988 | |
1989 /** | |
1990 * @return {number} | 1952 * @return {number} |
1991 */ | 1953 */ |
1992 _maxJsNodeId: function() | 1954 _maxJsNodeId: function() |
1993 { | 1955 { |
1994 var nodeFieldCount = this._nodeFieldCount; | 1956 var nodeFieldCount = this._nodeFieldCount; |
1995 var nodes = this._nodes; | 1957 var nodes = this._nodes; |
1996 var nodesLength = nodes.length; | 1958 var nodesLength = nodes.length; |
1997 var id = 0; | 1959 var id = 0; |
1998 for (var nodeIndex = this._nodeIdOffset; nodeIndex < nodesLength; nodeIn
dex += nodeFieldCount) { | 1960 for (var nodeIndex = this._nodeIdOffset; nodeIndex < nodesLength; nodeIn
dex += nodeFieldCount) { |
1999 var nextId = nodes[nodeIndex]; | 1961 var nextId = nodes[nodeIndex]; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2284 * @param {number} windowRight | 2246 * @param {number} windowRight |
2285 */ | 2247 */ |
2286 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) | 2248 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) |
2287 { | 2249 { |
2288 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); | 2250 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); |
2289 }, | 2251 }, |
2290 | 2252 |
2291 __proto__: WebInspector.HeapSnapshotItemProvider.prototype | 2253 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
2292 } | 2254 } |
2293 | 2255 |
OLD | NEW |