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

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

Issue 2000323006: Make CompilerTask independent of compiler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // TODO(sigmund,het): move more features here. Ideally the dump-info task 361 // TODO(sigmund,het): move more features here. Ideally the dump-info task
362 // shouldn't reach into internals of other parts of the compiler. For example, 362 // shouldn't reach into internals of other parts of the compiler. For example,
363 // we currently reach into the full emitter and as a result we don't support 363 // we currently reach into the full emitter and as a result we don't support
364 // dump-info when using the startup-emitter (issue #24190). 364 // dump-info when using the startup-emitter (issue #24190).
365 abstract class InfoReporter { 365 abstract class InfoReporter {
366 void reportInlined(Element element, Element inlinedFrom); 366 void reportInlined(Element element, Element inlinedFrom);
367 } 367 }
368 368
369 class DumpInfoTask extends CompilerTask implements InfoReporter { 369 class DumpInfoTask extends CompilerTask implements InfoReporter {
370 static const ImpactUseCase IMPACT_USE = const ImpactUseCase('Dump info'); 370 static const ImpactUseCase IMPACT_USE = const ImpactUseCase('Dump info');
371 final Compiler compiler;
371 372
372 DumpInfoTask(Compiler compiler) : super(compiler); 373 DumpInfoTask(Compiler compiler)
374 : compiler = compiler,
375 super(compiler.measurer);
373 376
374 String get name => "Dump Info"; 377 String get name => "Dump Info";
375 378
376 ElementInfoCollector infoCollector; 379 ElementInfoCollector infoCollector;
377 380
378 /// The size of the generated output. 381 /// The size of the generated output.
379 int _programSize; 382 int _programSize;
380 383
381 // A set of javascript AST nodes that we care about the size of. 384 // A set of javascript AST nodes that we care about the size of.
382 // This set is automatically populated when registerElementAst() 385 // This set is automatically populated when registerElementAst()
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 compilationMoment: new DateTime.now(), 584 compilationMoment: new DateTime.now(),
582 compilationDuration: compiler.measurer.wallClock.elapsed, 585 compilationDuration: compiler.measurer.wallClock.elapsed,
583 toJsonDuration: stopwatch.elapsedMilliseconds, 586 toJsonDuration: stopwatch.elapsedMilliseconds,
584 dumpInfoDuration: this.timing, 587 dumpInfoDuration: this.timing,
585 noSuchMethodEnabled: compiler.backend.enabledNoSuchMethod, 588 noSuchMethodEnabled: compiler.backend.enabledNoSuchMethod,
586 minified: compiler.options.enableMinification); 589 minified: compiler.options.enableMinification);
587 590
588 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 591 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
589 new StringConversionSink.fromStringSink(buffer)); 592 new StringConversionSink.fromStringSink(buffer));
590 sink.add(new AllInfoJsonCodec().encode(result)); 593 sink.add(new AllInfoJsonCodec().encode(result));
591 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 594 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
592 'text': "View the dumped .info.json file at " 595 'text': "View the dumped .info.json file at "
593 "https://dart-lang.github.io/dump-info-visualizer" 596 "https://dart-lang.github.io/dump-info-visualizer"
594 }); 597 });
595 } 598 }
596 } 599 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698