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

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

Issue 1511383002: Revert "Canonical output ordering for constants." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.js_emitter.startup_emitter.model_emitter; 5 library dart2js.js_emitter.startup_emitter.model_emitter;
6 6
7 import 'dart:convert' show JsonEncoder; 7 import 'dart:convert' show JsonEncoder;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' show 9 import 'package:js_runtime/shared/embedded_names.dart' show
10 CLASS_FIELDS_EXTRACTOR, 10 CLASS_FIELDS_EXTRACTOR,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 import '../../io/source_map_builder.dart' show 49 import '../../io/source_map_builder.dart' show
50 SourceMapBuilder; 50 SourceMapBuilder;
51 import '../../js/js.dart' as js; 51 import '../../js/js.dart' as js;
52 import '../../js_backend/js_backend.dart' show 52 import '../../js_backend/js_backend.dart' show
53 JavaScriptBackend, 53 JavaScriptBackend,
54 Namer, 54 Namer,
55 ConstantEmitter; 55 ConstantEmitter;
56 import '../../util/uri_extras.dart' show 56 import '../../util/uri_extras.dart' show
57 relativize; 57 relativize;
58 58
59 import '../constant_ordering.dart' show deepCompareConstants;
60 import '../headers.dart'; 59 import '../headers.dart';
61 import '../js_emitter.dart' show 60 import '../js_emitter.dart' show
62 NativeEmitter; 61 NativeEmitter;
63 62
64 import '../js_emitter.dart' show 63 import '../js_emitter.dart' show
65 buildTearOffCode, 64 buildTearOffCode,
66 NativeGenerator; 65 NativeGenerator;
67 import '../model.dart'; 66 import '../model.dart';
68 67
69 part 'deferred_fragment_hash.dart'; 68 part 'deferred_fragment_hash.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // Emit constant interceptors first. Constant interceptors for primitives 133 // Emit constant interceptors first. Constant interceptors for primitives
135 // might be used by code that builds other constants. See Issue 18173. 134 // might be used by code that builds other constants. See Issue 18173.
136 if (a.isInterceptor != b.isInterceptor) { 135 if (a.isInterceptor != b.isInterceptor) {
137 return a.isInterceptor ? -1 : 1; 136 return a.isInterceptor ? -1 : 1;
138 } 137 }
139 138
140 // Sorting by the long name clusters constants with the same constructor 139 // Sorting by the long name clusters constants with the same constructor
141 // which compresses a tiny bit better. 140 // which compresses a tiny bit better.
142 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b)); 141 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b));
143 if (r != 0) return r; 142 if (r != 0) return r;
144 143 // Resolve collisions in the long name by using the constant name (i.e. JS
145 // Resolve collisions in the long name by using a structural order. 144 // name) which is unique.
146 return deepCompareConstants(a, b); 145 return namer.constantName(a).compareTo(namer.constantName(b));
147 } 146 }
148 147
149 js.Expression generateStaticClosureAccess(FunctionElement element) { 148 js.Expression generateStaticClosureAccess(FunctionElement element) {
150 return js.js('#.#()', 149 return js.js('#.#()',
151 [namer.globalObjectFor(element), namer.staticClosureName(element)]); 150 [namer.globalObjectFor(element), namer.staticClosureName(element)]);
152 } 151 }
153 152
154 js.Expression generateConstantReference(ConstantValue value) { 153 js.Expression generateConstantReference(ConstantValue value) {
155 if (value.isFunction) { 154 if (value.isFunction) {
156 FunctionConstantValue functionConstant = value; 155 FunctionConstantValue functionConstant = value;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 // Json does not support comments, so we embed the explanation in the 414 // Json does not support comments, so we embed the explanation in the
416 // data. 415 // data.
417 mapping["_comment"] = "This mapping shows which compiled `.js` files are " 416 mapping["_comment"] = "This mapping shows which compiled `.js` files are "
418 "needed for a given deferred library import."; 417 "needed for a given deferred library import.";
419 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); 418 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap());
420 compiler.outputProvider(compiler.deferredMapUri.path, 'deferred_map') 419 compiler.outputProvider(compiler.deferredMapUri.path, 'deferred_map')
421 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) 420 ..add(const JsonEncoder.withIndent(" ").convert(mapping))
422 ..close(); 421 ..close();
423 } 422 }
424 } 423 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart ('k') | tests/compiler/dart2js_extra/many_constants_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698