diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-03 14:18:03 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-03 14:18:03 -0800 |
commit | 5967df82e9a2da8e1737b0f46b3db3f7b785af73 (patch) | |
tree | 28bdc0d1587c2c76d8683a351881688a929f57ff | |
parent | 4a143856c07bffe05c3e1b2f18d5f8e343e5843b (diff) |
tweak loop hoisting
-rw-r--r-- | src/analyzer.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index 7751f2d3..1e03a1d6 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -1070,8 +1070,7 @@ function analyzer(data) { // Check if hoisting this external entry is worthwhile. We first do a dry run, aborting on // loops (which we never hoist, to avoid over-nesting) or on seeing too many labels would be hoisted // (to avoid enlarging loops too much). If the dry run succeeded, it will stop when it reaches - // places where we rejoin other external entries. Hoisting removes one entry, so if we add more than - // one this would be a net loss, and we do not hoist. + // places where we rejoin other external entries. var seen, newEntries; function prepare() { seen = {}; @@ -1102,7 +1101,8 @@ function analyzer(data) { if (hoist(exitLabel, true)) { var seenList = unset(seen); var num = sum(seenList.map(function(seen) { return labelsDict[seen].lines.length })); - if (seenList.length > 1 && num <= maxHoist) { + // Only hoist if the sizes make sense + if (seenList.length >= 1 && num <= maxHoist) { // && unset(newEntries).length <= 1) { prepare(); hoist(exitLabel); mergeInto(totalNewEntries, newEntries); |