From 3c44a09882da992eef1d0a0da66b7588a7baf99b Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Thu, 20 Oct 2016 16:27:33 -0700 Subject: [PATCH] make kerneltask an actual task R=het@google.com Review URL: https://codereview.chromium.org/2442503004 . --- pkg/compiler/lib/src/js_backend/backend.dart | 5 +++-- .../kernel_task.dart => kernel/task.dart} | 22 ++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) rename pkg/compiler/lib/src/{js_backend/kernel_task.dart => kernel/task.dart} (77%) diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart index 6ac1c1565c3..5b843feaa59 100644 --- a/pkg/compiler/lib/src/js_backend/backend.dart +++ b/pkg/compiler/lib/src/js_backend/backend.dart @@ -72,7 +72,7 @@ import 'constant_handler_javascript.dart'; import 'custom_elements_analysis.dart'; import 'enqueuer.dart'; import 'js_interop_analysis.dart' show JsInteropAnalysis; -import 'kernel_task.dart'; +import '../kernel/task.dart'; import 'lookup_map_analysis.dart' show LookupMapAnalysis; import 'namer.dart'; import 'native_data.dart' show NativeData; @@ -476,6 +476,7 @@ class JavaScriptBackend extends Backend { List result = functionCompiler.tasks; result.add(emitter); result.add(patchResolverTask); + result.add(kernelTask); return result; } @@ -629,7 +630,7 @@ class JavaScriptBackend extends Backend { jsInteropAnalysis = new JsInteropAnalysis(this); noSuchMethodRegistry = new NoSuchMethodRegistry(this); - kernelTask = new KernelTask(this); + kernelTask = new KernelTask(compiler); constantCompilerTask = new JavaScriptConstantTask(compiler); impactTransformer = new JavaScriptImpactTransformer(this); patchResolverTask = new PatchResolverTask(compiler); diff --git a/pkg/compiler/lib/src/js_backend/kernel_task.dart b/pkg/compiler/lib/src/kernel/task.dart similarity index 77% rename from pkg/compiler/lib/src/js_backend/kernel_task.dart rename to pkg/compiler/lib/src/kernel/task.dart index 9f0c0d919b3..59cf0b4ea9e 100644 --- a/pkg/compiler/lib/src/js_backend/kernel_task.dart +++ b/pkg/compiler/lib/src/kernel/task.dart @@ -2,33 +2,35 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import '../compiler.dart'; import '../common/names.dart'; +import '../common/tasks.dart' show CompilerTask; +import '../compiler.dart'; import '../elements/elements.dart'; -import '../kernel/kernel.dart'; +import 'kernel.dart'; import 'package:kernel/ast.dart' as ir; -import 'backend.dart'; - /// Visits the compiler main function and builds the kernel representation. /// /// This creates a mapping from kernel nodes to AST nodes to be used later. -class KernelTask { +class KernelTask extends CompilerTask { + get name => "kernel"; + final Compiler _compiler; final Kernel kernel; - KernelTask(JavaScriptBackend backend) - : this._compiler = backend.compiler, - this.kernel = new Kernel(backend.compiler); + KernelTask(Compiler compiler) + : this._compiler = compiler, + this.kernel = new Kernel(compiler), + super(compiler.measurer); ir.Program program; /// Builds the kernel IR for the main function. /// /// May enqueue more elements to the resolution queue. - void buildKernelIr() { + void buildKernelIr() => measure(() { program = buildProgram(_compiler.mainApp); - } + }); /// Builds the kernel IR program for the main function exported from /// [library].