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

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

Issue 2283443002: Make LocalsHandler depend on GraphBuilder instead of SsaBuilder. (Closed)
Patch Set: fix tests Created 4 years, 4 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.dart ('k') | pkg/compiler/lib/src/ssa/graph_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 1f338dcfdd1a1fe6d3feaf77d4096416fbf0e035..72f81606dec5fb142e2f68012154a04d1a7de506 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -14,6 +14,7 @@ import '../kernel/kernel.dart';
import '../kernel/kernel_visitor.dart';
import '../resolution/tree_elements.dart';
import 'graph_builder.dart';
+import 'locals_handler.dart';
import 'nodes.dart';
class SsaKernelBuilderTask extends CompilerTask {
@@ -38,8 +39,8 @@ class SsaKernelBuilderTask extends CompilerTask {
} catch (e) {
throw "Failed to convert to Kernel IR: $e";
}
- KernelSsaBuilder builder =
- new KernelSsaBuilder(function, element, backend.compiler);
+ KernelSsaBuilder builder = new KernelSsaBuilder(function, element,
+ work.resolvedAst, backend.compiler, sourceInformationFactory);
return builder.build();
});
}
@@ -53,13 +54,29 @@ class SsaKernelBuilderTask extends CompilerTask {
class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
final IrFunction function;
final FunctionElement functionElement;
+ final ResolvedAst resolvedAst;
final Compiler compiler;
- KernelSsaBuilder(this.function, this.functionElement, this.compiler);
+ JavaScriptBackend get backend => compiler.backend;
+
+ LocalsHandler localsHandler;
+ SourceInformationBuilder sourceInformationBuilder;
+
+ KernelSsaBuilder(this.function, this.functionElement, this.resolvedAst,
+ this.compiler, SourceInformationStrategy sourceInformationFactory) {
+ graph.element = functionElement;
+ // TODO(het): Should sourceInformationBuilder be in GraphBuilder?
+ this.sourceInformationBuilder =
+ sourceInformationFactory.createBuilderForContext(resolvedAst);
+ graph.sourceInformation =
+ sourceInformationBuilder.buildVariableDeclaration();
+ this.localsHandler =
+ new LocalsHandler(this, functionElement, null, compiler);
+ }
HGraph build() {
if (function.kind == ir.ProcedureKind.Method) {
- buildMethod(function);
+ buildMethod(function, functionElement);
} else {
compiler.reporter.internalError(
functionElement,
@@ -71,16 +88,17 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
}
/// Builds a SSA graph for [method].
- void buildMethod(IrFunction method) {
+ void buildMethod(IrFunction method, FunctionElement functionElement) {
// TODO(het): Determine whether or not this method is called in a loop and
- // set [graph.isCalledInLoop].
- openFunction(method);
+ // set [graph.isCalledInLoop].
+ openFunction(method, functionElement);
}
- void openFunction(IrFunction method) {
+ void openFunction(IrFunction method, FunctionElement functionElement) {
HBasicBlock block = graph.addNewBlock();
open(graph.entry);
// TODO(het): Register parameters with a locals handler
+ localsHandler.startFunction(functionElement, resolvedAst.node);
close(new HGoto()).addSuccessor(block);
open(block);
@@ -89,6 +107,5 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
// enclosing class as parameters to the method. This must be done before
// adding normal parameters because their types may contain references to
// the class type parameters.
-
}
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/graph_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698