OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (!mapAndFlag) | 90 if (!mapAndFlag) |
91 return null; | 91 return null; |
92 var map = mapAndFlag.map; | 92 var map = mapAndFlag.map; |
93 var flag = mapAndFlag.flag; | 93 var flag = mapAndFlag.flag; |
94 /** | 94 /** |
95 * @param {!WebInspector.JSHeapSnapshotNode} node | 95 * @param {!WebInspector.JSHeapSnapshotNode} node |
96 * @return {boolean} | 96 * @return {boolean} |
97 */ | 97 */ |
98 function filter(node) | 98 function filter(node) |
99 { | 99 { |
100 return !!(map[node._ordinal()] & flag); | 100 return !!(map[node.ordinal()] & flag); |
101 } | 101 } |
102 return filter; | 102 return filter; |
103 }, | 103 }, |
104 | 104 |
105 /** | 105 /** |
106 * @return {function(!WebInspector.HeapSnapshotEdge):boolean} | 106 * @return {function(!WebInspector.HeapSnapshotEdge):boolean} |
107 */ | 107 */ |
108 containmentEdgesFilter: function() | 108 containmentEdgesFilter: function() |
109 { | 109 { |
110 var showHiddenData = this._showHiddenData; | 110 var showHiddenData = this._showHiddenData; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 return null; | 170 return null; |
171 } | 171 } |
172 | 172 |
173 var visitedNodes = {}; | 173 var visitedNodes = {}; |
174 /** | 174 /** |
175 * @param {!WebInspector.HeapSnapshotNode} node | 175 * @param {!WebInspector.HeapSnapshotNode} node |
176 */ | 176 */ |
177 function doAction(node) | 177 function doAction(node) |
178 { | 178 { |
179 var ordinal = node._ordinal(); | 179 var ordinal = node.ordinal(); |
180 if (!visitedNodes[ordinal]) { | 180 if (!visitedNodes[ordinal]) { |
181 action(node); | 181 action(node); |
182 visitedNodes[ordinal] = true; | 182 visitedNodes[ordinal] = true; |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 var gcRoots = getChildNodeByName(this.rootNode(), "(GC roots)"); | 186 var gcRoots = getChildNodeByName(this.rootNode(), "(GC roots)"); |
187 if (!gcRoots) | 187 if (!gcRoots) |
188 return; | 188 return; |
189 | 189 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // via regular properties, and for DOM wrappers. Trying to access random
objects | 252 // via regular properties, and for DOM wrappers. Trying to access random
objects |
253 // can cause a crash due to insonsistent state of internal properties of
wrappers. | 253 // can cause a crash due to insonsistent state of internal properties of
wrappers. |
254 var flag = this._nodeFlags.canBeQueried; | 254 var flag = this._nodeFlags.canBeQueried; |
255 var hiddenEdgeType = this._edgeHiddenType; | 255 var hiddenEdgeType = this._edgeHiddenType; |
256 var internalEdgeType = this._edgeInternalType; | 256 var internalEdgeType = this._edgeInternalType; |
257 var invisibleEdgeType = this._edgeInvisibleType; | 257 var invisibleEdgeType = this._edgeInvisibleType; |
258 var weakEdgeType = this._edgeWeakType; | 258 var weakEdgeType = this._edgeWeakType; |
259 var edgeToNodeOffset = this._edgeToNodeOffset; | 259 var edgeToNodeOffset = this._edgeToNodeOffset; |
260 var edgeTypeOffset = this._edgeTypeOffset; | 260 var edgeTypeOffset = this._edgeTypeOffset; |
261 var edgeFieldsCount = this._edgeFieldsCount; | 261 var edgeFieldsCount = this._edgeFieldsCount; |
262 var containmentEdges = this._containmentEdges; | 262 var containmentEdges = this.containmentEdges; |
263 var nodes = this._nodes; | 263 var nodes = this.nodes; |
264 var nodeCount = this.nodeCount; | 264 var nodeCount = this.nodeCount; |
265 var nodeFieldCount = this._nodeFieldCount; | 265 var nodeFieldCount = this._nodeFieldCount; |
266 var firstEdgeIndexes = this._firstEdgeIndexes; | 266 var firstEdgeIndexes = this._firstEdgeIndexes; |
267 | 267 |
268 var flags = this._flags; | 268 var flags = this._flags; |
269 var list = []; | 269 var list = []; |
270 | 270 |
271 for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) { | 271 for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) { |
272 if (iter.edge.node().isUserRoot()) | 272 if (iter.edge.node().isUserRoot()) |
273 list.push(iter.edge.node().nodeIndex / nodeFieldCount); | 273 list.push(iter.edge.node().nodeIndex / nodeFieldCount); |
(...skipping 21 matching lines...) Expand all Loading... |
295 | 295 |
296 _markPageOwnedNodes: function() | 296 _markPageOwnedNodes: function() |
297 { | 297 { |
298 var edgeShortcutType = this._edgeShortcutType; | 298 var edgeShortcutType = this._edgeShortcutType; |
299 var edgeElementType = this._edgeElementType; | 299 var edgeElementType = this._edgeElementType; |
300 var edgeToNodeOffset = this._edgeToNodeOffset; | 300 var edgeToNodeOffset = this._edgeToNodeOffset; |
301 var edgeTypeOffset = this._edgeTypeOffset; | 301 var edgeTypeOffset = this._edgeTypeOffset; |
302 var edgeFieldsCount = this._edgeFieldsCount; | 302 var edgeFieldsCount = this._edgeFieldsCount; |
303 var edgeWeakType = this._edgeWeakType; | 303 var edgeWeakType = this._edgeWeakType; |
304 var firstEdgeIndexes = this._firstEdgeIndexes; | 304 var firstEdgeIndexes = this._firstEdgeIndexes; |
305 var containmentEdges = this._containmentEdges; | 305 var containmentEdges = this.containmentEdges; |
306 var containmentEdgesLength = containmentEdges.length; | 306 var containmentEdgesLength = containmentEdges.length; |
307 var nodes = this._nodes; | 307 var nodes = this.nodes; |
308 var nodeFieldCount = this._nodeFieldCount; | 308 var nodeFieldCount = this._nodeFieldCount; |
309 var nodesCount = this.nodeCount; | 309 var nodesCount = this.nodeCount; |
310 | 310 |
311 var flags = this._flags; | 311 var flags = this._flags; |
312 var flag = this._nodeFlags.pageObject; | 312 var flag = this._nodeFlags.pageObject; |
313 var visitedMarker = this._nodeFlags.visitedMarker; | 313 var visitedMarker = this._nodeFlags.visitedMarker; |
314 var visitedMarkerMask = this._nodeFlags.visitedMarkerMask; | 314 var visitedMarkerMask = this._nodeFlags.visitedMarkerMask; |
315 var markerAndFlag = visitedMarker | flag; | 315 var markerAndFlag = visitedMarker | flag; |
316 | 316 |
317 var nodesToVisit = new Uint32Array(nodesCount); | 317 var nodesToVisit = new Uint32Array(nodesCount); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 continue; | 351 continue; |
352 nodesToVisit[nodesToVisitLength++] = childNodeOrdinal; | 352 nodesToVisit[nodesToVisitLength++] = childNodeOrdinal; |
353 flags[childNodeOrdinal] |= visitedMarker; | 353 flags[childNodeOrdinal] |= visitedMarker; |
354 } | 354 } |
355 } | 355 } |
356 }, | 356 }, |
357 | 357 |
358 _calculateStatistics: function() | 358 _calculateStatistics: function() |
359 { | 359 { |
360 var nodeFieldCount = this._nodeFieldCount; | 360 var nodeFieldCount = this._nodeFieldCount; |
361 var nodes = this._nodes; | 361 var nodes = this.nodes; |
362 var nodesLength = nodes.length; | 362 var nodesLength = nodes.length; |
363 var nodeTypeOffset = this._nodeTypeOffset; | 363 var nodeTypeOffset = this._nodeTypeOffset; |
364 var nodeSizeOffset = this._nodeSelfSizeOffset;; | 364 var nodeSizeOffset = this._nodeSelfSizeOffset;; |
365 var nodeNativeType = this._nodeNativeType; | 365 var nodeNativeType = this._nodeNativeType; |
366 var nodeCodeType = this._nodeCodeType; | 366 var nodeCodeType = this._nodeCodeType; |
367 var nodeConsStringType = this._nodeConsStringType; | 367 var nodeConsStringType = this._nodeConsStringType; |
368 var nodeSlicedStringType = this._nodeSlicedStringType; | 368 var nodeSlicedStringType = this._nodeSlicedStringType; |
369 var sizeNative = 0; | 369 var sizeNative = 0; |
370 var sizeCode = 0; | 370 var sizeCode = 0; |
371 var sizeStrings = 0; | 371 var sizeStrings = 0; |
(...skipping 21 matching lines...) Expand all Loading... |
393 this._statistics.strings = sizeStrings; | 393 this._statistics.strings = sizeStrings; |
394 }, | 394 }, |
395 | 395 |
396 /** | 396 /** |
397 * @param {!WebInspector.HeapSnapshotNode} node | 397 * @param {!WebInspector.HeapSnapshotNode} node |
398 * @return {number} | 398 * @return {number} |
399 */ | 399 */ |
400 _calculateArraySize: function(node) | 400 _calculateArraySize: function(node) |
401 { | 401 { |
402 var size = node.selfSize(); | 402 var size = node.selfSize(); |
403 var beginEdgeIndex = node._edgeIndexesStart(); | 403 var beginEdgeIndex = node.edgeIndexesStart(); |
404 var endEdgeIndex = node._edgeIndexesEnd(); | 404 var endEdgeIndex = node.edgeIndexesEnd(); |
405 var containmentEdges = this._containmentEdges; | 405 var containmentEdges = this.containmentEdges; |
406 var strings = this._strings; | 406 var strings = this.strings; |
407 var edgeToNodeOffset = this._edgeToNodeOffset; | 407 var edgeToNodeOffset = this._edgeToNodeOffset; |
408 var edgeTypeOffset = this._edgeTypeOffset; | 408 var edgeTypeOffset = this._edgeTypeOffset; |
409 var edgeNameOffset = this._edgeNameOffset; | 409 var edgeNameOffset = this._edgeNameOffset; |
410 var edgeFieldsCount = this._edgeFieldsCount; | 410 var edgeFieldsCount = this._edgeFieldsCount; |
411 var edgeInternalType = this._edgeInternalType; | 411 var edgeInternalType = this._edgeInternalType; |
412 for (var edgeIndex = beginEdgeIndex; edgeIndex < endEdgeIndex; edgeIndex
+= edgeFieldsCount) { | 412 for (var edgeIndex = beginEdgeIndex; edgeIndex < endEdgeIndex; edgeIndex
+= edgeFieldsCount) { |
413 var edgeType = containmentEdges[edgeIndex + edgeTypeOffset]; | 413 var edgeType = containmentEdges[edgeIndex + edgeTypeOffset]; |
414 if (edgeType !== edgeInternalType) | 414 if (edgeType !== edgeInternalType) |
415 continue; | 415 continue; |
416 var edgeName = strings[containmentEdges[edgeIndex + edgeNameOffset]]
; | 416 var edgeName = strings[containmentEdges[edgeIndex + edgeNameOffset]]
; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 476 |
477 _consStringName: function() | 477 _consStringName: function() |
478 { | 478 { |
479 var snapshot = this._snapshot; | 479 var snapshot = this._snapshot; |
480 var consStringType = snapshot._nodeConsStringType; | 480 var consStringType = snapshot._nodeConsStringType; |
481 var edgeInternalType = snapshot._edgeInternalType; | 481 var edgeInternalType = snapshot._edgeInternalType; |
482 var edgeFieldsCount = snapshot._edgeFieldsCount; | 482 var edgeFieldsCount = snapshot._edgeFieldsCount; |
483 var edgeToNodeOffset = snapshot._edgeToNodeOffset; | 483 var edgeToNodeOffset = snapshot._edgeToNodeOffset; |
484 var edgeTypeOffset = snapshot._edgeTypeOffset; | 484 var edgeTypeOffset = snapshot._edgeTypeOffset; |
485 var edgeNameOffset = snapshot._edgeNameOffset; | 485 var edgeNameOffset = snapshot._edgeNameOffset; |
486 var strings = snapshot._strings; | 486 var strings = snapshot.strings; |
487 var edges = snapshot._containmentEdges; | 487 var edges = snapshot.containmentEdges; |
488 var firstEdgeIndexes = snapshot._firstEdgeIndexes; | 488 var firstEdgeIndexes = snapshot._firstEdgeIndexes; |
489 var nodeFieldCount = snapshot._nodeFieldCount; | 489 var nodeFieldCount = snapshot._nodeFieldCount; |
490 var nodeTypeOffset = snapshot._nodeTypeOffset; | 490 var nodeTypeOffset = snapshot._nodeTypeOffset; |
491 var nodeNameOffset = snapshot._nodeNameOffset; | 491 var nodeNameOffset = snapshot._nodeNameOffset; |
492 var nodes = snapshot._nodes; | 492 var nodes = snapshot.nodes; |
493 var nodesStack = []; | 493 var nodesStack = []; |
494 nodesStack.push(this.nodeIndex); | 494 nodesStack.push(this.nodeIndex); |
495 var name = ""; | 495 var name = ""; |
496 | 496 |
497 while (nodesStack.length && name.length < 1024) { | 497 while (nodesStack.length && name.length < 1024) { |
498 var nodeIndex = nodesStack.pop(); | 498 var nodeIndex = nodesStack.pop(); |
499 if (nodes[nodeIndex + nodeTypeOffset] !== consStringType) { | 499 if (nodes[nodeIndex + nodeTypeOffset] !== consStringType) { |
500 name += strings[nodes[nodeIndex + nodeNameOffset]]; | 500 name += strings[nodes[nodeIndex + nodeNameOffset]]; |
501 continue; | 501 continue; |
502 } | 502 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 return "(" + type + ")"; | 539 return "(" + type + ")"; |
540 } | 540 } |
541 }, | 541 }, |
542 | 542 |
543 /** | 543 /** |
544 * @return {number} | 544 * @return {number} |
545 */ | 545 */ |
546 classIndex: function() | 546 classIndex: function() |
547 { | 547 { |
548 var snapshot = this._snapshot; | 548 var snapshot = this._snapshot; |
549 var nodes = snapshot._nodes; | 549 var nodes = snapshot.nodes; |
550 var type = nodes[this.nodeIndex + snapshot._nodeTypeOffset];; | 550 var type = nodes[this.nodeIndex + snapshot._nodeTypeOffset];; |
551 if (type === snapshot._nodeObjectType || type === snapshot._nodeNativeTy
pe) | 551 if (type === snapshot._nodeObjectType || type === snapshot._nodeNativeTy
pe) |
552 return nodes[this.nodeIndex + snapshot._nodeNameOffset]; | 552 return nodes[this.nodeIndex + snapshot._nodeNameOffset]; |
553 return -1 - type; | 553 return -1 - type; |
554 }, | 554 }, |
555 | 555 |
556 /** | 556 /** |
557 * @return {number} | 557 * @return {number} |
558 */ | 558 */ |
559 id: function() | 559 id: function() |
560 { | 560 { |
561 var snapshot = this._snapshot; | 561 var snapshot = this._snapshot; |
562 return snapshot._nodes[this.nodeIndex + snapshot._nodeIdOffset]; | 562 return snapshot.nodes[this.nodeIndex + snapshot._nodeIdOffset]; |
563 }, | 563 }, |
564 | 564 |
565 /** | 565 /** |
566 * @return {boolean} | 566 * @return {boolean} |
567 */ | 567 */ |
568 isHidden: function() | 568 isHidden: function() |
569 { | 569 { |
570 return this._type() === this._snapshot._nodeHiddenType; | 570 return this._type() === this._snapshot._nodeHiddenType; |
571 }, | 571 }, |
572 | 572 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 return "?" + name + "?"; | 726 return "?" + name + "?"; |
727 }, | 727 }, |
728 | 728 |
729 _hasStringName: function() | 729 _hasStringName: function() |
730 { | 730 { |
731 return !this.isElement() && !this.isHidden(); | 731 return !this.isElement() && !this.isHidden(); |
732 }, | 732 }, |
733 | 733 |
734 _name: function() | 734 _name: function() |
735 { | 735 { |
736 return this._hasStringName() ? this._snapshot._strings[this._nameOrIndex
()] : this._nameOrIndex(); | 736 return this._hasStringName() ? this._snapshot.strings[this._nameOrIndex(
)] : this._nameOrIndex(); |
737 }, | 737 }, |
738 | 738 |
739 _nameOrIndex: function() | 739 _nameOrIndex: function() |
740 { | 740 { |
741 return this._edges[this.edgeIndex + this._snapshot._edgeNameOffset]; | 741 return this._edges[this.edgeIndex + this._snapshot._edgeNameOffset]; |
742 }, | 742 }, |
743 | 743 |
744 _type: function() | 744 _type: function() |
745 { | 745 { |
746 return this._edges[this.edgeIndex + this._snapshot._edgeTypeOffset]; | 746 return this._edges[this.edgeIndex + this._snapshot._edgeTypeOffset]; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 * @return {boolean} | 807 * @return {boolean} |
808 */ | 808 */ |
809 isWeak: function() | 809 isWeak: function() |
810 { | 810 { |
811 return this._edge().isWeak(); | 811 return this._edge().isWeak(); |
812 }, | 812 }, |
813 | 813 |
814 __proto__: WebInspector.HeapSnapshotRetainerEdge.prototype | 814 __proto__: WebInspector.HeapSnapshotRetainerEdge.prototype |
815 } | 815 } |
816 | 816 |
OLD | NEW |