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

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

Issue 2907373002: Use entities for globals in Namer. (Closed)
Patch Set: Updated cf. comments Created 3 years, 6 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
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'dart:math' show Random; 8 import 'dart:math' show Random;
9 9
10 import 'package:js_runtime/shared/embedded_names.dart' 10 import 'package:js_runtime/shared/embedded_names.dart'
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Sorting by the long name clusters constants with the same constructor 131 // Sorting by the long name clusters constants with the same constructor
132 // which compresses a tiny bit better. 132 // which compresses a tiny bit better.
133 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b)); 133 int r = namer.constantLongName(a).compareTo(namer.constantLongName(b));
134 if (r != 0) return r; 134 if (r != 0) return r;
135 135
136 // Resolve collisions in the long name by using a structural order. 136 // Resolve collisions in the long name by using a structural order.
137 return deepCompareConstants(a, b); 137 return deepCompareConstants(a, b);
138 } 138 }
139 139
140 js.Expression generateStaticClosureAccess(MethodElement element) { 140 js.Expression generateStaticClosureAccess(MethodElement element) {
141 return js.js('#.#()', 141 return js.js('#.#()', [
142 [namer.globalObjectFor(element), namer.staticClosureName(element)]); 142 namer.globalObjectForMember(element),
143 namer.staticClosureName(element)
144 ]);
143 } 145 }
144 146
145 js.Expression generateConstantReference(ConstantValue value) { 147 js.Expression generateConstantReference(ConstantValue value) {
146 if (value.isFunction) { 148 if (value.isFunction) {
147 FunctionConstantValue functionConstant = value; 149 FunctionConstantValue functionConstant = value;
148 return generateStaticClosureAccess(functionConstant.element); 150 return generateStaticClosureAccess(functionConstant.element);
149 } 151 }
150 152
151 // We are only interested in the "isInlined" part, but it does not hurt to 153 // We are only interested in the "isInlined" part, but it does not hurt to
152 // test for the other predicates. 154 // test for the other predicates.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // data. 393 // data.
392 mapping["_comment"] = "This mapping shows which compiled `.js` files are " 394 mapping["_comment"] = "This mapping shows which compiled `.js` files are "
393 "needed for a given deferred library import."; 395 "needed for a given deferred library import.";
394 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); 396 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap());
395 compiler.outputProvider( 397 compiler.outputProvider(
396 compiler.options.deferredMapUri.path, '', OutputType.info) 398 compiler.options.deferredMapUri.path, '', OutputType.info)
397 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) 399 ..add(const JsonEncoder.withIndent(" ").convert(mapping))
398 ..close(); 400 ..close();
399 } 401 }
400 } 402 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698