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

Unified Diff: lib/compiler/implementation/ssa/variable_allocator.dart

Issue 10559081: Reapply: Use GVN for length loads from arrays and strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix type annotation on dataEquals argument Created 8 years, 6 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 | « lib/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/variable_allocator.dart
diff --git a/lib/compiler/implementation/ssa/variable_allocator.dart b/lib/compiler/implementation/ssa/variable_allocator.dart
index 927448e5551895b180b20ddee0f036b797befd2c..a3dfc47a3b4d09e151ec92a42da3cda5c91f40ec 100644
--- a/lib/compiler/implementation/ssa/variable_allocator.dart
+++ b/lib/compiler/implementation/ssa/variable_allocator.dart
@@ -22,7 +22,7 @@ class LiveRange {
*/
class LiveInterval {
/**
- * The id where there instruction is defined.
+ * The id where the instruction is defined.
*/
int start;
final List<LiveRange> ranges;
@@ -138,7 +138,7 @@ class LiveEnvironment {
* already in the set, we save the id where it dies.
*/
void add(HInstruction instruction, int userId) {
- // Note that we are visiting the grap in post-dominator order, so
+ // Note that we are visiting the graph in post-dominator order, so
// the first time we see a variable is when it dies.
liveInstructions.putIfAbsent(instruction, () => userId);
if (instruction is HCheck) {
@@ -589,12 +589,22 @@ class SsaVariableAllocator extends HBaseVisitor {
}
void handleInstruction(HInstruction instruction, VariableNamer namer) {
- for (int i = 0, len = instruction.inputs.length; i < len; i++) {
- HInstruction input = instruction.inputs[i];
- // If [input] has a name, and its use here is the last use, free
- // its name.
- if (needsName(input) && diesAt(input, instruction)) {
- namer.freeName(input);
+ // TODO(ager): We cannot perform this check to free names for
+ // HCheck instructions because they are special cased to have the
+ // same live intervals as the instruction they are checking. This
+ // includes sharing the start id with the checked
+ // input. Therefore, for HCheck(checkedInput, otherInput) we would
+ // end up checking that otherInput dies not here, but at the
+ // location of checkedInput. We should preserve the start id for
+ // the check instruction.
+ if (instruction is! HCheck) {
+ for (int i = 0, len = instruction.inputs.length; i < len; i++) {
+ HInstruction input = instruction.inputs[i];
+ // If [input] has a name, and its use here is the last use, free
+ // its name.
+ if (needsName(input) && diesAt(input, instruction)) {
+ namer.freeName(input);
+ }
}
}
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698