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

Unified Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart

Issue 3011803002: dart2js kernel: Sort constants
Patch Set: implement DartType ordering Created 3 years, 3 months 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/startup_emitter/model_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
index 03834c8317007d39c209ef42da135859f58fa643..baa5dd8b57381a91524f519254febee44632b4be 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
@@ -48,11 +48,12 @@ import '../../js_backend/js_backend.dart'
import '../../js_backend/interceptor_data.dart';
import '../../world.dart';
import '../code_emitter_task.dart';
-import '../constant_ordering.dart' show deepCompareConstants;
+import '../constant_ordering.dart' show ConstantOrdering;
import '../headers.dart';
import '../js_emitter.dart' show NativeEmitter;
import '../js_emitter.dart' show buildTearOffCode, NativeGenerator;
import '../model.dart';
+import '../sorter.dart' show Sorter;
part 'deferred_fragment_hash.dart';
part 'fragment_emitter.dart';
@@ -64,6 +65,7 @@ class ModelEmitter {
final NativeEmitter nativeEmitter;
final bool shouldGenerateSourceMap;
final ClosedWorld _closedWorld;
+ final ConstantOrdering _constantOrdering;
// The full code that is written to each hunk part-file.
final Map<Fragment, CodeOutput> outputBuffers = <Fragment, CodeOutput>{};
@@ -80,7 +82,8 @@ class ModelEmitter {
static const String typeNameProperty = r"builtin$cls";
ModelEmitter(this.compiler, this.namer, this.nativeEmitter, this._closedWorld,
- CodeEmitterTask task, this.shouldGenerateSourceMap) {
+ Sorter sorter, CodeEmitterTask task, this.shouldGenerateSourceMap)
+ : _constantOrdering = new ConstantOrdering(sorter) {
this.constantEmitter = new ConstantEmitter(
compiler.options,
_closedWorld.commonElements,
@@ -136,7 +139,7 @@ class ModelEmitter {
if (r != 0) return r;
// Resolve collisions in the long name by using a structural order.
- return deepCompareConstants(a, b);
+ return _constantOrdering.compare(a, b);
}
js.Expression generateStaticClosureAccess(MethodElement element) {

Powered by Google App Engine
This is Rietveld 408576698