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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/full_emitter/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.full_emitter; 5 library dart2js.js_emitter.full_emitter;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:collection' show HashMap; 8 import 'dart:collection' show HashMap;
9 9
10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
11 import 'package:js_runtime/shared/embedded_names.dart' show 11 import 'package:js_runtime/shared/embedded_names.dart' show
12 JsBuiltin, 12 JsBuiltin,
13 JsGetName; 13 JsGetName;
14 14
15 import '../headers.dart'; 15 import '../headers.dart';
16 import '../js_emitter.dart' hide Emitter; 16 import '../js_emitter.dart' hide Emitter;
17 import '../js_emitter.dart' as js_emitter show Emitter; 17 import '../js_emitter.dart' as js_emitter show Emitter;
18 import '../model.dart'; 18 import '../model.dart';
19 import '../program_builder/program_builder.dart'; 19 import '../program_builder/program_builder.dart';
20 import '../constant_ordering.dart' show deepCompareConstants;
21 20
22 import '../../common.dart'; 21 import '../../common.dart';
23 import '../../common/names.dart' show 22 import '../../common/names.dart' show
24 Names; 23 Names;
25 import '../../compiler.dart' show 24 import '../../compiler.dart' show
26 Compiler; 25 Compiler;
27 import '../../constants/values.dart'; 26 import '../../constants/values.dart';
28 import '../../core_types.dart' show 27 import '../../core_types.dart' show
29 CoreClasses; 28 CoreClasses;
30 import '../../dart_types.dart' show 29 import '../../dart_types.dart' show
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // Emit constant interceptors first. Constant interceptors for primitives 245 // Emit constant interceptors first. Constant interceptors for primitives
247 // might be used by code that builds other constants. See Issue 18173. 246 // might be used by code that builds other constants. See Issue 18173.
248 if (a.isInterceptor != b.isInterceptor) { 247 if (a.isInterceptor != b.isInterceptor) {
249 return a.isInterceptor ? -1 : 1; 248 return a.isInterceptor ? -1 : 1;
250 } 249 }
251 250
252 // Sorting by the long name clusters constants with the same constructor 251 // Sorting by the long name clusters constants with the same constructor
253 // which compresses a tiny bit better. 252 // which compresses a tiny bit better.
254 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b)); 253 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b));
255 if (r != 0) return r; 254 if (r != 0) return r;
256 255 // Resolve collisions in the long name by using the constant name (i.e. JS
257 // Resolve collisions in the long name by using a structural order. 256 // name) which is unique.
258 return deepCompareConstants(a, b); 257 // TODO(herhut): Find a better way to resolve collisions.
258 return namer.constantName(a).hashCode.compareTo(
259 namer.constantName(b).hashCode);
259 } 260 }
260 261
261 @override 262 @override
262 jsAst.Expression constantReference(ConstantValue value) { 263 jsAst.Expression constantReference(ConstantValue value) {
263 if (value.isFunction) { 264 if (value.isFunction) {
264 FunctionConstantValue functionConstant = value; 265 FunctionConstantValue functionConstant = value;
265 return isolateStaticClosureAccess(functionConstant.element); 266 return isolateStaticClosureAccess(functionConstant.element);
266 } 267 }
267 268
268 // We are only interested in the "isInlined" part, but it does not hurt to 269 // We are only interested in the "isInlined" part, but it does not hurt to
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2131 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2131 if (element.isInstanceMember) { 2132 if (element.isInstanceMember) {
2132 cachedClassBuilders.remove(element.enclosingClass); 2133 cachedClassBuilders.remove(element.enclosingClass);
2133 2134
2134 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2135 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2135 2136
2136 } 2137 }
2137 } 2138 }
2138 } 2139 }
2139 } 2140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698