Skip to content

Commit 3c44a09

Browse files
committed
make kerneltask an actual task
[email protected] Review URL: https://codereview.chromium.org/2442503004 .
1 parent ce96359 commit 3c44a09

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

pkg/compiler/lib/src/js_backend/backend.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import 'constant_handler_javascript.dart';
7272
import 'custom_elements_analysis.dart';
7373
import 'enqueuer.dart';
7474
import 'js_interop_analysis.dart' show JsInteropAnalysis;
75-
import 'kernel_task.dart';
75+
import '../kernel/task.dart';
7676
import 'lookup_map_analysis.dart' show LookupMapAnalysis;
7777
import 'namer.dart';
7878
import 'native_data.dart' show NativeData;
@@ -476,6 +476,7 @@ class JavaScriptBackend extends Backend {
476476
List<CompilerTask> result = functionCompiler.tasks;
477477
result.add(emitter);
478478
result.add(patchResolverTask);
479+
result.add(kernelTask);
479480
return result;
480481
}
481482

@@ -629,7 +630,7 @@ class JavaScriptBackend extends Backend {
629630
jsInteropAnalysis = new JsInteropAnalysis(this);
630631

631632
noSuchMethodRegistry = new NoSuchMethodRegistry(this);
632-
kernelTask = new KernelTask(this);
633+
kernelTask = new KernelTask(compiler);
633634
constantCompilerTask = new JavaScriptConstantTask(compiler);
634635
impactTransformer = new JavaScriptImpactTransformer(this);
635636
patchResolverTask = new PatchResolverTask(compiler);

pkg/compiler/lib/src/js_backend/kernel_task.dart renamed to pkg/compiler/lib/src/kernel/task.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,35 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import '../compiler.dart';
65
import '../common/names.dart';
6+
import '../common/tasks.dart' show CompilerTask;
7+
import '../compiler.dart';
78
import '../elements/elements.dart';
8-
import '../kernel/kernel.dart';
9+
import 'kernel.dart';
910
import 'package:kernel/ast.dart' as ir;
1011

11-
import 'backend.dart';
12-
1312
/// Visits the compiler main function and builds the kernel representation.
1413
///
1514
/// This creates a mapping from kernel nodes to AST nodes to be used later.
16-
class KernelTask {
15+
class KernelTask extends CompilerTask {
16+
get name => "kernel";
17+
1718
final Compiler _compiler;
1819
final Kernel kernel;
1920

20-
KernelTask(JavaScriptBackend backend)
21-
: this._compiler = backend.compiler,
22-
this.kernel = new Kernel(backend.compiler);
21+
KernelTask(Compiler compiler)
22+
: this._compiler = compiler,
23+
this.kernel = new Kernel(compiler),
24+
super(compiler.measurer);
2325

2426
ir.Program program;
2527

2628
/// Builds the kernel IR for the main function.
2729
///
2830
/// May enqueue more elements to the resolution queue.
29-
void buildKernelIr() {
31+
void buildKernelIr() => measure(() {
3032
program = buildProgram(_compiler.mainApp);
31-
}
33+
});
3234

3335
/// Builds the kernel IR program for the main function exported from
3436
/// [library].

0 commit comments

Comments
 (0)