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

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

Issue 1803303002: Move all flags to CompilerOptions (first step to stop passing the compiler to (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/deferred_load.dart ('k') | pkg/compiler/lib/src/enqueue.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' show 7 import 'dart:convert' show
8 ChunkedConversionSink, 8 ChunkedConversionSink,
9 HtmlEscape, 9 HtmlEscape,
10 JsonEncoder, 10 JsonEncoder,
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 inlineMap.putIfAbsent(inlinedFrom, () => new List<Element>()); 424 inlineMap.putIfAbsent(inlinedFrom, () => new List<Element>());
425 inlineMap[inlinedFrom].add(element); 425 inlineMap[inlinedFrom].add(element);
426 } 426 }
427 427
428 final Map<Element, Set<Element>> _dependencies = {}; 428 final Map<Element, Set<Element>> _dependencies = {};
429 void registerDependency(Element source, Element target) { 429 void registerDependency(Element source, Element target) {
430 _dependencies.putIfAbsent(source, () => new Set()).add(target); 430 _dependencies.putIfAbsent(source, () => new Set()).add(target);
431 } 431 }
432 432
433 void registerImpact(Element element, WorldImpact impact) { 433 void registerImpact(Element element, WorldImpact impact) {
434 if (compiler.dumpInfo) { 434 if (compiler.options.dumpInfo) {
435 impacts[element] = impact; 435 impacts[element] = impact;
436 } 436 }
437 } 437 }
438 438
439 void unregisterImpact(Element element) { 439 void unregisterImpact(Element element) {
440 impacts.remove(element); 440 impacts.remove(element);
441 } 441 }
442 442
443 /** 443 /**
444 * Returns an iterable of [Selection]s that are used by 444 * Returns an iterable of [Selection]s that are used by
(...skipping 18 matching lines...) Expand all
463 selections.add(new Selection(staticUse.element, null)); 463 selections.add(new Selection(staticUse.element, null));
464 } 464 }
465 ), 465 ),
466 IMPACT_USE); 466 IMPACT_USE);
467 return selections; 467 return selections;
468 } 468 }
469 469
470 // Returns true if we care about tracking the size of 470 // Returns true if we care about tracking the size of
471 // this node. 471 // this node.
472 bool isTracking(jsAst.Node code) { 472 bool isTracking(jsAst.Node code) {
473 if (compiler.dumpInfo) { 473 if (compiler.options.dumpInfo) {
474 return _tracking.contains(code); 474 return _tracking.contains(code);
475 } else { 475 } else {
476 return false; 476 return false;
477 } 477 }
478 } 478 }
479 479
480 // Registers that a javascript AST node `code` was produced by the 480 // Registers that a javascript AST node `code` was produced by the
481 // dart Element `element`. 481 // dart Element `element`.
482 void registerElementAst(Element element, jsAst.Node code) { 482 void registerElementAst(Element element, jsAst.Node code) {
483 if (compiler.dumpInfo) { 483 if (compiler.options.dumpInfo) {
484 _elementToNodes 484 _elementToNodes
485 .putIfAbsent(element, () => new List<jsAst.Node>()) 485 .putIfAbsent(element, () => new List<jsAst.Node>())
486 .add(code); 486 .add(code);
487 _tracking.add(code); 487 _tracking.add(code);
488 } 488 }
489 } 489 }
490 490
491 void registerConstantAst(ConstantValue constant, jsAst.Node code) { 491 void registerConstantAst(ConstantValue constant, jsAst.Node code) {
492 if (compiler.dumpInfo) { 492 if (compiler.options.dumpInfo) {
493 assert(_constantToNode[constant] == null || 493 assert(_constantToNode[constant] == null ||
494 _constantToNode[constant] == code); 494 _constantToNode[constant] == code);
495 _constantToNode[constant] = code; 495 _constantToNode[constant] = code;
496 _tracking.add(code); 496 _tracking.add(code);
497 } 497 }
498 } 498 }
499 499
500 // Records the size of a dart AST node after it has been 500 // Records the size of a dart AST node after it has been
501 // pretty-printed into the output buffer. 501 // pretty-printed into the output buffer.
502 void recordAstSize(jsAst.Node node, int size) { 502 void recordAstSize(jsAst.Node node, int size) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 .map((o) => infoCollector._elementToInfo[o]) 587 .map((o) => infoCollector._elementToInfo[o])
588 .where((o) => o != null) 588 .where((o) => o != null)
589 .toList(); 589 .toList();
590 } 590 }
591 591
592 result.deferredFiles = compiler.deferredLoadTask.computeDeferredMap(); 592 result.deferredFiles = compiler.deferredLoadTask.computeDeferredMap();
593 stopwatch.stop(); 593 stopwatch.stop();
594 result.program = new ProgramInfo( 594 result.program = new ProgramInfo(
595 entrypoint: infoCollector._elementToInfo[compiler.mainFunction], 595 entrypoint: infoCollector._elementToInfo[compiler.mainFunction],
596 size: _programSize, 596 size: _programSize,
597 dart2jsVersion: compiler.hasBuildId ? compiler.buildId : null, 597 dart2jsVersion:
598 compiler.options.hasBuildId ? compiler.options.buildId : null,
598 compilationMoment: new DateTime.now(), 599 compilationMoment: new DateTime.now(),
599 compilationDuration: compiler.totalCompileTime.elapsed, 600 compilationDuration: compiler.totalCompileTime.elapsed,
600 toJsonDuration: stopwatch.elapsedMilliseconds, 601 toJsonDuration: stopwatch.elapsedMilliseconds,
601 dumpInfoDuration: this.timing, 602 dumpInfoDuration: this.timing,
602 noSuchMethodEnabled: compiler.backend.enabledNoSuchMethod, 603 noSuchMethodEnabled: compiler.backend.enabledNoSuchMethod,
603 minified: compiler.enableMinification); 604 minified: compiler.options.enableMinification);
604 605
605 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 606 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
606 new StringConversionSink.fromStringSink(buffer)); 607 new StringConversionSink.fromStringSink(buffer));
607 sink.add(new AllInfoJsonCodec().encode(result)); 608 sink.add(new AllInfoJsonCodec().encode(result));
608 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 609 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
609 'text': "View the dumped .info.json file at " 610 'text': "View the dumped .info.json file at "
610 "https://dart-lang.github.io/dump-info-visualizer" 611 "https://dart-lang.github.io/dump-info-visualizer"
611 }); 612 });
612 } 613 }
613 } 614 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698