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

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

Issue 2713393002: dart2js: HGetLength may become fixed (Closed)
Patch Set: Created 3 years, 10 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 2ac63daee04c0f4b8830ef960e51622d190b007b..5b617e2210d7a53b52fe9920c0f3e7443ca1dfea 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -903,10 +903,9 @@ class SsaInstructionSimplifier extends HBaseVisitor
if (type.isContainer && type.length != null) {
HInstruction constant = graph.addConstantInt(type.length, closedWorld);
if (type.isNullable) {
- // If the container can be null, we update all uses of the
- // length access to use the constant instead, but keep the
- // length access in the graph, to ensure we still have a
- // null check.
+ // If the container can be null, we update all uses of the length
+ // access to use the constant instead, but keep the length access in
+ // the graph, to ensure we still have a null check.
node.block.rewrite(node, constant);
return node;
} else {
@@ -914,6 +913,14 @@ class SsaInstructionSimplifier extends HBaseVisitor
}
}
}
+
+ if (node.isAssignable &&
+ isFixedLength(receiver.instructionType, closedWorld)) {
+ // The input type has changed to fixed-length so change to an unassignable
+ // HGetLength to allow more GVN optimizations.
+ return new HGetLength(receiver, node.instructionType,
+ isAssignable: false);
+ }
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