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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 var retainingNodes = this._retainingNodes = new Uint32Array(this._edgeCo
unt); | 665 var retainingNodes = this._retainingNodes = new Uint32Array(this._edgeCo
unt); |
666 var retainingEdges = this._retainingEdges = new Uint32Array(this._edgeCo
unt); | 666 var retainingEdges = this._retainingEdges = new Uint32Array(this._edgeCo
unt); |
667 // Index of the first retainer in the _retainingNodes and _retainingEdge
s | 667 // Index of the first retainer in the _retainingNodes and _retainingEdge
s |
668 // arrays. Addressed by retained node index. | 668 // arrays. Addressed by retained node index. |
669 var firstRetainerIndex = this._firstRetainerIndex = new Uint32Array(this
.nodeCount + 1); | 669 var firstRetainerIndex = this._firstRetainerIndex = new Uint32Array(this
.nodeCount + 1); |
670 | 670 |
671 var containmentEdges = this._containmentEdges; | 671 var containmentEdges = this._containmentEdges; |
672 var edgeFieldsCount = this._edgeFieldsCount; | 672 var edgeFieldsCount = this._edgeFieldsCount; |
673 var nodeFieldCount = this._nodeFieldCount; | 673 var nodeFieldCount = this._nodeFieldCount; |
674 var edgeToNodeOffset = this._edgeToNodeOffset; | 674 var edgeToNodeOffset = this._edgeToNodeOffset; |
675 var nodes = this._nodes; | |
676 var firstEdgeIndexes = this._firstEdgeIndexes; | 675 var firstEdgeIndexes = this._firstEdgeIndexes; |
677 var nodeCount = this.nodeCount; | 676 var nodeCount = this.nodeCount; |
678 | 677 |
679 for (var toNodeFieldIndex = edgeToNodeOffset, l = containmentEdges.lengt
h; toNodeFieldIndex < l; toNodeFieldIndex += edgeFieldsCount) { | 678 for (var toNodeFieldIndex = edgeToNodeOffset, l = containmentEdges.lengt
h; toNodeFieldIndex < l; toNodeFieldIndex += edgeFieldsCount) { |
680 var toNodeIndex = containmentEdges[toNodeFieldIndex]; | 679 var toNodeIndex = containmentEdges[toNodeFieldIndex]; |
681 if (toNodeIndex % nodeFieldCount) | 680 if (toNodeIndex % nodeFieldCount) |
682 throw new Error("Invalid toNodeIndex " + toNodeIndex); | 681 throw new Error("Invalid toNodeIndex " + toNodeIndex); |
683 ++firstRetainerIndex[toNodeIndex / nodeFieldCount]; | 682 ++firstRetainerIndex[toNodeIndex / nodeFieldCount]; |
684 } | 683 } |
685 for (var i = 0, firstUnusedRetainerSlot = 0; i < nodeCount; i++) { | 684 for (var i = 0, firstUnusedRetainerSlot = 0; i < nodeCount; i++) { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 */ | 916 */ |
918 _bfs: function(nodesToVisit, nodesToVisitLength, distances) | 917 _bfs: function(nodesToVisit, nodesToVisitLength, distances) |
919 { | 918 { |
920 // Preload fields into local variables for better performance. | 919 // Preload fields into local variables for better performance. |
921 var edgeFieldsCount = this._edgeFieldsCount; | 920 var edgeFieldsCount = this._edgeFieldsCount; |
922 var nodeFieldCount = this._nodeFieldCount; | 921 var nodeFieldCount = this._nodeFieldCount; |
923 var containmentEdges = this._containmentEdges; | 922 var containmentEdges = this._containmentEdges; |
924 var firstEdgeIndexes = this._firstEdgeIndexes; | 923 var firstEdgeIndexes = this._firstEdgeIndexes; |
925 var edgeToNodeOffset = this._edgeToNodeOffset; | 924 var edgeToNodeOffset = this._edgeToNodeOffset; |
926 var edgeTypeOffset = this._edgeTypeOffset; | 925 var edgeTypeOffset = this._edgeTypeOffset; |
927 var nodes = this._nodes; | |
928 var nodeCount = this.nodeCount; | 926 var nodeCount = this.nodeCount; |
929 var containmentEdgesLength = containmentEdges.length; | 927 var containmentEdgesLength = containmentEdges.length; |
930 var edgeWeakType = this._edgeWeakType; | 928 var edgeWeakType = this._edgeWeakType; |
931 var noDistance = this._noDistance; | 929 var noDistance = this._noDistance; |
932 | 930 |
933 var index = 0; | 931 var index = 0; |
934 while (index < nodesToVisitLength) { | 932 while (index < nodesToVisitLength) { |
935 var nodeIndex = nodesToVisit[index++]; // shift generates too much g
arbage. | 933 var nodeIndex = nodesToVisit[index++]; // shift generates too much g
arbage. |
936 var nodeOrdinal = nodeIndex / nodeFieldCount; | 934 var nodeOrdinal = nodeIndex / nodeFieldCount; |
937 var distance = distances[nodeOrdinal] + 1; | 935 var distance = distances[nodeOrdinal] + 1; |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 return indexA - indexB; | 1848 return indexA - indexB; |
1851 return result; | 1849 return result; |
1852 } | 1850 } |
1853 | 1851 |
1854 this._iterationOrder.sortRange(sortByComparator, leftBound, rightBound,
windowLeft, windowRight); | 1852 this._iterationOrder.sortRange(sortByComparator, leftBound, rightBound,
windowLeft, windowRight); |
1855 }, | 1853 }, |
1856 | 1854 |
1857 __proto__: WebInspector.HeapSnapshotFilteredOrderedIterator.prototype | 1855 __proto__: WebInspector.HeapSnapshotFilteredOrderedIterator.prototype |
1858 } | 1856 } |
1859 | 1857 |
OLD | NEW |