| Index: pkg/compiler/lib/src/js_backend/codegen/task.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/codegen/task.dart b/pkg/compiler/lib/src/js_backend/codegen/task.dart
|
| index 4bae7de618247d09c78626fde586b6063623092d..96f998d3e9a0b50cc56524d9ba3af23c6a159afe 100644
|
| --- a/pkg/compiler/lib/src/js_backend/codegen/task.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/codegen/task.dart
|
| @@ -39,6 +39,7 @@ import '../../tree_ir/optimization/optimization.dart' as tree_opt;
|
| import '../../tree_ir/tree_ir_integrity.dart';
|
| import '../../cps_ir/cps_ir_nodes_sexpr.dart';
|
| import '../../cps_ir/type_mask_system.dart';
|
| +import '../../common/tasks.dart';
|
|
|
| class CpsFunctionCompiler implements FunctionCompiler {
|
| final ConstantSystem constantSystem;
|
| @@ -53,16 +54,23 @@ class CpsFunctionCompiler implements FunctionCompiler {
|
|
|
| Tracer get tracer => compiler.tracer;
|
|
|
| - IrBuilderTask get irBuilderTask => compiler.irBuilder;
|
| + final IrBuilderTask cpsBuilderTask;
|
| + final GenericTask cpsOptimizationTask;
|
| + final GenericTask treeBuilderTask;
|
| + final GenericTask treeOptimizationTask;
|
|
|
| CpsFunctionCompiler(Compiler compiler, JavaScriptBackend backend,
|
| SourceInformationStrategy sourceInformationFactory)
|
| : fallbackCompiler =
|
| new ssa.SsaFunctionCompiler(backend, sourceInformationFactory),
|
| + cpsBuilderTask = new IrBuilderTask(compiler, sourceInformationFactory),
|
| this.sourceInformationFactory = sourceInformationFactory,
|
| constantSystem = backend.constantSystem,
|
| compiler = compiler,
|
| - glue = new Glue(compiler);
|
| + glue = new Glue(compiler),
|
| + cpsOptimizationTask = new GenericTask('CPS optimization', compiler),
|
| + treeBuilderTask = new GenericTask('Tree builder', compiler),
|
| + treeOptimizationTask = new GenericTask('Tree optimization', compiler);
|
|
|
| String get name => 'CPS Ir pipeline';
|
|
|
| @@ -108,19 +116,21 @@ class CpsFunctionCompiler implements FunctionCompiler {
|
| }
|
|
|
| void applyCpsPass(cps_opt.Pass pass, cps.FunctionDefinition cpsFunction) {
|
| - pass.rewrite(cpsFunction);
|
| + cpsOptimizationTask.measureSubtask(pass.passName, () {
|
| + pass.rewrite(cpsFunction);
|
| + });
|
| traceGraph(pass.passName, cpsFunction);
|
| dumpTypedIr(pass.passName, cpsFunction);
|
| assert(checkCpsIntegrity(cpsFunction));
|
| }
|
|
|
| cps.FunctionDefinition compileToCpsIr(AstElement element) {
|
| - cps.FunctionDefinition cpsFunction = irBuilderTask.buildNode(element);
|
| + cps.FunctionDefinition cpsFunction = cpsBuilderTask.buildNode(element);
|
| if (cpsFunction == null) {
|
| - if (irBuilderTask.bailoutMessage == null) {
|
| + if (cpsBuilderTask.bailoutMessage == null) {
|
| giveUp('unable to build cps definition of $element');
|
| } else {
|
| - giveUp(irBuilderTask.bailoutMessage);
|
| + giveUp(cpsBuilderTask.bailoutMessage);
|
| }
|
| }
|
| traceGraph('IR Builder', cpsFunction);
|
| @@ -195,7 +205,8 @@ class CpsFunctionCompiler implements FunctionCompiler {
|
| tree_ir.FunctionDefinition compileToTreeIr(cps.FunctionDefinition cpsNode) {
|
| tree_builder.Builder builder = new tree_builder.Builder(
|
| compiler.internalError);
|
| - tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode);
|
| + tree_ir.FunctionDefinition treeNode =
|
| + treeBuilderTask.measure(() => builder.buildFunction(cpsNode));
|
| assert(treeNode != null);
|
| traceGraph('Tree builder', treeNode);
|
| assert(checkTreeIntegrity(treeNode));
|
| @@ -209,7 +220,9 @@ class CpsFunctionCompiler implements FunctionCompiler {
|
|
|
| tree_ir.FunctionDefinition optimizeTreeIr(tree_ir.FunctionDefinition node) {
|
| void applyTreePass(tree_opt.Pass pass) {
|
| - pass.rewrite(node);
|
| + treeOptimizationTask.measureSubtask(pass.passName, () {
|
| + pass.rewrite(node);
|
| + });
|
| traceGraph(pass.passName, node);
|
| assert(checkTreeIntegrity(node));
|
| }
|
| @@ -236,8 +249,12 @@ class CpsFunctionCompiler implements FunctionCompiler {
|
| }
|
|
|
| Iterable<CompilerTask> get tasks {
|
| - // TODO(sigurdm): Make a better list of tasks.
|
| - return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks);
|
| + return <CompilerTask>[
|
| + cpsBuilderTask,
|
| + cpsOptimizationTask,
|
| + treeBuilderTask,
|
| + treeOptimizationTask]
|
| + ..addAll(fallbackCompiler.tasks);
|
| }
|
|
|
| js.Node attachPosition(js.Node node, AstElement element) {
|
|
|