| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 devtools.profiler.Profile.prototype.deleteCode = function(start) { | 156 devtools.profiler.Profile.prototype.deleteCode = function(start) { |
| 157 try { | 157 try { |
| 158 this.codeMap_.deleteCode(start); | 158 this.codeMap_.deleteCode(start); |
| 159 } catch (e) { | 159 } catch (e) { |
| 160 this.handleUnknownCode(devtools.profiler.Profile.Operation.DELETE, start); | 160 this.handleUnknownCode(devtools.profiler.Profile.Operation.DELETE, start); |
| 161 } | 161 } |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 * Retrieves a code entry by an address. |
| 167 * |
| 168 * @param {number} addr Entry address. |
| 169 */ |
| 170 devtools.profiler.Profile.prototype.findEntry = function(addr) { |
| 171 return this.codeMap_.findEntry(addr); |
| 172 }; |
| 173 |
| 174 |
| 175 /** |
| 166 * Records a tick event. Stack must contain a sequence of | 176 * Records a tick event. Stack must contain a sequence of |
| 167 * addresses starting with the program counter value. | 177 * addresses starting with the program counter value. |
| 168 * | 178 * |
| 169 * @param {Array<number>} stack Stack sample. | 179 * @param {Array<number>} stack Stack sample. |
| 170 */ | 180 */ |
| 171 devtools.profiler.Profile.prototype.recordTick = function(stack) { | 181 devtools.profiler.Profile.prototype.recordTick = function(stack) { |
| 172 var processedStack = this.resolveAndFilterFuncs_(stack); | 182 var processedStack = this.resolveAndFilterFuncs_(stack); |
| 173 this.bottomUpTree_.addPath(processedStack); | 183 this.bottomUpTree_.addPath(processedStack); |
| 174 processedStack.reverse(); | 184 processedStack.reverse(); |
| 175 this.topDownTree_.addPath(processedStack); | 185 this.topDownTree_.addPath(processedStack); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 name = '<anonymous>'; | 348 name = '<anonymous>'; |
| 339 } else if (name.charAt(0) == ' ') { | 349 } else if (name.charAt(0) == ' ') { |
| 340 // An anonymous function with location: " aaa.js:10". | 350 // An anonymous function with location: " aaa.js:10". |
| 341 name = '<anonymous>' + name; | 351 name = '<anonymous>' + name; |
| 342 } | 352 } |
| 343 return this.type + ': ' + name; | 353 return this.type + ': ' + name; |
| 344 }; | 354 }; |
| 345 | 355 |
| 346 | 356 |
| 347 /** | 357 /** |
| 358 * Returns raw node name (without type decoration). |
| 359 */ |
| 360 devtools.profiler.Profile.DynamicCodeEntry.prototype.getRawName = function() { |
| 361 return this.name; |
| 362 }; |
| 363 |
| 364 |
| 365 /** |
| 348 * Constructs a call graph. | 366 * Constructs a call graph. |
| 349 * | 367 * |
| 350 * @constructor | 368 * @constructor |
| 351 */ | 369 */ |
| 352 devtools.profiler.CallTree = function() { | 370 devtools.profiler.CallTree = function() { |
| 353 this.root_ = new devtools.profiler.CallTree.Node( | 371 this.root_ = new devtools.profiler.CallTree.Node( |
| 354 devtools.profiler.CallTree.ROOT_NODE_LABEL); | 372 devtools.profiler.CallTree.ROOT_NODE_LABEL); |
| 355 }; | 373 }; |
| 356 | 374 |
| 357 | 375 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 labels, opt_f) { | 630 labels, opt_f) { |
| 613 for (var pos = 0, curr = this; pos < labels.length && curr != null; pos++) { | 631 for (var pos = 0, curr = this; pos < labels.length && curr != null; pos++) { |
| 614 var child = curr.findChild(labels[pos]); | 632 var child = curr.findChild(labels[pos]); |
| 615 if (opt_f) { | 633 if (opt_f) { |
| 616 opt_f(child, pos); | 634 opt_f(child, pos); |
| 617 } | 635 } |
| 618 curr = child; | 636 curr = child; |
| 619 } | 637 } |
| 620 return curr; | 638 return curr; |
| 621 }; | 639 }; |
| OLD | NEW |