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

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

Issue 1973213002: Online 'SSA conversion' of mutable parameters. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: rebase 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/optimize.dart
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 80f5e169eb359b8e6dd7830d66c080224813a068..17cd6d6a7f1a01199b1d5567b44f478dbd8c792f 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -247,9 +247,26 @@ class SsaInstructionSimplifier extends HBaseVisitor
}
HInstruction visitParameterValue(HParameterValue node) {
+ // [HParameterValue]s are either the value of the parameter (in fully SSA
+ // converted code), or the mutable variable containing the value (in
+ // incompletely SSA converted code, e.g. methods containing exceptions).
+ //
// If the parameter is used as a mutable variable we cannot replace the
// variable with a value.
- if (node.usedAsVariable()) return node;
+ //
+ // If the parameter is used as a mutable variable but never written, first
+ // convert to a value parameter.
+
+ if (node.usedAsVariable()) {
+ if (!node.usedBy.every((user) => user is HLocalGet)) return node;
+ // Trivial SSA-conversion. Replace all HLocalGet instructions with the
+ // parameter.
+ for (HLocalGet user in node.usedBy.toList()) {
+ user.block.rewrite(user, node);
+ user.block.remove(user);
+ }
+ }
+
propagateConstantValueToUses(node);
return node;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698