aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 7e3503fe..a461cb06 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -171,7 +171,8 @@ merge(Compressor.prototype, {
node.process_expression(true);
}
var passes = +this.options.passes || 1;
- var last_count = 1 / 0;
+ var min_count = 1 / 0;
+ var stopping = false;
var mangle = { ie8: this.option("ie8") };
for (var pass = 0; pass < passes; pass++) {
node.figure_out_scope(mangle);
@@ -183,9 +184,15 @@ merge(Compressor.prototype, {
node.walk(new TreeWalker(function() {
count++;
}));
- this.info("pass " + pass + ": last_count: " + last_count + ", count: " + count);
- if (count >= last_count) break;
- last_count = count;
+ this.info("pass " + pass + ": last_count: " + min_count + ", count: " + count);
+ if (count < min_count) {
+ min_count = count;
+ stopping = false;
+ } else if (stopping) {
+ break;
+ } else {
+ stopping = true;
+ }
}
}
if (this.option("expression")) {