Index: pkg/compiler/lib/src/ssa/ssa.dart |
diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart |
index ba197d12af9873c12ad2612799e0473dfeb92b79..947ea6ef29c496b9aea228e38f2e4384c925c49b 100644 |
--- a/pkg/compiler/lib/src/ssa/ssa.dart |
+++ b/pkg/compiler/lib/src/ssa/ssa.dart |
@@ -26,11 +26,14 @@ class SsaFunctionCompiler implements FunctionCompiler { |
SsaFunctionCompiler(JavaScriptBackend backend, Measurer measurer, |
SourceInformationStrategy sourceInformationFactory) |
: generator = new SsaCodeGeneratorTask(backend, sourceInformationFactory), |
- _builder = backend.compiler.backendStrategy |
- .createSsaBuilderTask(backend, sourceInformationFactory), |
+ _builder = new SsaBuilderTask(backend, sourceInformationFactory), |
optimizer = new SsaOptimizerTask(backend), |
backend = backend; |
+ void onCodegenStart() { |
+ _builder.onCodegenStart(); |
+ } |
+ |
/// Generates JavaScript code for `work.element`. |
/// Using the ssa builder, optimizer and codegenerator. |
js.Fun compile(CodegenWorkItem work, ClosedWorld closedWorld) { |
@@ -52,8 +55,28 @@ class SsaFunctionCompiler implements FunctionCompiler { |
} |
} |
-abstract class SsaBuilderTask implements CompilerTask { |
+abstract class SsaBuilder { |
/// Creates the [HGraph] for [work] or returns `null` if no code is needed |
/// for [work]. |
HGraph build(CodegenWorkItem work, ClosedWorld closedWorld); |
} |
+ |
+class SsaBuilderTask extends CompilerTask { |
+ final JavaScriptBackend _backend; |
+ final SourceInformationStrategy _sourceInformationFactory; |
+ SsaBuilder _builder; |
+ |
+ SsaBuilderTask(this._backend, this._sourceInformationFactory) |
+ : super(_backend.compiler.measurer); |
+ |
+ void onCodegenStart() { |
+ _builder = _backend.compiler.backendStrategy |
+ .createSsaBuilder(this, _backend, _sourceInformationFactory); |
+ } |
+ |
+ /// Creates the [HGraph] for [work] or returns `null` if no code is needed |
+ /// for [work]. |
+ HGraph build(CodegenWorkItem work, ClosedWorld closedWorld) { |
+ return _builder.build(work, closedWorld); |
+ } |
+} |