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

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

Issue 2360673003: kernel->ssa: Implement for-loops and while-loops (Closed)
Patch Set: 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') | pkg/compiler/lib/src/ssa/jump_handler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/graph_builder.dart
diff --git a/pkg/compiler/lib/src/ssa/graph_builder.dart b/pkg/compiler/lib/src/ssa/graph_builder.dart
index f7578f37c3ad1e10a755e8431bf0bd314c3b37b0..9898c6a96212c2b817c851af41b88b54a2160bbc 100644
--- a/pkg/compiler/lib/src/ssa/graph_builder.dart
+++ b/pkg/compiler/lib/src/ssa/graph_builder.dart
@@ -2,9 +2,12 @@
// 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 '../elements/elements.dart';
+import '../resolution/tree_elements.dart';
import '../types/types.dart';
+import 'jump_handler.dart';
import 'locals_handler.dart';
import 'nodes.dart';
@@ -16,6 +19,13 @@ abstract class GraphBuilder {
/// Holds the resulting SSA graph.
final HGraph graph = new HGraph();
+ // TODO(het): remove this
+ /// A reference to the compiler.
+ Compiler compiler;
+
+ /// The tree elements for the element being built into an SSA graph.
+ TreeElements get elements;
+
/// Used to track the locals while building the graph.
LocalsHandler localsHandler;
@@ -24,6 +34,15 @@ abstract class GraphBuilder {
/// We build the SSA graph by simulating a stack machine.
List<HInstruction> stack = <HInstruction>[];
+ /// The count of nested loops we are currently building.
+ ///
+ /// The loop nesting is consulted when inlining a function invocation. The
+ /// inlining heuristics take this information into account.
+ int loopDepth = 0;
+
+ /// A mapping from jump targets to their handlers.
+ Map<JumpTarget, JumpHandler> jumpTargets = <JumpTarget, JumpHandler>{};
+
void push(HInstruction instruction) {
add(instruction);
stack.add(instruction);
@@ -133,4 +152,14 @@ abstract class GraphBuilder {
lastAddedParameter = result;
return result;
}
+
+ HSubGraphBlockInformation wrapStatementGraph(SubGraph statements) {
+ if (statements == null) return null;
+ return new HSubGraphBlockInformation(statements);
+ }
+
+ HSubExpressionBlockInformation wrapExpressionGraph(SubExpression expression) {
+ if (expression == null) return null;
+ return new HSubExpressionBlockInformation(expression);
+ }
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | pkg/compiler/lib/src/ssa/jump_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698