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

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

Issue 1617083002: Base JavaScript code position computation on JavaScript tracer. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 /// Represents an entry's position in one of the global metadata arrays. 7 /// Represents an entry's position in one of the global metadata arrays.
8 /// 8 ///
9 /// [_rc] is used to count the number of references of the token in the 9 /// [_rc] is used to count the number of references of the token in the
10 /// ast for a program. 10 /// ast for a program.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 jsAst.Expression reifyExpression(jsAst.Expression expression) { 222 jsAst.Expression reifyExpression(jsAst.Expression expression) {
223 return _addGlobalMetadata(expression); 223 return _addGlobalMetadata(expression);
224 } 224 }
225 225
226 Placeholder getMetadataPlaceholder([debug]) { 226 Placeholder getMetadataPlaceholder([debug]) {
227 return new _ForwardingMetadataEntry(debug); 227 return new _ForwardingMetadataEntry(debug);
228 } 228 }
229 229
230 _MetadataEntry _addGlobalMetadata(jsAst.Node node) { 230 _MetadataEntry _addGlobalMetadata(jsAst.Node node) {
231 String nameToKey(jsAst.Name name) => "${name.key}"; 231 String nameToKey(jsAst.Name name) => "${name.key}";
232 String printed = jsAst.prettyPrint(node, _compiler, 232 String printed = jsAst.prettyPrint(
233 renamerForNames: nameToKey) 233 node, _compiler, renamerForNames: nameToKey);
234 .getText();
235 return _globalMetadataMap.putIfAbsent(printed, () { 234 return _globalMetadataMap.putIfAbsent(printed, () {
236 _BoundMetadataEntry result = new _BoundMetadataEntry(node); 235 _BoundMetadataEntry result = new _BoundMetadataEntry(node);
237 if (_compiler.hasIncrementalSupport) { 236 if (_compiler.hasIncrementalSupport) {
238 result.finalize(_globalMetadataCounter++); 237 result.finalize(_globalMetadataCounter++);
239 } 238 }
240 return result; 239 return result;
241 }); 240 });
242 } 241 }
243 242
244 jsAst.Expression _computeTypeRepresentation(DartType type, 243 jsAst.Expression _computeTypeRepresentation(DartType type,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 if (token is _ForwardingMetadataEntry && !token.isBound) { 359 if (token is _ForwardingMetadataEntry && !token.isBound) {
361 _foundUnboundToken = true; 360 _foundUnboundToken = true;
362 } 361 }
363 } 362 }
364 363
365 bool findUnboundPlaceholders(jsAst.Node node) { 364 bool findUnboundPlaceholders(jsAst.Node node) {
366 node.accept(this); 365 node.accept(this);
367 return _foundUnboundToken; 366 return _foundUnboundToken;
368 } 367 }
369 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698