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

Unified Diff: pkg/compiler/lib/src/library_loader.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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/library_loader.dart
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index d555a732d7a55fbffbcd90aba79e7a4f43b8d3f1..41a47a16a39351c1b8ce5f1627b771ba5010302d 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -7,7 +7,7 @@ library dart2js.library_loader;
import 'dart:async';
import 'common/names.dart' show Uris;
-import 'common/tasks.dart' show CompilerTask;
+import 'common/tasks.dart' show CompilerTask, GenericTask;
import 'common.dart';
import 'compiler.dart' show Compiler;
import 'elements/elements.dart'
@@ -297,10 +297,13 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
/// conditional imports.
final Environment environment;
+ final Compiler compiler;
+ DiagnosticReporter get reporter => compiler.reporter;
+
_LibraryLoaderTask(Compiler compiler, this.uriTranslator, this.scriptLoader,
this.scanner, this.deserializer, this.listener, this.environment)
- // TODO(sigmund): make measurements separate from compiler
- : super(compiler);
+ : compiler = compiler,
+ super(compiler.measurer);
String get name => 'LibraryLoader';
@@ -325,8 +328,7 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
Iterable<LibraryElement> reusedLibraries = null;
if (reuseLibrary != null) {
- // TODO(sigmund): make measurements separate from compiler
- reusedLibraries = compiler.reuseLibraryTask.measure(() {
+ reusedLibraries = measureSubtask(_reuseLibrarySubtaskName, () {
// Call [toList] to force eager calls to [reuseLibrary].
return libraryCanonicalUriMap.values.where(reuseLibrary).toList();
});
@@ -364,8 +366,7 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
}
List<Future<LibraryElement>> reusedLibrariesFuture =
- // TODO(sigmund): make measurements separate from compiler
- compiler.reuseLibraryTask.measure(
+ measureSubtask(_reuseLibrarySubtaskName,
() => libraryCanonicalUriMap.values.map(wrapper).toList());
return Future
@@ -380,7 +381,7 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
Future<Iterable<LibraryElement>> reuseLibraries(
Iterable<LibraryElement> libraries)) {
assert(currentHandler == null);
- return compiler.reuseLibraryTask.measure(() {
+ return measureSubtask(_reuseLibrarySubtaskName, () {
return new Future<Iterable<LibraryElement>>(() {
// Wrap in Future to shield against errors in user code.
return reuseLibraries(libraryCanonicalUriMap.values);
@@ -1508,3 +1509,5 @@ abstract class LibraryLoaderListener {
/// Called whenever a library is scanned from a script file.
Future onLibraryScanned(LibraryElement library, LibraryLoader loader);
}
+
+const _reuseLibrarySubtaskName = "Reuse library";

Powered by Google App Engine
This is Rietveld 408576698