| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * @constructor | 49 * @constructor |
| 50 * @implements {WebInspector.HeapSnapshotItem} | 50 * @implements {WebInspector.HeapSnapshotItem} |
| 51 * @param {!WebInspector.HeapSnapshot} snapshot | 51 * @param {!WebInspector.HeapSnapshot} snapshot |
| 52 * @param {number=} edgeIndex | 52 * @param {number=} edgeIndex |
| 53 */ | 53 */ |
| 54 WebInspector.HeapSnapshotEdge = function(snapshot, edgeIndex) | 54 WebInspector.HeapSnapshotEdge = function(snapshot, edgeIndex) |
| 55 { | 55 { |
| 56 this._snapshot = snapshot; | 56 this._snapshot = snapshot; |
| 57 this._edges = snapshot._containmentEdges; | 57 this._edges = snapshot.containmentEdges; |
| 58 this.edgeIndex = edgeIndex || 0; | 58 this.edgeIndex = edgeIndex || 0; |
| 59 } | 59 } |
| 60 | 60 |
| 61 WebInspector.HeapSnapshotEdge.prototype = { | 61 WebInspector.HeapSnapshotEdge.prototype = { |
| 62 /** | 62 /** |
| 63 * @return {!WebInspector.HeapSnapshotEdge} | 63 * @return {!WebInspector.HeapSnapshotEdge} |
| 64 */ | 64 */ |
| 65 clone: function() | 65 clone: function() |
| 66 { | 66 { |
| 67 return new WebInspector.HeapSnapshotEdge(this._snapshot, this.edgeIndex)
; | 67 return new WebInspector.HeapSnapshotEdge(this._snapshot, this.edgeIndex)
; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 | 244 |
| 245 /** | 245 /** |
| 246 * @constructor | 246 * @constructor |
| 247 * @implements {WebInspector.HeapSnapshotItemIterator} | 247 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 248 * @param {!WebInspector.HeapSnapshotNode} node | 248 * @param {!WebInspector.HeapSnapshotNode} node |
| 249 */ | 249 */ |
| 250 WebInspector.HeapSnapshotEdgeIterator = function(node) | 250 WebInspector.HeapSnapshotEdgeIterator = function(node) |
| 251 { | 251 { |
| 252 this._sourceNode = node; | 252 this._sourceNode = node; |
| 253 this.edge = node._snapshot.createEdge(node._edgeIndexesStart()); | 253 this.edge = node._snapshot.createEdge(node.edgeIndexesStart()); |
| 254 } | 254 } |
| 255 | 255 |
| 256 WebInspector.HeapSnapshotEdgeIterator.prototype = { | 256 WebInspector.HeapSnapshotEdgeIterator.prototype = { |
| 257 /** | 257 /** |
| 258 * @return {boolean} | 258 * @return {boolean} |
| 259 */ | 259 */ |
| 260 hasNext: function() | 260 hasNext: function() |
| 261 { | 261 { |
| 262 return this.edge.edgeIndex < this._sourceNode._edgeIndexesEnd(); | 262 return this.edge.edgeIndex < this._sourceNode.edgeIndexesEnd(); |
| 263 }, | 263 }, |
| 264 | 264 |
| 265 /** | 265 /** |
| 266 * @return {!WebInspector.HeapSnapshotEdge} | 266 * @return {!WebInspector.HeapSnapshotEdge} |
| 267 */ | 267 */ |
| 268 item: function() | 268 item: function() |
| 269 { | 269 { |
| 270 return this.edge; | 270 return this.edge; |
| 271 }, | 271 }, |
| 272 | 272 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 409 } |
| 410 | 410 |
| 411 /** | 411 /** |
| 412 * @constructor | 412 * @constructor |
| 413 * @implements {WebInspector.HeapSnapshotItemIterator} | 413 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 414 * @param {!WebInspector.HeapSnapshotNode} retainedNode | 414 * @param {!WebInspector.HeapSnapshotNode} retainedNode |
| 415 */ | 415 */ |
| 416 WebInspector.HeapSnapshotRetainerEdgeIterator = function(retainedNode) | 416 WebInspector.HeapSnapshotRetainerEdgeIterator = function(retainedNode) |
| 417 { | 417 { |
| 418 var snapshot = retainedNode._snapshot; | 418 var snapshot = retainedNode._snapshot; |
| 419 var retainedNodeOrdinal = retainedNode._ordinal(); | 419 var retainedNodeOrdinal = retainedNode.ordinal(); |
| 420 var retainerIndex = snapshot._firstRetainerIndex[retainedNodeOrdinal]; | 420 var retainerIndex = snapshot._firstRetainerIndex[retainedNodeOrdinal]; |
| 421 this._retainersEnd = snapshot._firstRetainerIndex[retainedNodeOrdinal + 1]; | 421 this._retainersEnd = snapshot._firstRetainerIndex[retainedNodeOrdinal + 1]; |
| 422 this.retainer = snapshot.createRetainingEdge(retainerIndex); | 422 this.retainer = snapshot.createRetainingEdge(retainerIndex); |
| 423 } | 423 } |
| 424 | 424 |
| 425 WebInspector.HeapSnapshotRetainerEdgeIterator.prototype = { | 425 WebInspector.HeapSnapshotRetainerEdgeIterator.prototype = { |
| 426 /** | 426 /** |
| 427 * @return {boolean} | 427 * @return {boolean} |
| 428 */ | 428 */ |
| 429 hasNext: function() | 429 hasNext: function() |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 edges: function() | 497 edges: function() |
| 498 { | 498 { |
| 499 return new WebInspector.HeapSnapshotEdgeIterator(this); | 499 return new WebInspector.HeapSnapshotEdgeIterator(this); |
| 500 }, | 500 }, |
| 501 | 501 |
| 502 /** | 502 /** |
| 503 * @return {number} | 503 * @return {number} |
| 504 */ | 504 */ |
| 505 edgesCount: function() | 505 edgesCount: function() |
| 506 { | 506 { |
| 507 return (this._edgeIndexesEnd() - this._edgeIndexesStart()) / this._snaps
hot._edgeFieldsCount; | 507 return (this.edgeIndexesEnd() - this.edgeIndexesStart()) / this._snapsho
t._edgeFieldsCount; |
| 508 }, | 508 }, |
| 509 | 509 |
| 510 /** | 510 /** |
| 511 * @return {number} | 511 * @return {number} |
| 512 */ | 512 */ |
| 513 id: function() | 513 id: function() |
| 514 { | 514 { |
| 515 throw new Error("Not implemented"); | 515 throw new Error("Not implemented"); |
| 516 }, | 516 }, |
| 517 | 517 |
| 518 /** | 518 /** |
| 519 * @return {boolean} | 519 * @return {boolean} |
| 520 */ | 520 */ |
| 521 isRoot: function() | 521 isRoot: function() |
| 522 { | 522 { |
| 523 return this.nodeIndex === this._snapshot._rootNodeIndex; | 523 return this.nodeIndex === this._snapshot._rootNodeIndex; |
| 524 }, | 524 }, |
| 525 | 525 |
| 526 /** | 526 /** |
| 527 * @return {string} | 527 * @return {string} |
| 528 */ | 528 */ |
| 529 name: function() | 529 name: function() |
| 530 { | 530 { |
| 531 return this._snapshot._strings[this._name()]; | 531 return this._snapshot.strings[this._name()]; |
| 532 }, | 532 }, |
| 533 | 533 |
| 534 /** | 534 /** |
| 535 * @return {number} | 535 * @return {number} |
| 536 */ | 536 */ |
| 537 retainedSize: function() | 537 retainedSize: function() |
| 538 { | 538 { |
| 539 return this._snapshot._retainedSizes[this._ordinal()]; | 539 return this._snapshot._retainedSizes[this.ordinal()]; |
| 540 }, | 540 }, |
| 541 | 541 |
| 542 /** | 542 /** |
| 543 * @return {!WebInspector.HeapSnapshotRetainerEdgeIterator} | 543 * @return {!WebInspector.HeapSnapshotRetainerEdgeIterator} |
| 544 */ | 544 */ |
| 545 retainers: function() | 545 retainers: function() |
| 546 { | 546 { |
| 547 return new WebInspector.HeapSnapshotRetainerEdgeIterator(this); | 547 return new WebInspector.HeapSnapshotRetainerEdgeIterator(this); |
| 548 }, | 548 }, |
| 549 | 549 |
| 550 /** | 550 /** |
| 551 * @return {number} | 551 * @return {number} |
| 552 */ | 552 */ |
| 553 retainersCount: function() | 553 retainersCount: function() |
| 554 { | 554 { |
| 555 var snapshot = this._snapshot; | 555 var snapshot = this._snapshot; |
| 556 var ordinal = this._ordinal(); | 556 var ordinal = this.ordinal(); |
| 557 return snapshot._firstRetainerIndex[ordinal + 1] - snapshot._firstRetain
erIndex[ordinal]; | 557 return snapshot._firstRetainerIndex[ordinal + 1] - snapshot._firstRetain
erIndex[ordinal]; |
| 558 }, | 558 }, |
| 559 | 559 |
| 560 /** | 560 /** |
| 561 * @return {number} | 561 * @return {number} |
| 562 */ | 562 */ |
| 563 selfSize: function() | 563 selfSize: function() |
| 564 { | 564 { |
| 565 var snapshot = this._snapshot; | 565 var snapshot = this._snapshot; |
| 566 return snapshot._nodes[this.nodeIndex + snapshot._nodeSelfSizeOffset]; | 566 return snapshot.nodes[this.nodeIndex + snapshot._nodeSelfSizeOffset]; |
| 567 }, | 567 }, |
| 568 | 568 |
| 569 /** | 569 /** |
| 570 * @return {string} | 570 * @return {string} |
| 571 */ | 571 */ |
| 572 type: function() | 572 type: function() |
| 573 { | 573 { |
| 574 return this._snapshot._nodeTypes[this._type()]; | 574 return this._snapshot._nodeTypes[this._type()]; |
| 575 }, | 575 }, |
| 576 | 576 |
| 577 /** | 577 /** |
| 578 * @return {number} | 578 * @return {number} |
| 579 */ | 579 */ |
| 580 traceNodeId: function() | 580 traceNodeId: function() |
| 581 { | 581 { |
| 582 var snapshot = this._snapshot; | 582 var snapshot = this._snapshot; |
| 583 return snapshot._nodes[this.nodeIndex + snapshot._nodeTraceNodeIdOffset]
; | 583 return snapshot.nodes[this.nodeIndex + snapshot._nodeTraceNodeIdOffset]; |
| 584 }, | 584 }, |
| 585 | 585 |
| 586 /** | 586 /** |
| 587 * @override | 587 * @override |
| 588 * @return {number} | 588 * @return {number} |
| 589 */ | 589 */ |
| 590 itemIndex: function() | 590 itemIndex: function() |
| 591 { | 591 { |
| 592 return this.nodeIndex; | 592 return this.nodeIndex; |
| 593 }, | 593 }, |
| 594 | 594 |
| 595 /** | 595 /** |
| 596 * @override | 596 * @override |
| 597 * @return {!WebInspector.HeapSnapshotCommon.Node} | 597 * @return {!WebInspector.HeapSnapshotCommon.Node} |
| 598 */ | 598 */ |
| 599 serialize: function() | 599 serialize: function() |
| 600 { | 600 { |
| 601 return new WebInspector.HeapSnapshotCommon.Node(this.id(), this.name(),
this.distance(), this.nodeIndex, this.retainedSize(), this.selfSize(), this.type
()); | 601 return new WebInspector.HeapSnapshotCommon.Node(this.id(), this.name(),
this.distance(), this.nodeIndex, this.retainedSize(), this.selfSize(), this.type
()); |
| 602 }, | 602 }, |
| 603 | 603 |
| 604 /** | 604 /** |
| 605 * @return {number} | 605 * @return {number} |
| 606 */ | 606 */ |
| 607 _name: function() | 607 _name: function() |
| 608 { | 608 { |
| 609 var snapshot = this._snapshot; | 609 var snapshot = this._snapshot; |
| 610 return snapshot._nodes[this.nodeIndex + snapshot._nodeNameOffset]; | 610 return snapshot.nodes[this.nodeIndex + snapshot._nodeNameOffset]; |
| 611 }, | 611 }, |
| 612 | 612 |
| 613 /** | 613 /** |
| 614 * @return {number} | 614 * @return {number} |
| 615 */ | 615 */ |
| 616 _edgeIndexesStart: function() | 616 edgeIndexesStart: function() |
| 617 { | 617 { |
| 618 return this._snapshot._firstEdgeIndexes[this._ordinal()]; | 618 return this._snapshot._firstEdgeIndexes[this.ordinal()]; |
| 619 }, | 619 }, |
| 620 | 620 |
| 621 /** | 621 /** |
| 622 * @return {number} | 622 * @return {number} |
| 623 */ | 623 */ |
| 624 _edgeIndexesEnd: function() | 624 edgeIndexesEnd: function() |
| 625 { | 625 { |
| 626 return this._snapshot._firstEdgeIndexes[this._ordinal() + 1]; | 626 return this._snapshot._firstEdgeIndexes[this.ordinal() + 1]; |
| 627 }, | 627 }, |
| 628 | 628 |
| 629 /** | 629 /** |
| 630 * @return {number} | 630 * @return {number} |
| 631 */ | 631 */ |
| 632 _ordinal: function() | 632 ordinal: function() |
| 633 { | 633 { |
| 634 return this.nodeIndex / this._snapshot._nodeFieldCount; | 634 return this.nodeIndex / this._snapshot._nodeFieldCount; |
| 635 }, | 635 }, |
| 636 | 636 |
| 637 /** | 637 /** |
| 638 * @return {number} | 638 * @return {number} |
| 639 */ | 639 */ |
| 640 _nextNodeIndex: function() | 640 _nextNodeIndex: function() |
| 641 { | 641 { |
| 642 return this.nodeIndex + this._snapshot._nodeFieldCount; | 642 return this.nodeIndex + this._snapshot._nodeFieldCount; |
| 643 }, | 643 }, |
| 644 | 644 |
| 645 /** | 645 /** |
| 646 * @return {number} | 646 * @return {number} |
| 647 */ | 647 */ |
| 648 _type: function() | 648 _type: function() |
| 649 { | 649 { |
| 650 var snapshot = this._snapshot; | 650 var snapshot = this._snapshot; |
| 651 return snapshot._nodes[this.nodeIndex + snapshot._nodeTypeOffset]; | 651 return snapshot.nodes[this.nodeIndex + snapshot._nodeTypeOffset]; |
| 652 } | 652 } |
| 653 }; | 653 }; |
| 654 | 654 |
| 655 /** | 655 /** |
| 656 * @constructor | 656 * @constructor |
| 657 * @implements {WebInspector.HeapSnapshotItemIterator} | 657 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 658 * @param {!WebInspector.HeapSnapshotNode} node | 658 * @param {!WebInspector.HeapSnapshotNode} node |
| 659 */ | 659 */ |
| 660 WebInspector.HeapSnapshotNodeIterator = function(node) | 660 WebInspector.HeapSnapshotNodeIterator = function(node) |
| 661 { | 661 { |
| 662 this.node = node; | 662 this.node = node; |
| 663 this._nodesLength = node._snapshot._nodes.length; | 663 this._nodesLength = node._snapshot.nodes.length; |
| 664 } | 664 } |
| 665 | 665 |
| 666 WebInspector.HeapSnapshotNodeIterator.prototype = { | 666 WebInspector.HeapSnapshotNodeIterator.prototype = { |
| 667 /** | 667 /** |
| 668 * @return {boolean} | 668 * @return {boolean} |
| 669 */ | 669 */ |
| 670 hasNext: function() | 670 hasNext: function() |
| 671 { | 671 { |
| 672 return this.node.nodeIndex < this._nodesLength; | 672 return this.node.nodeIndex < this._nodesLength; |
| 673 }, | 673 }, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 } | 811 } |
| 812 | 812 |
| 813 | 813 |
| 814 /** | 814 /** |
| 815 * @param {!Object} profile | 815 * @param {!Object} profile |
| 816 * @param {!WebInspector.HeapSnapshotProgress} progress | 816 * @param {!WebInspector.HeapSnapshotProgress} progress |
| 817 * @constructor | 817 * @constructor |
| 818 */ | 818 */ |
| 819 WebInspector.HeapSnapshot = function(profile, progress) | 819 WebInspector.HeapSnapshot = function(profile, progress) |
| 820 { | 820 { |
| 821 this._nodes = profile.nodes; | 821 /** @type {!Uint32Array} */ |
| 822 this._containmentEdges = profile.edges; | 822 this.nodes = profile.nodes; |
| 823 /** @type {!Uint32Array} */ |
| 824 this.containmentEdges = profile.edges; |
| 823 /** @type {!HeapSnapshotMetainfo} */ | 825 /** @type {!HeapSnapshotMetainfo} */ |
| 824 this._metaNode = profile.snapshot.meta; | 826 this._metaNode = profile.snapshot.meta; |
| 825 this._strings = profile.strings; | 827 /** @type {!Array.<string>} */ |
| 828 this.strings = profile.strings; |
| 826 this._progress = progress; | 829 this._progress = progress; |
| 827 | 830 |
| 828 this._noDistance = -5; | 831 this._noDistance = -5; |
| 829 this._rootNodeIndex = 0; | 832 this._rootNodeIndex = 0; |
| 830 if (profile.snapshot.root_index) | 833 if (profile.snapshot.root_index) |
| 831 this._rootNodeIndex = profile.snapshot.root_index; | 834 this._rootNodeIndex = profile.snapshot.root_index; |
| 832 | 835 |
| 833 this._snapshotDiffs = {}; | 836 this._snapshotDiffs = {}; |
| 834 this._aggregatesForDiff = null; | 837 this._aggregatesForDiff = null; |
| 835 this._aggregates = {}; | 838 this._aggregates = {}; |
| 836 this._aggregatesSortedFlags = {}; | 839 this._aggregatesSortedFlags = {}; |
| 837 | 840 |
| 838 this._init(); | 841 this._init(); |
| 839 | 842 |
| 840 if (profile.snapshot.trace_function_count) { | 843 if (profile.snapshot.trace_function_count) { |
| 841 this._progress.updateStatus("Buiding allocation statistics\u2026"); | 844 this._progress.updateStatus("Buiding allocation statistics\u2026"); |
| 842 var nodes = this._nodes; | 845 var nodes = this.nodes; |
| 843 var nodesLength = nodes.length; | 846 var nodesLength = nodes.length; |
| 844 var nodeFieldCount = this._nodeFieldCount; | 847 var nodeFieldCount = this._nodeFieldCount; |
| 845 var node = this.rootNode(); | 848 var node = this.rootNode(); |
| 846 var liveObjects = {}; | 849 var liveObjects = {}; |
| 847 for (var nodeIndex = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldC
ount) { | 850 for (var nodeIndex = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldC
ount) { |
| 848 node.nodeIndex = nodeIndex; | 851 node.nodeIndex = nodeIndex; |
| 849 var traceNodeId = node.traceNodeId(); | 852 var traceNodeId = node.traceNodeId(); |
| 850 var stats = liveObjects[traceNodeId]; | 853 var stats = liveObjects[traceNodeId]; |
| 851 if (!stats) { | 854 if (!stats) { |
| 852 liveObjects[traceNodeId] = stats = { count: 0, size: 0, ids: []}
; | 855 liveObjects[traceNodeId] = stats = { count: 0, size: 0, ids: []}
; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 | 919 |
| 917 this._edgeTypes = meta.edge_types[this._edgeTypeOffset]; | 920 this._edgeTypes = meta.edge_types[this._edgeTypeOffset]; |
| 918 this._edgeTypes.push("invisible"); | 921 this._edgeTypes.push("invisible"); |
| 919 this._edgeElementType = this._edgeTypes.indexOf("element"); | 922 this._edgeElementType = this._edgeTypes.indexOf("element"); |
| 920 this._edgeHiddenType = this._edgeTypes.indexOf("hidden"); | 923 this._edgeHiddenType = this._edgeTypes.indexOf("hidden"); |
| 921 this._edgeInternalType = this._edgeTypes.indexOf("internal"); | 924 this._edgeInternalType = this._edgeTypes.indexOf("internal"); |
| 922 this._edgeShortcutType = this._edgeTypes.indexOf("shortcut"); | 925 this._edgeShortcutType = this._edgeTypes.indexOf("shortcut"); |
| 923 this._edgeWeakType = this._edgeTypes.indexOf("weak"); | 926 this._edgeWeakType = this._edgeTypes.indexOf("weak"); |
| 924 this._edgeInvisibleType = this._edgeTypes.indexOf("invisible"); | 927 this._edgeInvisibleType = this._edgeTypes.indexOf("invisible"); |
| 925 | 928 |
| 926 this.nodeCount = this._nodes.length / this._nodeFieldCount; | 929 this.nodeCount = this.nodes.length / this._nodeFieldCount; |
| 927 this._edgeCount = this._containmentEdges.length / this._edgeFieldsCount; | 930 this._edgeCount = this.containmentEdges.length / this._edgeFieldsCount; |
| 928 | 931 |
| 929 this._progress.updateStatus("Building edge indexes\u2026"); | 932 this._progress.updateStatus("Building edge indexes\u2026"); |
| 930 this._buildEdgeIndexes(); | 933 this._buildEdgeIndexes(); |
| 931 this._progress.updateStatus("Building retainers\u2026"); | 934 this._progress.updateStatus("Building retainers\u2026"); |
| 932 this._buildRetainers(); | 935 this._buildRetainers(); |
| 933 this._progress.updateStatus("Calculating node flags\u2026"); | 936 this._progress.updateStatus("Calculating node flags\u2026"); |
| 934 this._calculateFlags(); | 937 this._calculateFlags(); |
| 935 this._progress.updateStatus("Calculating distances\u2026"); | 938 this._progress.updateStatus("Calculating distances\u2026"); |
| 936 this._calculateDistances(); | 939 this._calculateDistances(); |
| 937 this._progress.updateStatus("Building postorder index\u2026"); | 940 this._progress.updateStatus("Building postorder index\u2026"); |
| 938 var result = this._buildPostOrderIndex(); | 941 var result = this._buildPostOrderIndex(); |
| 939 // Actually it is array that maps node ordinal number to dominator node
ordinal number. | 942 // Actually it is array that maps node ordinal number to dominator node
ordinal number. |
| 940 this._progress.updateStatus("Building dominator tree\u2026"); | 943 this._progress.updateStatus("Building dominator tree\u2026"); |
| 941 this._dominatorsTree = this._buildDominatorTree(result.postOrderIndex2No
deOrdinal, result.nodeOrdinal2PostOrderIndex); | 944 this._dominatorsTree = this._buildDominatorTree(result.postOrderIndex2No
deOrdinal, result.nodeOrdinal2PostOrderIndex); |
| 942 this._progress.updateStatus("Calculating retained sizes\u2026"); | 945 this._progress.updateStatus("Calculating retained sizes\u2026"); |
| 943 this._calculateRetainedSizes(result.postOrderIndex2NodeOrdinal); | 946 this._calculateRetainedSizes(result.postOrderIndex2NodeOrdinal); |
| 944 this._progress.updateStatus("Buiding dominated nodes\u2026"); | 947 this._progress.updateStatus("Buiding dominated nodes\u2026"); |
| 945 this._buildDominatedNodes(); | 948 this._buildDominatedNodes(); |
| 946 this._progress.updateStatus("Calculating statistics\u2026"); | 949 this._progress.updateStatus("Calculating statistics\u2026"); |
| 947 this._calculateStatistics(); | 950 this._calculateStatistics(); |
| 948 this._progress.updateStatus("Finished processing."); | 951 this._progress.updateStatus("Finished processing."); |
| 949 }, | 952 }, |
| 950 | 953 |
| 951 _buildEdgeIndexes: function() | 954 _buildEdgeIndexes: function() |
| 952 { | 955 { |
| 953 var nodes = this._nodes; | 956 var nodes = this.nodes; |
| 954 var nodeCount = this.nodeCount; | 957 var nodeCount = this.nodeCount; |
| 955 var firstEdgeIndexes = this._firstEdgeIndexes = new Uint32Array(nodeCoun
t + 1); | 958 var firstEdgeIndexes = this._firstEdgeIndexes = new Uint32Array(nodeCoun
t + 1); |
| 956 var nodeFieldCount = this._nodeFieldCount; | 959 var nodeFieldCount = this._nodeFieldCount; |
| 957 var edgeFieldsCount = this._edgeFieldsCount; | 960 var edgeFieldsCount = this._edgeFieldsCount; |
| 958 var nodeEdgeCountOffset = this._nodeEdgeCountOffset; | 961 var nodeEdgeCountOffset = this._nodeEdgeCountOffset; |
| 959 firstEdgeIndexes[nodeCount] = this._containmentEdges.length; | 962 firstEdgeIndexes[nodeCount] = this.containmentEdges.length; |
| 960 for (var nodeOrdinal = 0, edgeIndex = 0; nodeOrdinal < nodeCount; ++node
Ordinal) { | 963 for (var nodeOrdinal = 0, edgeIndex = 0; nodeOrdinal < nodeCount; ++node
Ordinal) { |
| 961 firstEdgeIndexes[nodeOrdinal] = edgeIndex; | 964 firstEdgeIndexes[nodeOrdinal] = edgeIndex; |
| 962 edgeIndex += nodes[nodeOrdinal * nodeFieldCount + nodeEdgeCountOffse
t] * edgeFieldsCount; | 965 edgeIndex += nodes[nodeOrdinal * nodeFieldCount + nodeEdgeCountOffse
t] * edgeFieldsCount; |
| 963 } | 966 } |
| 964 }, | 967 }, |
| 965 | 968 |
| 966 _buildRetainers: function() | 969 _buildRetainers: function() |
| 967 { | 970 { |
| 968 var retainingNodes = this._retainingNodes = new Uint32Array(this._edgeCo
unt); | 971 var retainingNodes = this._retainingNodes = new Uint32Array(this._edgeCo
unt); |
| 969 var retainingEdges = this._retainingEdges = new Uint32Array(this._edgeCo
unt); | 972 var retainingEdges = this._retainingEdges = new Uint32Array(this._edgeCo
unt); |
| 970 // Index of the first retainer in the _retainingNodes and _retainingEdge
s | 973 // Index of the first retainer in the _retainingNodes and _retainingEdge
s |
| 971 // arrays. Addressed by retained node index. | 974 // arrays. Addressed by retained node index. |
| 972 var firstRetainerIndex = this._firstRetainerIndex = new Uint32Array(this
.nodeCount + 1); | 975 var firstRetainerIndex = this._firstRetainerIndex = new Uint32Array(this
.nodeCount + 1); |
| 973 | 976 |
| 974 var containmentEdges = this._containmentEdges; | 977 var containmentEdges = this.containmentEdges; |
| 975 var edgeFieldsCount = this._edgeFieldsCount; | 978 var edgeFieldsCount = this._edgeFieldsCount; |
| 976 var nodeFieldCount = this._nodeFieldCount; | 979 var nodeFieldCount = this._nodeFieldCount; |
| 977 var edgeToNodeOffset = this._edgeToNodeOffset; | 980 var edgeToNodeOffset = this._edgeToNodeOffset; |
| 978 var firstEdgeIndexes = this._firstEdgeIndexes; | 981 var firstEdgeIndexes = this._firstEdgeIndexes; |
| 979 var nodeCount = this.nodeCount; | 982 var nodeCount = this.nodeCount; |
| 980 | 983 |
| 981 for (var toNodeFieldIndex = edgeToNodeOffset, l = containmentEdges.lengt
h; toNodeFieldIndex < l; toNodeFieldIndex += edgeFieldsCount) { | 984 for (var toNodeFieldIndex = edgeToNodeOffset, l = containmentEdges.lengt
h; toNodeFieldIndex < l; toNodeFieldIndex += edgeFieldsCount) { |
| 982 var toNodeIndex = containmentEdges[toNodeFieldIndex]; | 985 var toNodeIndex = containmentEdges[toNodeFieldIndex]; |
| 983 if (toNodeIndex % nodeFieldCount) | 986 if (toNodeIndex % nodeFieldCount) |
| 984 throw new Error("Invalid toNodeIndex " + toNodeIndex); | 987 throw new Error("Invalid toNodeIndex " + toNodeIndex); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 | 1252 |
| 1250 var nodesToVisit = new Uint32Array(this.nodeCount); | 1253 var nodesToVisit = new Uint32Array(this.nodeCount); |
| 1251 var nodesToVisitLength = 0; | 1254 var nodesToVisitLength = 0; |
| 1252 | 1255 |
| 1253 /** | 1256 /** |
| 1254 * @param {number} distance | 1257 * @param {number} distance |
| 1255 * @param {!WebInspector.HeapSnapshotNode} node | 1258 * @param {!WebInspector.HeapSnapshotNode} node |
| 1256 */ | 1259 */ |
| 1257 function enqueueNode(distance, node) | 1260 function enqueueNode(distance, node) |
| 1258 { | 1261 { |
| 1259 var ordinal = node._ordinal(); | 1262 var ordinal = node.ordinal(); |
| 1260 if (distances[ordinal] !== noDistance) | 1263 if (distances[ordinal] !== noDistance) |
| 1261 return; | 1264 return; |
| 1262 distances[ordinal] = distance; | 1265 distances[ordinal] = distance; |
| 1263 nodesToVisit[nodesToVisitLength++] = node.nodeIndex; | 1266 nodesToVisit[nodesToVisitLength++] = node.nodeIndex; |
| 1264 } | 1267 } |
| 1265 | 1268 |
| 1266 this.forEachRoot(enqueueNode.bind(null, 1), true); | 1269 this.forEachRoot(enqueueNode.bind(null, 1), true); |
| 1267 this._bfs(nodesToVisit, nodesToVisitLength, distances); | 1270 this._bfs(nodesToVisit, nodesToVisitLength, distances); |
| 1268 | 1271 |
| 1269 // bfs for the rest of objects | 1272 // bfs for the rest of objects |
| 1270 nodesToVisitLength = 0; | 1273 nodesToVisitLength = 0; |
| 1271 this.forEachRoot(enqueueNode.bind(null, WebInspector.HeapSnapshotCommon.
baseSystemDistance), false); | 1274 this.forEachRoot(enqueueNode.bind(null, WebInspector.HeapSnapshotCommon.
baseSystemDistance), false); |
| 1272 this._bfs(nodesToVisit, nodesToVisitLength, distances); | 1275 this._bfs(nodesToVisit, nodesToVisitLength, distances); |
| 1273 }, | 1276 }, |
| 1274 | 1277 |
| 1275 /** | 1278 /** |
| 1276 * @param {!Uint32Array} nodesToVisit | 1279 * @param {!Uint32Array} nodesToVisit |
| 1277 * @param {!number} nodesToVisitLength | 1280 * @param {!number} nodesToVisitLength |
| 1278 * @param {!Int32Array} distances | 1281 * @param {!Int32Array} distances |
| 1279 */ | 1282 */ |
| 1280 _bfs: function(nodesToVisit, nodesToVisitLength, distances) | 1283 _bfs: function(nodesToVisit, nodesToVisitLength, distances) |
| 1281 { | 1284 { |
| 1282 // Preload fields into local variables for better performance. | 1285 // Preload fields into local variables for better performance. |
| 1283 var edgeFieldsCount = this._edgeFieldsCount; | 1286 var edgeFieldsCount = this._edgeFieldsCount; |
| 1284 var nodeFieldCount = this._nodeFieldCount; | 1287 var nodeFieldCount = this._nodeFieldCount; |
| 1285 var containmentEdges = this._containmentEdges; | 1288 var containmentEdges = this.containmentEdges; |
| 1286 var firstEdgeIndexes = this._firstEdgeIndexes; | 1289 var firstEdgeIndexes = this._firstEdgeIndexes; |
| 1287 var edgeToNodeOffset = this._edgeToNodeOffset; | 1290 var edgeToNodeOffset = this._edgeToNodeOffset; |
| 1288 var edgeTypeOffset = this._edgeTypeOffset; | 1291 var edgeTypeOffset = this._edgeTypeOffset; |
| 1289 var nodeCount = this.nodeCount; | 1292 var nodeCount = this.nodeCount; |
| 1290 var containmentEdgesLength = containmentEdges.length; | 1293 var containmentEdgesLength = containmentEdges.length; |
| 1291 var edgeWeakType = this._edgeWeakType; | 1294 var edgeWeakType = this._edgeWeakType; |
| 1292 var noDistance = this._noDistance; | 1295 var noDistance = this._noDistance; |
| 1293 | 1296 |
| 1294 var index = 0; | 1297 var index = 0; |
| 1295 while (index < nodesToVisitLength) { | 1298 while (index < nodesToVisitLength) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1312 } | 1315 } |
| 1313 if (nodesToVisitLength > nodeCount) | 1316 if (nodesToVisitLength > nodeCount) |
| 1314 throw new Error("BFS failed. Nodes to visit (" + nodesToVisitLength
+ ") is more than nodes count (" + nodeCount + ")"); | 1317 throw new Error("BFS failed. Nodes to visit (" + nodesToVisitLength
+ ") is more than nodes count (" + nodeCount + ")"); |
| 1315 }, | 1318 }, |
| 1316 | 1319 |
| 1317 _buildAggregates: function(filter) | 1320 _buildAggregates: function(filter) |
| 1318 { | 1321 { |
| 1319 var aggregates = {}; | 1322 var aggregates = {}; |
| 1320 var aggregatesByClassName = {}; | 1323 var aggregatesByClassName = {}; |
| 1321 var classIndexes = []; | 1324 var classIndexes = []; |
| 1322 var nodes = this._nodes; | 1325 var nodes = this.nodes; |
| 1323 var mapAndFlag = this.userObjectsMapAndFlag(); | 1326 var mapAndFlag = this.userObjectsMapAndFlag(); |
| 1324 var flags = mapAndFlag ? mapAndFlag.map : null; | 1327 var flags = mapAndFlag ? mapAndFlag.map : null; |
| 1325 var flag = mapAndFlag ? mapAndFlag.flag : 0; | 1328 var flag = mapAndFlag ? mapAndFlag.flag : 0; |
| 1326 var nodesLength = nodes.length; | 1329 var nodesLength = nodes.length; |
| 1327 var nodeNativeType = this._nodeNativeType; | 1330 var nodeNativeType = this._nodeNativeType; |
| 1328 var nodeFieldCount = this._nodeFieldCount; | 1331 var nodeFieldCount = this._nodeFieldCount; |
| 1329 var selfSizeOffset = this._nodeSelfSizeOffset; | 1332 var selfSizeOffset = this._nodeSelfSizeOffset; |
| 1330 var nodeTypeOffset = this._nodeTypeOffset; | 1333 var nodeTypeOffset = this._nodeTypeOffset; |
| 1331 var node = this.rootNode(); | 1334 var node = this.rootNode(); |
| 1332 var nodeDistances = this._nodeDistances; | 1335 var nodeDistances = this._nodeDistances; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 var rootNodeIndex = this._rootNodeIndex; | 1382 var rootNodeIndex = this._rootNodeIndex; |
| 1380 var node = this.createNode(rootNodeIndex); | 1383 var node = this.createNode(rootNodeIndex); |
| 1381 var list = [rootNodeIndex]; | 1384 var list = [rootNodeIndex]; |
| 1382 var sizes = [-1]; | 1385 var sizes = [-1]; |
| 1383 var classes = []; | 1386 var classes = []; |
| 1384 var seenClassNameIndexes = {}; | 1387 var seenClassNameIndexes = {}; |
| 1385 var nodeFieldCount = this._nodeFieldCount; | 1388 var nodeFieldCount = this._nodeFieldCount; |
| 1386 var nodeTypeOffset = this._nodeTypeOffset; | 1389 var nodeTypeOffset = this._nodeTypeOffset; |
| 1387 var nodeNativeType = this._nodeNativeType; | 1390 var nodeNativeType = this._nodeNativeType; |
| 1388 var dominatedNodes = this._dominatedNodes; | 1391 var dominatedNodes = this._dominatedNodes; |
| 1389 var nodes = this._nodes; | 1392 var nodes = this.nodes; |
| 1390 var mapAndFlag = this.userObjectsMapAndFlag(); | 1393 var mapAndFlag = this.userObjectsMapAndFlag(); |
| 1391 var flags = mapAndFlag ? mapAndFlag.map : null; | 1394 var flags = mapAndFlag ? mapAndFlag.map : null; |
| 1392 var flag = mapAndFlag ? mapAndFlag.flag : 0; | 1395 var flag = mapAndFlag ? mapAndFlag.flag : 0; |
| 1393 var firstDominatedNodeIndex = this._firstDominatedNodeIndex; | 1396 var firstDominatedNodeIndex = this._firstDominatedNodeIndex; |
| 1394 | 1397 |
| 1395 while (list.length) { | 1398 while (list.length) { |
| 1396 var nodeIndex = list.pop(); | 1399 var nodeIndex = list.pop(); |
| 1397 node.nodeIndex = nodeIndex; | 1400 node.nodeIndex = nodeIndex; |
| 1398 var classIndex = node.classIndex(); | 1401 var classIndex = node.classIndex(); |
| 1399 var seen = !!seenClassNameIndexes[classIndex]; | 1402 var seen = !!seenClassNameIndexes[classIndex]; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 function(idxA, idxB) { | 1437 function(idxA, idxB) { |
| 1435 nodeA.nodeIndex = idxA; | 1438 nodeA.nodeIndex = idxA; |
| 1436 nodeB.nodeIndex = idxB; | 1439 nodeB.nodeIndex = idxB; |
| 1437 return nodeA.id() < nodeB.id() ? -1 : 1; | 1440 return nodeA.id() < nodeB.id() ? -1 : 1; |
| 1438 }); | 1441 }); |
| 1439 }, | 1442 }, |
| 1440 | 1443 |
| 1441 _buildPostOrderIndex: function() | 1444 _buildPostOrderIndex: function() |
| 1442 { | 1445 { |
| 1443 var nodeFieldCount = this._nodeFieldCount; | 1446 var nodeFieldCount = this._nodeFieldCount; |
| 1444 var nodes = this._nodes; | 1447 var nodes = this.nodes; |
| 1445 var nodeCount = this.nodeCount; | 1448 var nodeCount = this.nodeCount; |
| 1446 var rootNodeOrdinal = this._rootNodeIndex / nodeFieldCount; | 1449 var rootNodeOrdinal = this._rootNodeIndex / nodeFieldCount; |
| 1447 | 1450 |
| 1448 var edgeFieldsCount = this._edgeFieldsCount; | 1451 var edgeFieldsCount = this._edgeFieldsCount; |
| 1449 var edgeTypeOffset = this._edgeTypeOffset; | 1452 var edgeTypeOffset = this._edgeTypeOffset; |
| 1450 var edgeToNodeOffset = this._edgeToNodeOffset; | 1453 var edgeToNodeOffset = this._edgeToNodeOffset; |
| 1451 var edgeShortcutType = this._edgeShortcutType; | 1454 var edgeShortcutType = this._edgeShortcutType; |
| 1452 var firstEdgeIndexes = this._firstEdgeIndexes; | 1455 var firstEdgeIndexes = this._firstEdgeIndexes; |
| 1453 var containmentEdges = this._containmentEdges; | 1456 var containmentEdges = this.containmentEdges; |
| 1454 | 1457 |
| 1455 var mapAndFlag = this.userObjectsMapAndFlag(); | 1458 var mapAndFlag = this.userObjectsMapAndFlag(); |
| 1456 var flags = mapAndFlag ? mapAndFlag.map : null; | 1459 var flags = mapAndFlag ? mapAndFlag.map : null; |
| 1457 var flag = mapAndFlag ? mapAndFlag.flag : 0; | 1460 var flag = mapAndFlag ? mapAndFlag.flag : 0; |
| 1458 | 1461 |
| 1459 var stackNodes = new Uint32Array(nodeCount); | 1462 var stackNodes = new Uint32Array(nodeCount); |
| 1460 var stackCurrentEdge = new Uint32Array(nodeCount); | 1463 var stackCurrentEdge = new Uint32Array(nodeCount); |
| 1461 var postOrderIndex2NodeOrdinal = new Uint32Array(nodeCount); | 1464 var postOrderIndex2NodeOrdinal = new Uint32Array(nodeCount); |
| 1462 var nodeOrdinal2PostOrderIndex = new Uint32Array(nodeCount); | 1465 var nodeOrdinal2PostOrderIndex = new Uint32Array(nodeCount); |
| 1463 var visited = new Uint8Array(nodeCount); | 1466 var visited = new Uint8Array(nodeCount); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 // The algorithm is based on the article: | 1524 // The algorithm is based on the article: |
| 1522 // K. Cooper, T. Harvey and K. Kennedy "A Simple, Fast Dominance Algorithm" | 1525 // K. Cooper, T. Harvey and K. Kennedy "A Simple, Fast Dominance Algorithm" |
| 1523 // Softw. Pract. Exper. 4 (2001), pp. 1-10. | 1526 // Softw. Pract. Exper. 4 (2001), pp. 1-10. |
| 1524 /** | 1527 /** |
| 1525 * @param {!Array.<number>} postOrderIndex2NodeOrdinal | 1528 * @param {!Array.<number>} postOrderIndex2NodeOrdinal |
| 1526 * @param {!Array.<number>} nodeOrdinal2PostOrderIndex | 1529 * @param {!Array.<number>} nodeOrdinal2PostOrderIndex |
| 1527 */ | 1530 */ |
| 1528 _buildDominatorTree: function(postOrderIndex2NodeOrdinal, nodeOrdinal2PostOr
derIndex) | 1531 _buildDominatorTree: function(postOrderIndex2NodeOrdinal, nodeOrdinal2PostOr
derIndex) |
| 1529 { | 1532 { |
| 1530 var nodeFieldCount = this._nodeFieldCount; | 1533 var nodeFieldCount = this._nodeFieldCount; |
| 1531 var nodes = this._nodes; | 1534 var nodes = this.nodes; |
| 1532 var firstRetainerIndex = this._firstRetainerIndex; | 1535 var firstRetainerIndex = this._firstRetainerIndex; |
| 1533 var retainingNodes = this._retainingNodes; | 1536 var retainingNodes = this._retainingNodes; |
| 1534 var retainingEdges = this._retainingEdges; | 1537 var retainingEdges = this._retainingEdges; |
| 1535 var edgeFieldsCount = this._edgeFieldsCount; | 1538 var edgeFieldsCount = this._edgeFieldsCount; |
| 1536 var edgeTypeOffset = this._edgeTypeOffset; | 1539 var edgeTypeOffset = this._edgeTypeOffset; |
| 1537 var edgeToNodeOffset = this._edgeToNodeOffset; | 1540 var edgeToNodeOffset = this._edgeToNodeOffset; |
| 1538 var edgeShortcutType = this._edgeShortcutType; | 1541 var edgeShortcutType = this._edgeShortcutType; |
| 1539 var firstEdgeIndexes = this._firstEdgeIndexes; | 1542 var firstEdgeIndexes = this._firstEdgeIndexes; |
| 1540 var containmentEdges = this._containmentEdges; | 1543 var containmentEdges = this.containmentEdges; |
| 1541 var containmentEdgesLength = this._containmentEdges.length; | 1544 var containmentEdgesLength = this.containmentEdges.length; |
| 1542 var rootNodeIndex = this._rootNodeIndex; | 1545 var rootNodeIndex = this._rootNodeIndex; |
| 1543 | 1546 |
| 1544 var mapAndFlag = this.userObjectsMapAndFlag(); | 1547 var mapAndFlag = this.userObjectsMapAndFlag(); |
| 1545 var flags = mapAndFlag ? mapAndFlag.map : null; | 1548 var flags = mapAndFlag ? mapAndFlag.map : null; |
| 1546 var flag = mapAndFlag ? mapAndFlag.flag : 0; | 1549 var flag = mapAndFlag ? mapAndFlag.flag : 0; |
| 1547 | 1550 |
| 1548 var nodesCount = postOrderIndex2NodeOrdinal.length; | 1551 var nodesCount = postOrderIndex2NodeOrdinal.length; |
| 1549 var rootPostOrderedIndex = nodesCount - 1; | 1552 var rootPostOrderedIndex = nodesCount - 1; |
| 1550 var noEntry = nodesCount; | 1553 var noEntry = nodesCount; |
| 1551 var dominators = new Uint32Array(nodesCount); | 1554 var dominators = new Uint32Array(nodesCount); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 for (var postOrderIndex = 0, l = dominators.length; postOrderIndex < l;
++postOrderIndex) { | 1639 for (var postOrderIndex = 0, l = dominators.length; postOrderIndex < l;
++postOrderIndex) { |
| 1637 nodeOrdinal = postOrderIndex2NodeOrdinal[postOrderIndex]; | 1640 nodeOrdinal = postOrderIndex2NodeOrdinal[postOrderIndex]; |
| 1638 dominatorsTree[nodeOrdinal] = postOrderIndex2NodeOrdinal[dominators[
postOrderIndex]]; | 1641 dominatorsTree[nodeOrdinal] = postOrderIndex2NodeOrdinal[dominators[
postOrderIndex]]; |
| 1639 } | 1642 } |
| 1640 return dominatorsTree; | 1643 return dominatorsTree; |
| 1641 }, | 1644 }, |
| 1642 | 1645 |
| 1643 _calculateRetainedSizes: function(postOrderIndex2NodeOrdinal) | 1646 _calculateRetainedSizes: function(postOrderIndex2NodeOrdinal) |
| 1644 { | 1647 { |
| 1645 var nodeCount = this.nodeCount; | 1648 var nodeCount = this.nodeCount; |
| 1646 var nodes = this._nodes; | 1649 var nodes = this.nodes; |
| 1647 var nodeSelfSizeOffset = this._nodeSelfSizeOffset; | 1650 var nodeSelfSizeOffset = this._nodeSelfSizeOffset; |
| 1648 var nodeFieldCount = this._nodeFieldCount; | 1651 var nodeFieldCount = this._nodeFieldCount; |
| 1649 var dominatorsTree = this._dominatorsTree; | 1652 var dominatorsTree = this._dominatorsTree; |
| 1650 var retainedSizes = this._retainedSizes = new Float64Array(nodeCount); | 1653 var retainedSizes = this._retainedSizes = new Float64Array(nodeCount); |
| 1651 | 1654 |
| 1652 for (var nodeOrdinal = 0; nodeOrdinal < nodeCount; ++nodeOrdinal) | 1655 for (var nodeOrdinal = 0; nodeOrdinal < nodeCount; ++nodeOrdinal) |
| 1653 retainedSizes[nodeOrdinal] = nodes[nodeOrdinal * nodeFieldCount + no
deSelfSizeOffset]; | 1656 retainedSizes[nodeOrdinal] = nodes[nodeOrdinal * nodeFieldCount + no
deSelfSizeOffset]; |
| 1654 | 1657 |
| 1655 // Propagate retained sizes for each node excluding root. | 1658 // Propagate retained sizes for each node excluding root. |
| 1656 for (var postOrderIndex = 0; postOrderIndex < nodeCount - 1; ++postOrder
Index) { | 1659 for (var postOrderIndex = 0; postOrderIndex < nodeCount - 1; ++postOrder
Index) { |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 { | 1933 { |
| 1931 return new WebInspector.HeapSnapshotNodesProvider(this, this.classNodesF
ilter(), this.aggregatesWithFilter(nodeFilter)[className].idxs); | 1934 return new WebInspector.HeapSnapshotNodesProvider(this, this.classNodesF
ilter(), this.aggregatesWithFilter(nodeFilter)[className].idxs); |
| 1932 }, | 1935 }, |
| 1933 | 1936 |
| 1934 /** | 1937 /** |
| 1935 * @return {number} | 1938 * @return {number} |
| 1936 */ | 1939 */ |
| 1937 _maxJsNodeId: function() | 1940 _maxJsNodeId: function() |
| 1938 { | 1941 { |
| 1939 var nodeFieldCount = this._nodeFieldCount; | 1942 var nodeFieldCount = this._nodeFieldCount; |
| 1940 var nodes = this._nodes; | 1943 var nodes = this.nodes; |
| 1941 var nodesLength = nodes.length; | 1944 var nodesLength = nodes.length; |
| 1942 var id = 0; | 1945 var id = 0; |
| 1943 for (var nodeIndex = this._nodeIdOffset; nodeIndex < nodesLength; nodeIn
dex += nodeFieldCount) { | 1946 for (var nodeIndex = this._nodeIdOffset; nodeIndex < nodesLength; nodeIn
dex += nodeFieldCount) { |
| 1944 var nextId = nodes[nodeIndex]; | 1947 var nextId = nodes[nodeIndex]; |
| 1945 // JS objects have odd ids, skip native objects. | 1948 // JS objects have odd ids, skip native objects. |
| 1946 if (nextId % 2 === 0) | 1949 if (nextId % 2 === 0) |
| 1947 continue; | 1950 continue; |
| 1948 if (id < nextId) | 1951 if (id < nextId) |
| 1949 id = nextId; | 1952 id = nextId; |
| 1950 } | 1953 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 * @param {number} windowRight | 2232 * @param {number} windowRight |
| 2230 */ | 2233 */ |
| 2231 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) | 2234 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) |
| 2232 { | 2235 { |
| 2233 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); | 2236 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); |
| 2234 }, | 2237 }, |
| 2235 | 2238 |
| 2236 __proto__: WebInspector.HeapSnapshotItemProvider.prototype | 2239 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
| 2237 } | 2240 } |
| 2238 | 2241 |
| OLD | NEW |