Index: dart/site/try/poi/poi.dart |
diff --git a/dart/site/try/poi/poi.dart b/dart/site/try/poi/poi.dart |
index d7ae82d33a22666a1c4d8b90cd22cca37a06fd53..70e726dd6ae1f4ac19549fe04a290f967c1fabd2 100644 |
--- a/dart/site/try/poi/poi.dart |
+++ b/dart/site/try/poi/poi.dart |
@@ -26,6 +26,7 @@ import 'package:compiler/compiler.dart' as api; |
import 'package:compiler/implementation/dart2jslib.dart' show |
Compiler, |
+ CompilerTask, |
Enqueuer, |
QueueFilter, |
WorkItem; |
@@ -95,6 +96,8 @@ const bool PRINT_SCOPE_INFO = |
Stopwatch wallClock = new Stopwatch(); |
+PoiTask poiTask; |
+ |
Compiler cachedCompiler; |
/// Iterator for reading lines from [io.stdin]. |
@@ -370,6 +373,9 @@ Future<Element> runPoi( |
LibraryUpdater updater = |
new LibraryUpdater( |
cachedCompiler, inputProvider, script, printWallClock, printVerbose); |
+ Future<bool> reuseLibrary(LibraryElement library) { |
+ return poiTask.measure(() => updater.reuseLibrary(library)); |
+ } |
return reuseCompiler( |
diagnosticHandler: handler, |
@@ -379,7 +385,7 @@ Future<Element> runPoi( |
libraryRoot: libraryRoot, |
packageRoot: packageRoot, |
packagesAreImmutable: true, |
- reuseLibrary: updater.reuseLibrary).then((Compiler newCompiler) { |
+ reuseLibrary: reuseLibrary).then((Compiler newCompiler) { |
var filter = new ScriptOnlyFilter(script); |
newCompiler.enqueuerFilter = filter; |
return runPoiInternal(newCompiler, updater, position); |
@@ -390,7 +396,12 @@ Future<Element> runPoiInternal( |
Compiler newCompiler, |
LibraryUpdater updater, |
int position) { |
+ |
cachedCompiler = newCompiler; |
+ if (poiTask == null || poiTask.compiler != cachedCompiler) { |
+ poiTask = new PoiTask(cachedCompiler); |
+ cachedCompiler.tasks.add(poiTask); |
+ } |
Future<bool> compilation = cachedCompiler.run(updater.uri); |
@@ -725,3 +736,9 @@ modelx.ScopeX localScope(modelx.LibraryElementX element) => element.localScope; |
modelx.ImportScope importScope(modelx.LibraryElementX element) { |
return element.importScope; |
} |
+ |
+class PoiTask extends CompilerTask { |
+ PoiTask(Compiler compiler) : super(compiler); |
+ |
+ String get name => 'POI'; |
+} |