[Pkg-javascript-commits] [uglifyjs] 427/491: avoid suboptimal termination in `passes` (#2787)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:52:00 UTC 2018
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.
commit b483678ca7f5e539cef9c57324ecc92d65800f7d
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Mon Jan 15 16:42:31 2018 +0800
avoid suboptimal termination in `passes` (#2787)
---
lib/compress.js | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/compress.js b/lib/compress.js
index 7e3503f..a461cb0 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")) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list