Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: pkg/compiler/lib/src/ssa/kernel_impact.dart

Issue 2324213003: build kernel for the entire program after resolution (Closed)
Patch Set: respond to comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/kernel_impact.dart
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart
index d4d161e8c5b79dc0857d1a416286c36131afbc13..30f66a53625d9a73e85ef0f75af659f0dfa3b336 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -22,22 +22,20 @@ import '../common/resolution.dart';
/// Computes the [ResolutionImpact] for [resolvedAst] through kernel.
ResolutionImpact build(Compiler compiler, ResolvedAst resolvedAst) {
AstElement element = resolvedAst.element.implementation;
- Kernel kernel = new Kernel(compiler);
- KernelVisitor visitor =
- new KernelVisitor(element, resolvedAst.elements, kernel);
- IrFunction function;
- try {
- function = visitor.buildFunction();
- } catch (e) {
- throw "Failed to convert to Kernel IR: $e";
- }
- KernelImpactBuilder builder = new KernelImpactBuilder(
- function, element, resolvedAst, compiler, visitor, kernel);
+ JavaScriptBackend backend = compiler.backend;
+ Kernel kernel = backend.kernelTask.kernel;
+ ir.Procedure function = kernel.functions[element];
+ if (function == null) {
+ print("FOUND NULL FUNCTION: $element");
+ print(kernel.functions);
+ }
+ KernelImpactBuilder builder =
+ new KernelImpactBuilder(function, element, resolvedAst, compiler, kernel);
return builder.build();
}
class KernelImpactBuilder extends ir.Visitor {
- final IrFunction function;
+ final ir.Procedure function;
final FunctionElement functionElement;
final ResolvedAst resolvedAst;
final Compiler compiler;
@@ -48,13 +46,13 @@ class KernelImpactBuilder extends ir.Visitor {
KernelAstAdapter astAdapter;
KernelImpactBuilder(this.function, this.functionElement, this.resolvedAst,
- this.compiler, KernelVisitor visitor, Kernel kernel) {
+ this.compiler, Kernel kernel) {
this.impactBuilder = new ResolutionWorldImpactBuilder('$functionElement');
this.astAdapter = new KernelAstAdapter(
compiler.backend,
resolvedAst,
- visitor.nodeToAst,
- visitor.nodeToElement,
+ kernel.nodeToAst,
+ kernel.nodeToElement,
kernel.functions,
kernel.classes,
kernel.libraries);
@@ -81,8 +79,8 @@ class KernelImpactBuilder extends ir.Visitor {
return type;
}
- void buildMethod(IrFunction method) {
- method.node.body.accept(this);
+ void buildMethod(ir.Procedure method) {
+ method.function.body.accept(this);
}
void visitNodes(Iterable<ir.Node> nodes) {
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698