Index: pkg/compiler/lib/src/compiler.dart |
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
index d716c3e4eaf0e593ddf23b28f53a1cc77a066dd8..e1dc8cfb46a323b4a0f09cba434160ac9aa14e39 100644 |
--- a/pkg/compiler/lib/src/compiler.dart |
+++ b/pkg/compiler/lib/src/compiler.dart |
@@ -712,6 +712,7 @@ abstract class Compiler implements DiagnosticListener { |
final bool enableTypeAssertions; |
final bool enableUserAssertions; |
final bool trustTypeAnnotations; |
+ final bool computeAnalysisStats; |
final bool trustPrimitives; |
final bool enableConcreteTypeInference; |
final bool disableTypeInferenceFlag; |
@@ -742,7 +743,11 @@ abstract class Compiler implements DiagnosticListener { |
* If true, stop compilation after type inference is complete. Used for |
* debugging and testing purposes only. |
*/ |
- bool stopAfterTypeInference = false; |
+ bool stopAfterTypeInference = |
+ // TODO(sigmund): remove this initializer (currently |
+ // compute_analysis_stats is used to retreive data and stop after |
+ // inference.) |
+ const bool.fromEnvironment('compute_analysis_stats'); |
/** |
* If [:true:], comment tokens are collected in [commentMap] during scanning. |
@@ -968,6 +973,7 @@ abstract class Compiler implements DiagnosticListener { |
DeferredLoadTask deferredLoadTask; |
MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; |
DumpInfoTask dumpInfoTask; |
+ StatsBuilderTask statsBuilderTask; |
String buildId; |
/// A customizable filter that is applied to enqueued work items. |
@@ -1033,6 +1039,10 @@ abstract class Compiler implements DiagnosticListener { |
Compiler({this.enableTypeAssertions: false, |
this.enableUserAssertions: false, |
this.trustTypeAnnotations: false, |
+ // TODO(sigmund): eventually add a flag for this or merge with |
+ // DumpInfo |
+ this.computeAnalysisStats: |
+ const bool.fromEnvironment('compute_analysis_stats'), |
this.trustPrimitives: false, |
this.enableConcreteTypeInference: false, |
bool disableTypeInferenceFlag: false, |
@@ -1130,6 +1140,7 @@ abstract class Compiler implements DiagnosticListener { |
mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
enqueuer = new EnqueueTask(this), |
dumpInfoTask = new DumpInfoTask(this), |
+ statsBuilderTask = new StatsBuilderTask(this), |
reuseLibraryTask = new GenericTask('Reuse library', this), |
]; |
@@ -1518,6 +1529,7 @@ abstract class Compiler implements DiagnosticListener { |
}).then((_) { |
compileLoadedLibraries(); |
}); |
+ |
} |
void computeMain() { |
@@ -1657,6 +1669,8 @@ abstract class Compiler implements DiagnosticListener { |
log('Inferring types...'); |
typesTask.onResolutionComplete(mainFunction); |
+ statsBuilderTask.run(); |
+ |
if (stopAfterTypeInference) return; |
backend.onTypeInferenceComplete(); |