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

Side by Side Diff: pkg/compiler/lib/src/dump_info.dart

Issue 2647893002: Use entities in js_emitter/model.dart (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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart » ('j') | 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) 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 library dump_info; 5 library dump_info;
6 6
7 import 'dart:convert' 7 import 'dart:convert'
8 show ChunkedConversionSink, JsonEncoder, StringConversionSink; 8 show ChunkedConversionSink, JsonEncoder, StringConversionSink;
9 9
10 import 'package:dart2js_info/info.dart'; 10 import 'package:dart2js_info/info.dart';
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 ElementInfoCollector infoCollector; 384 ElementInfoCollector infoCollector;
385 385
386 /// The size of the generated output. 386 /// The size of the generated output.
387 int _programSize; 387 int _programSize;
388 388
389 // A set of javascript AST nodes that we care about the size of. 389 // A set of javascript AST nodes that we care about the size of.
390 // This set is automatically populated when registerElementAst() 390 // This set is automatically populated when registerElementAst()
391 // is called. 391 // is called.
392 final Set<jsAst.Node> _tracking = new Set<jsAst.Node>(); 392 final Set<jsAst.Node> _tracking = new Set<jsAst.Node>();
393 // A mapping from Dart Elements to Javascript AST Nodes. 393 // A mapping from Dart Elements to Javascript AST Nodes.
394 final Map<Element, List<jsAst.Node>> _elementToNodes = 394 final Map<Entity, List<jsAst.Node>> _elementToNodes =
395 <Element, List<jsAst.Node>>{}; 395 <Entity, List<jsAst.Node>>{};
396 final Map<ConstantValue, jsAst.Node> _constantToNode = 396 final Map<ConstantValue, jsAst.Node> _constantToNode =
397 <ConstantValue, jsAst.Node>{}; 397 <ConstantValue, jsAst.Node>{};
398 // A mapping from Javascript AST Nodes to the size of their 398 // A mapping from Javascript AST Nodes to the size of their
399 // pretty-printed contents. 399 // pretty-printed contents.
400 final Map<jsAst.Node, int> _nodeToSize = <jsAst.Node, int>{}; 400 final Map<jsAst.Node, int> _nodeToSize = <jsAst.Node, int>{};
401 401
402 final Map<Element, int> inlineCount = <Element, int>{}; 402 final Map<Element, int> inlineCount = <Element, int>{};
403 // A mapping from an element to a list of elements that are 403 // A mapping from an element to a list of elements that are
404 // inlined inside of it. 404 // inlined inside of it.
405 final Map<Element, List<Element>> inlineMap = <Element, List<Element>>{}; 405 final Map<Element, List<Element>> inlineMap = <Element, List<Element>>{};
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 bool isTracking(jsAst.Node code) { 466 bool isTracking(jsAst.Node code) {
467 if (compiler.options.dumpInfo) { 467 if (compiler.options.dumpInfo) {
468 return _tracking.contains(code); 468 return _tracking.contains(code);
469 } else { 469 } else {
470 return false; 470 return false;
471 } 471 }
472 } 472 }
473 473
474 // Registers that a javascript AST node `code` was produced by the 474 // Registers that a javascript AST node `code` was produced by the
475 // dart Element `element`. 475 // dart Element `element`.
476 void registerElementAst(Element element, jsAst.Node code) { 476 void registerElementAst(Entity element, jsAst.Node code) {
477 if (compiler.options.dumpInfo) { 477 if (compiler.options.dumpInfo) {
478 _elementToNodes 478 _elementToNodes
479 .putIfAbsent(element, () => new List<jsAst.Node>()) 479 .putIfAbsent(element, () => new List<jsAst.Node>())
480 .add(code); 480 .add(code);
481 _tracking.add(code); 481 _tracking.add(code);
482 } 482 }
483 } 483 }
484 484
485 void registerConstantAst(ConstantValue constant, jsAst.Node code) { 485 void registerConstantAst(ConstantValue constant, jsAst.Node code) {
486 if (compiler.options.dumpInfo) { 486 if (compiler.options.dumpInfo) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 600
601 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 601 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
602 new StringConversionSink.fromStringSink(buffer)); 602 new StringConversionSink.fromStringSink(buffer));
603 sink.add(new AllInfoJsonCodec().encode(result)); 603 sink.add(new AllInfoJsonCodec().encode(result));
604 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 604 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
605 'text': "View the dumped .info.json file at " 605 'text': "View the dumped .info.json file at "
606 "https://dart-lang.github.io/dump-info-visualizer" 606 "https://dart-lang.github.io/dump-info-visualizer"
607 }); 607 });
608 } 608 }
609 } 609 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698