Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart |
| index b7ac48ed878caffb5d9ab201c12dc28fb7209306..b3af93804662c439460fa1194c687cc95d117809 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart |
| @@ -33,38 +33,39 @@ class IrBuilderTask extends CompilerTask { |
| ir.FunctionDefinition getIr(Element element) => nodes[element.implementation]; |
| - void buildNodes({bool useNewBackend: false}) { |
| - if (!irEnabled(useNewBackend: useNewBackend)) return; |
| + ir.FunctionDefinition buildNode(AstElement element) { |
| + if (!canBuild(element)) return null; |
| + TreeElements elementsMapping = element.resolvedAst.elements; |
| + element = element.implementation; |
| + return compiler.withCurrentElement(element, () { |
| + SourceFile sourceFile = elementSourceFile(element); |
| + IrBuilderVisitor builder = |
| + new IrBuilderVisitor(elementsMapping, compiler, sourceFile); |
| + ir.FunctionDefinition function; |
| + function = builder.buildFunction(element); |
| + |
| + return function; |
| + }); |
| + } |
| + |
| + void buildNodes() { |
| + if (!irEnabled()) return; |
|
floitsch
2014/11/13 14:30:55
We should not call `buildNodes` if we aren't inter
sigurdm
2014/11/13 14:43:41
Done.
|
| measure(() { |
| Set<Element> resolved = compiler.enqueuer.resolution.resolvedElements; |
| resolved.forEach((AstElement element) { |
| - if (canBuild(element)) { |
| - TreeElements elementsMapping = element.resolvedAst.elements; |
| - element = element.implementation; |
| - compiler.withCurrentElement(element, () { |
| - SourceFile sourceFile = elementSourceFile(element); |
| - IrBuilderVisitor builder = |
| - new IrBuilderVisitor(elementsMapping, compiler, sourceFile); |
| - ir.FunctionDefinition function; |
| - function = builder.buildFunction(element); |
| - |
| - if (function != null) { |
| - nodes[element] = function; |
| - compiler.tracer.traceCompilation(element.name, null); |
| - compiler.tracer.traceGraph("IR Builder", function); |
| - } |
| - }); |
| + ir.FunctionDefinition functionDefinition = buildNode(element); |
| + if (functionDefinition != null) { |
| + nodes[element] = functionDefinition; |
| } |
| }); |
| }); |
| } |
| - bool irEnabled({bool useNewBackend: false}) { |
| + bool irEnabled() { |
| // TODO(sigurdm,kmillikin): Support checked-mode checks. |
| - return (useNewBackend || const bool.fromEnvironment('USE_NEW_BACKEND')) && |
| - compiler.backend is DartBackend && |
| - !compiler.enableTypeAssertions && |
| - !compiler.enableConcreteTypeInference; |
| + return compiler.backend is DartBackend && |
| + !compiler.enableTypeAssertions && |
|
floitsch
2014/11/13 14:30:55
These checks should probably go to the compiler to
sigurdm
2014/11/13 14:43:41
TODO added
|
| + !compiler.enableConcreteTypeInference; |
| } |
| bool canBuild(Element element) { |