diff options
author | alon@honor <none@none> | 2010-10-15 20:15:27 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-10-15 20:15:27 -0700 |
commit | 57b5edca46b8e86c7a0157db84e20eeab0eb547f (patch) | |
tree | 461c179d5f0ad53f11582ddb380e40743768967f /src/analyzer.js | |
parent | 02818fb370ff1c5660b3245d4312418bdd3b17ef (diff) |
recurse blocks in loop optimizer; 1% speedup
Diffstat (limited to 'src/analyzer.js')
-rw-r--r-- | src/analyzer.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index d2d5103e..f771392d 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -593,7 +593,7 @@ function analyzer(data) { if (externals.length > 0) { // outer - ret.outer = makeBlock(externals, enteredExitLabels, labelsDict); + ret.next = makeBlock(externals, enteredExitLabels, labelsDict); } return ret; @@ -710,6 +710,7 @@ function analyzer(data) { if (!RELOOP) return finish(); function walkBlock(block) { + if (!block) return; dprint('relooping', "// loopOptimizing block: " + block.type + ' : ' + block.entries); if (block.type == 'emulated') { if (block.labels.length == 1 && block.next) { @@ -721,10 +722,13 @@ function analyzer(data) { } } } else if (block.type == 'reloop') { + walkBlock(block.inner); } else if (block.type == 'multiple') { + block.entryLabels.forEach(function(entryLabel) { walkBlock(entryLabel.block) }); } else { throw "Walked into an invalid block type: " + block.type; } + walkBlock(block.next); } item.functions.forEach(function(func) { |