diff options
author | alon@honor <none@none> | 2010-10-16 18:23:29 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-10-16 18:23:29 -0700 |
commit | 9ebbd0f56793f35b33a9e8410f8573f6a59b71c5 (patch) | |
tree | 48db0273be866df5b5b219e5661ccd1b12431133 /src/analyzer.js | |
parent | 81eafc4df3de74e5366891476506bf3f6b0db61d (diff) |
steal branch2s into multiples; 1% speedup
Diffstat (limited to 'src/analyzer.js')
-rw-r--r-- | src/analyzer.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index c4773b95..c3cdf573 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -774,6 +774,17 @@ function analyzer(data) { replaceLabelLabels(block.labels, set('BREAK|*|' + block.willGetTo), 'BNOPP'); } + if (block.type === 'emulated' && block.next && block.next.type === 'multiple') { + assert(block.labels.length == 1); + var lastLine = block.labels[0].lines.slice(-1)[0]; + if (lastLine.intertype == 'branch' && lastLine.ident) { // TODO: handle switch, and other non-branch2 things + // 'Steal' the condition + block.next.stolenCondition = lastLine; + lastLine.intertype = 'deleted'; + dprint('relooping', 'steal condition: ' + block.next.stolenCondition.ident); + } + } + recurseBlock(block, optimizeBlock); if (block.type === 'multiple') { |