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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/lazy_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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.lazy_emitter.model_emitter; 5 library dart2js.js_emitter.lazy_emitter.model_emitter;
6 6
7 import '../../compiler.dart' show 7 import '../../compiler.dart' show
8 Compiler; 8 Compiler;
9 import '../../constants/values.dart' show 9 import '../../constants/values.dart' show
10 ConstantValue, 10 ConstantValue,
11 FunctionConstantValue; 11 FunctionConstantValue;
12 import '../../core_types.dart' show 12 import '../../core_types.dart' show
13 CoreClasses; 13 CoreClasses;
14 import '../../elements/elements.dart' show 14 import '../../elements/elements.dart' show
15 ClassElement, 15 ClassElement,
16 FunctionElement; 16 FunctionElement;
17 import '../../js/js.dart' as js; 17 import '../../js/js.dart' as js;
18 import '../../js_backend/js_backend.dart' show 18 import '../../js_backend/js_backend.dart' show
19 JavaScriptBackend, 19 JavaScriptBackend,
20 Namer, 20 Namer,
21 ConstantEmitter; 21 ConstantEmitter;
22 22
23 import '../js_emitter.dart' show NativeEmitter; 23 import '../js_emitter.dart' show NativeEmitter;
24 import '../constant_ordering.dart' show deepCompareConstants;
25 24
26 import 'package:js_runtime/shared/embedded_names.dart' show 25 import 'package:js_runtime/shared/embedded_names.dart' show
27 CREATE_NEW_ISOLATE, 26 CREATE_NEW_ISOLATE,
28 DEFERRED_LIBRARY_URIS, 27 DEFERRED_LIBRARY_URIS,
29 DEFERRED_LIBRARY_HASHES, 28 DEFERRED_LIBRARY_HASHES,
30 GET_TYPE_FROM_NAME, 29 GET_TYPE_FROM_NAME,
31 INITIALIZE_LOADED_HUNK, 30 INITIALIZE_LOADED_HUNK,
32 INTERCEPTORS_BY_TAG, 31 INTERCEPTORS_BY_TAG,
33 IS_HUNK_INITIALIZED, 32 IS_HUNK_INITIALIZED,
34 IS_HUNK_LOADED, 33 IS_HUNK_LOADED,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Emit constant interceptors first. Constant interceptors for primitives 101 // Emit constant interceptors first. Constant interceptors for primitives
103 // might be used by code that builds other constants. See Issue 18173. 102 // might be used by code that builds other constants. See Issue 18173.
104 if (a.isInterceptor != b.isInterceptor) { 103 if (a.isInterceptor != b.isInterceptor) {
105 return a.isInterceptor ? -1 : 1; 104 return a.isInterceptor ? -1 : 1;
106 } 105 }
107 106
108 // Sorting by the long name clusters constants with the same constructor 107 // Sorting by the long name clusters constants with the same constructor
109 // which compresses a tiny bit better. 108 // which compresses a tiny bit better.
110 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b)); 109 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b));
111 if (r != 0) return r; 110 if (r != 0) return r;
112 111 // Resolve collisions in the long name by using the constant name (i.e. JS
113 // Resolve collisions in the long name by using a structural order. 112 // name) which is unique.
114 return deepCompareConstants(a, b); 113 return namer.constantName(a).compareTo(namer.constantName(b));
115 } 114 }
116 115
117 js.Expression generateStaticClosureAccess(FunctionElement element) { 116 js.Expression generateStaticClosureAccess(FunctionElement element) {
118 return js.js('#.#()', 117 return js.js('#.#()',
119 [namer.globalObjectFor(element), namer.staticClosureName(element)]); 118 [namer.globalObjectFor(element), namer.staticClosureName(element)]);
120 } 119 }
121 120
122 js.Expression generateConstantReference(ConstantValue value) { 121 js.Expression generateConstantReference(ConstantValue value) {
123 if (value.isFunction) { 122 if (value.isFunction) {
124 FunctionConstantValue functionConstant = value; 123 FunctionConstantValue functionConstant = value;
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 1248
1250 var end = Date.now(); 1249 var end = Date.now();
1251 // print('Setup: ' + (end - start) + ' ms.'); 1250 // print('Setup: ' + (end - start) + ' ms.');
1252 1251
1253 #invokeMain; // Start main. 1252 #invokeMain; // Start main.
1254 1253
1255 })(Date.now(), #code) 1254 })(Date.now(), #code)
1256 }"""; 1255 }""";
1257 1256
1258 } 1257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698