Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: tools/profile.js

Issue 99054: TickProcessor script reimplemented in JavaScript. (Closed)
Patch Set: Addressed Soeren's comments Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/linux-tick-processor ('k') | tools/profileview.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 * if (parentClone) 388 * if (parentClone)
389 * parentClone.addChild(nodeClone); 389 * parentClone.addChild(nodeClone);
390 * return nodeClone; 390 * return nodeClone;
391 * }); 391 * });
392 * 392 *
393 * @param {function(devtools.profiler.CallTree.Node, *)} f Visitor function. 393 * @param {function(devtools.profiler.CallTree.Node, *)} f Visitor function.
394 * The second parameter is the result of calling 'f' on the parent node. 394 * The second parameter is the result of calling 'f' on the parent node.
395 * @param {devtools.profiler.CallTree.Node} opt_start Starting node. 395 * @param {devtools.profiler.CallTree.Node} opt_start Starting node.
396 */ 396 */
397 devtools.profiler.CallTree.prototype.traverse = function(f, opt_start) { 397 devtools.profiler.CallTree.prototype.traverse = function(f, opt_start) {
398 var pairsToProcess = [{node: opt_start || this.root_, param: null}]; 398 var pairsToProcess = new ConsArray();
399 while (pairsToProcess.length > 0) { 399 pairsToProcess.concat([{node: opt_start || this.root_, param: null}]);
400 var pair = pairsToProcess.shift(); 400 while (!pairsToProcess.atEnd()) {
401 var pair = pairsToProcess.next();
401 var node = pair.node; 402 var node = pair.node;
402 var newParam = f(node, pair.param); 403 var newParam = f(node, pair.param);
403 node.forEachChild( 404 var morePairsToProcess = [];
404 function (child) { pairsToProcess.push({node: child, param: newParam}); } 405 node.forEachChild(function (child) {
405 ); 406 morePairsToProcess.push({node: child, param: newParam}); });
407 pairsToProcess.concat(morePairsToProcess);
406 } 408 }
407 }; 409 };
408 410
409 411
410 /** 412 /**
411 * Performs an indepth call graph traversal. 413 * Performs an indepth call graph traversal.
412 * 414 *
413 * @param {function(devtools.profiler.CallTree.Node)} enter A function called 415 * @param {function(devtools.profiler.CallTree.Node)} enter A function called
414 * prior to visiting node's children. 416 * prior to visiting node's children.
415 * @param {function(devtools.profiler.CallTree.Node)} exit A function called 417 * @param {function(devtools.profiler.CallTree.Node)} exit A function called
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 labels, opt_f) { 547 labels, opt_f) {
546 for (var pos = 0, curr = this; pos < labels.length && curr != null; pos++) { 548 for (var pos = 0, curr = this; pos < labels.length && curr != null; pos++) {
547 var child = curr.findChild(labels[pos]); 549 var child = curr.findChild(labels[pos]);
548 if (opt_f) { 550 if (opt_f) {
549 opt_f(child, pos); 551 opt_f(child, pos);
550 } 552 }
551 curr = child; 553 curr = child;
552 } 554 }
553 return curr; 555 return curr;
554 }; 556 };
OLDNEW
« no previous file with comments | « tools/linux-tick-processor ('k') | tools/profileview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698