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

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

Issue 2610513005: Use Entity instead of Element in ConstantValue (Closed)
Patch Set: Created 3 years, 11 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 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' 9 import 'package:js_runtime/shared/embedded_names.dart'
10 show 10 show
(...skipping 16 matching lines...) Expand all
27 METADATA, 27 METADATA,
28 NATIVE_SUPERCLASS_TAG_NAME, 28 NATIVE_SUPERCLASS_TAG_NAME,
29 STATIC_FUNCTION_NAME_TO_CLOSURE, 29 STATIC_FUNCTION_NAME_TO_CLOSURE,
30 TYPE_TO_INTERCEPTOR_MAP, 30 TYPE_TO_INTERCEPTOR_MAP,
31 TYPES; 31 TYPES;
32 32
33 import '../../common.dart'; 33 import '../../common.dart';
34 import '../../compiler.dart' show Compiler; 34 import '../../compiler.dart' show Compiler;
35 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue; 35 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue;
36 import '../../core_types.dart' show CommonElements; 36 import '../../core_types.dart' show CommonElements;
37 import '../../elements/elements.dart' show ClassElement, FunctionElement; 37 import '../../elements/elements.dart' show ClassElement, MethodElement;
38 import '../../hash/sha1.dart' show Hasher; 38 import '../../hash/sha1.dart' show Hasher;
39 import '../../io/code_output.dart'; 39 import '../../io/code_output.dart';
40 import '../../io/line_column_provider.dart' 40 import '../../io/line_column_provider.dart'
41 show LineColumnCollector, LineColumnProvider; 41 show LineColumnCollector, LineColumnProvider;
42 import '../../io/source_map_builder.dart' show SourceMapBuilder; 42 import '../../io/source_map_builder.dart' show SourceMapBuilder;
43 import '../../js/js.dart' as js; 43 import '../../js/js.dart' as js;
44 import '../../js_backend/js_backend.dart' 44 import '../../js_backend/js_backend.dart'
45 show JavaScriptBackend, Namer, ConstantEmitter; 45 show JavaScriptBackend, Namer, ConstantEmitter;
46 import '../../util/uri_extras.dart' show relativize; 46 import '../../util/uri_extras.dart' show relativize;
47 import '../constant_ordering.dart' show deepCompareConstants; 47 import '../constant_ordering.dart' show deepCompareConstants;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 // Sorting by the long name clusters constants with the same constructor 122 // Sorting by the long name clusters constants with the same constructor
123 // which compresses a tiny bit better. 123 // which compresses a tiny bit better.
124 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b)); 124 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b));
125 if (r != 0) return r; 125 if (r != 0) return r;
126 126
127 // Resolve collisions in the long name by using a structural order. 127 // Resolve collisions in the long name by using a structural order.
128 return deepCompareConstants(a, b); 128 return deepCompareConstants(a, b);
129 } 129 }
130 130
131 js.Expression generateStaticClosureAccess(FunctionElement element) { 131 js.Expression generateStaticClosureAccess(MethodElement element) {
132 return js.js('#.#()', 132 return js.js('#.#()',
133 [namer.globalObjectFor(element), namer.staticClosureName(element)]); 133 [namer.globalObjectFor(element), namer.staticClosureName(element)]);
134 } 134 }
135 135
136 js.Expression generateConstantReference(ConstantValue value) { 136 js.Expression generateConstantReference(ConstantValue value) {
137 if (value.isFunction) { 137 if (value.isFunction) {
138 FunctionConstantValue functionConstant = value; 138 FunctionConstantValue functionConstant = value;
139 return generateStaticClosureAccess(functionConstant.element); 139 return generateStaticClosureAccess(functionConstant.element);
140 } 140 }
141 141
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // data. 396 // data.
397 mapping["_comment"] = "This mapping shows which compiled `.js` files are " 397 mapping["_comment"] = "This mapping shows which compiled `.js` files are "
398 "needed for a given deferred library import."; 398 "needed for a given deferred library import.";
399 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); 399 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap());
400 compiler.outputProvider( 400 compiler.outputProvider(
401 compiler.options.deferredMapUri.path, 'deferred_map') 401 compiler.options.deferredMapUri.path, 'deferred_map')
402 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) 402 ..add(const JsonEncoder.withIndent(" ").convert(mapping))
403 ..close(); 403 ..close();
404 } 404 }
405 } 405 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart ('k') | pkg/compiler/lib/src/kernel/kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698