Index: pkg/compiler/lib/src/js_backend/minify_namer.dart |
diff --git a/pkg/compiler/lib/src/js_backend/minify_namer.dart b/pkg/compiler/lib/src/js_backend/minify_namer.dart |
index 45a10eb2d81059c9f5ef5f55106848b2165c0622..c2a9f4599a73286757225abba39a74aadeaba943 100644 |
--- a/pkg/compiler/lib/src/js_backend/minify_namer.dart |
+++ b/pkg/compiler/lib/src/js_backend/minify_namer.dart |
@@ -209,10 +209,17 @@ class MinifyNamer extends Namer { |
return h; |
} |
+ /// Remember bad hashes to avoid using a the same character with long numbers |
+ /// for frequent hashes. For example, `closure` is a very common name. |
+ Map<int, int> _badNames = new Map<int, int>(); |
+ |
/// If we can't find a hash based name in the three-letter space, then base |
/// the name on a letter and a counter. |
String _badName(int hash, Set<String> usedNames) { |
- String startLetter = new String.fromCharCodes([_letterNumber(hash)]); |
+ int count = _badNames.putIfAbsent(hash, () => 0); |
+ String startLetter = |
+ new String.fromCharCodes([_letterNumber(hash + count)]); |
+ _badNames[hash] = count + 1; |
String name; |
int i = 0; |
do { |