Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart

Issue 1491413008: Canonical output ordering for constants. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: baseline for fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
index 7abae77453072725cfc516457b948ff3321a62a8..b16379f5465ca7a8aa2e072146d7a0ab08a2734e 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
@@ -17,6 +17,7 @@ import '../js_emitter.dart' hide Emitter;
import '../js_emitter.dart' as js_emitter show Emitter;
import '../model.dart';
import '../program_builder/program_builder.dart';
+import '../constant_ordering.dart' show deepCompareConstants;
import '../../common.dart';
import '../../common/names.dart' show
@@ -252,11 +253,9 @@ class Emitter implements js_emitter.Emitter {
// which compresses a tiny bit better.
int r = namer.constantLongName(a).compareTo(namer.constantLongName(b));
if (r != 0) return r;
- // Resolve collisions in the long name by using the constant name (i.e. JS
- // name) which is unique.
- // TODO(herhut): Find a better way to resolve collisions.
- return namer.constantName(a).hashCode.compareTo(
- namer.constantName(b).hashCode);
+
+ // Resolve collisions in the long name by using a structural order.
+ return deepCompareConstants(a, b);
}
@override

Powered by Google App Engine
This is Rietveld 408576698