Chromium Code Reviews| Index: lib/compiler/implementation/ssa/nodes.dart |
| =================================================================== |
| --- lib/compiler/implementation/ssa/nodes.dart (revision 10938) |
| +++ lib/compiler/implementation/ssa/nodes.dart (working copy) |
| @@ -932,16 +932,17 @@ |
| } |
| // Compute the set of users of this instruction that is dominated by |
| - // [other]. |
| - Set<HInstruction> dominatedUsers(HInstruction other) { |
| + // [other] or [otherBlock]. |
| + Set<HInstruction> dominatedUsers(HInstruction other, |
|
kasperl
2012/08/20 11:37:22
I'd prefer two different entry points for this:
|
| + [HBasicBlock otherBlock = null]) { |
| // Keep track of all instructions that we have to deal with later |
| // and count the number of them that are in the current block. |
| Set<HInstruction> users = new Set<HInstruction>(); |
| int usersInCurrentBlock = 0; |
| + if (otherBlock == null) otherBlock = other.block; |
| // Run through all the users and see if they are dominated or |
| - // potentially dominated by [other]. |
| - HBasicBlock otherBlock = other.block; |
| + // potentially dominated by [otherBlock]. |
|
kasperl
2012/08/20 11:37:22
Here you're adding all the users that are dominate
|
| for (int i = 0, length = usedBy.length; i < length; i++) { |
| HInstruction current = usedBy[i]; |
| if (current !== other && otherBlock.dominates(current.block)) { |
| @@ -950,7 +951,7 @@ |
| } |
| } |
| - // Run through all the phis in the same block as [other] and remove them |
| + // Run through all the phis in otherBlock and remove them |
| // from the users set. |
| if (usersInCurrentBlock > 0) { |
| for (HPhi phi = otherBlock.phis.first; phi !== null; phi = phi.next) { |
| @@ -961,9 +962,9 @@ |
| } |
| } |
| - // Run through all the instructions before [other] and remove them |
| + // Run through all the instructions before otherBlock and remove them |
|
kasperl
2012/08/20 11:37:22
This should still be all instructions before [othe
|
| // from the users set. |
| - if (usersInCurrentBlock > 0) { |
| + if (other != null && usersInCurrentBlock > 0) { |
| HInstruction current = otherBlock.first; |
| while (current !== other) { |
| if (users.contains(current)) { |