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

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

Issue 10696120: Fix very subtle bug in HNode.changeUse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 5 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 | tests/language/partial_min_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/nodes.dart
diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
index 0e075d89c0d78aa0e2e4026d2deb1ba016b51a3f..b9e714af9bca5ff5089d28927d7fcd448881f4bf 100644
--- a/lib/compiler/implementation/ssa/nodes.dart
+++ b/lib/compiler/implementation/ssa/nodes.dart
@@ -931,10 +931,13 @@ class HInstruction implements Hashable {
}
}
List<HInstruction> oldInputUsers = oldInput.usedBy;
- for (int i = 0; i < oldInputUsers.length; i++) {
+ int i = 0;
+ while (i < oldInputUsers.length) {
if (oldInputUsers[i] == this) {
oldInputUsers[i] = oldInputUsers[oldInput.usedBy.length - 1];
- oldInputUsers.length = oldInputUsers.length - 1;
+ oldInputUsers.length--;
+ } else {
+ i++;
}
}
}
@@ -949,11 +952,11 @@ class HInstruction implements Hashable {
// Run through all the users and see if they are dominated or
// potentially dominated by [other].
- HBasicBlock block = other.block;
+ HBasicBlock otherBlock = other.block;
for (int i = 0, length = usedBy.length; i < length; i++) {
HInstruction current = usedBy[i];
- if (current !== other && block.dominates(current.block)) {
- if (current.block === block) usersInCurrentBlock++;
+ if (current !== other && otherBlock.dominates(current.block)) {
+ if (current.block === otherBlock) usersInCurrentBlock++;
users.add(current);
}
}
@@ -961,7 +964,7 @@ class HInstruction implements Hashable {
// Run through all the instructions before [other] and remove them
// from the users set.
if (usersInCurrentBlock > 0) {
- HInstruction current = block.first;
+ HInstruction current = otherBlock.first;
while (current !== other) {
if (users.contains(current)) {
users.remove(current);
« no previous file with comments | « no previous file | tests/language/partial_min_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698