Index: tools/profile.js |
diff --git a/tools/profile.js b/tools/profile.js |
index d2b53223c042edcdb17063c625372264fd924fa4..70e30846da9ebef5dc135c234d8a9defee5fbadb 100644 |
--- a/tools/profile.js |
+++ b/tools/profile.js |
@@ -395,14 +395,16 @@ devtools.profiler.CallTree.prototype.computeTotalWeights = function() { |
* @param {devtools.profiler.CallTree.Node} opt_start Starting node. |
*/ |
devtools.profiler.CallTree.prototype.traverse = function(f, opt_start) { |
- var pairsToProcess = [{node: opt_start || this.root_, param: null}]; |
- while (pairsToProcess.length > 0) { |
- var pair = pairsToProcess.shift(); |
+ var pairsToProcess = new ConsArray(); |
+ pairsToProcess.concat([{node: opt_start || this.root_, param: null}]); |
+ while (!pairsToProcess.atEnd()) { |
+ var pair = pairsToProcess.next(); |
var node = pair.node; |
var newParam = f(node, pair.param); |
- node.forEachChild( |
- function (child) { pairsToProcess.push({node: child, param: newParam}); } |
- ); |
+ var morePairsToProcess = []; |
+ node.forEachChild(function (child) { |
+ morePairsToProcess.push({node: child, param: newParam}); }); |
+ pairsToProcess.concat(morePairsToProcess); |
} |
}; |