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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart

Issue 807573003: Fix some bugs that blocked optimizations in the new IRs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 years, 11 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/tree_ir/optimization/statement_rewriter.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
index 4cc853c878f59dacfbea17a951d959d343450d67..f6eacc4a72a668e8ebc78c5844abf31f7c991e3b 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
@@ -189,16 +189,28 @@ class Builder extends cps_ir.Visitor<Node> {
body, initializers, node.localConstants, node.defaultParameterValues);
}
-
+ /// Returns a list of variables corresponding to the arguments to a method
+ /// call or similar construct.
+ ///
+ /// The `readCount` for these variables will be incremented.
+ ///
+ /// The list will be typed as a list of [Expression] to allow inplace updates
+ /// on the list during the rewrite phases.
List<Expression> translateArguments(List<cps_ir.Reference> args) {
return new List<Expression>.generate(args.length,
(int index) => getVariableReference(args[index]),
growable: false);
}
+ /// Returns the list of variables corresponding to the arguments to a join
+ /// continuation.
+ ///
+ /// The `readCount` of these variables will not be incremented. Instead,
+ /// [buildPhiAssignments] will handle the increment, if necessary.
List<Variable> translatePhiArguments(List<cps_ir.Reference> args) {
return new List<Variable>.generate(args.length,
- (int index) => getVariableReference(args[index]));
+ (int index) => getVariable(args[index].definition),
+ growable: false);
}
Statement buildContinuationAssignment(
@@ -247,6 +259,8 @@ class Builder extends cps_ir.Visitor<Node> {
Statement first, current;
void addAssignment(Variable dst, Variable src) {
+ ++src.readCount;
+ // `dst.writeCount` will be updated by the Assign constructor.
if (first == null) {
first = current = new Assign(dst, src, null);
} else {
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698