| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 interface HVisitor<R> { | 5 interface HVisitor<R> { |
| 6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
| 7 R visitBailoutTarget(HBailoutTarget node); | 7 R visitBailoutTarget(HBailoutTarget node); |
| 8 R visitBitAnd(HBitAnd node); | 8 R visitBitAnd(HBitAnd node); |
| 9 R visitBitNot(HBitNot node); | 9 R visitBitNot(HBitNot node); |
| 10 R visitBitOr(HBitOr node); | 10 R visitBitOr(HBitOr node); |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 // potentially dominated by [other]. | 956 // potentially dominated by [other]. |
| 957 HBasicBlock otherBlock = other.block; | 957 HBasicBlock otherBlock = other.block; |
| 958 for (int i = 0, length = usedBy.length; i < length; i++) { | 958 for (int i = 0, length = usedBy.length; i < length; i++) { |
| 959 HInstruction current = usedBy[i]; | 959 HInstruction current = usedBy[i]; |
| 960 if (current !== other && otherBlock.dominates(current.block)) { | 960 if (current !== other && otherBlock.dominates(current.block)) { |
| 961 if (current.block === otherBlock) usersInCurrentBlock++; | 961 if (current.block === otherBlock) usersInCurrentBlock++; |
| 962 users.add(current); | 962 users.add(current); |
| 963 } | 963 } |
| 964 } | 964 } |
| 965 | 965 |
| 966 // Run through all the phis in the same block as [other] and remove them |
| 967 // from the users set. |
| 968 if (usersInCurrentBlock > 0) { |
| 969 for (HPhi phi = otherBlock.phis.first; phi !== null; phi = phi.next) { |
| 970 if (users.contains(phi)) { |
| 971 users.remove(phi); |
| 972 if (--usersInCurrentBlock == 0) break; |
| 973 } |
| 974 } |
| 975 } |
| 976 |
| 966 // Run through all the instructions before [other] and remove them | 977 // Run through all the instructions before [other] and remove them |
| 967 // from the users set. | 978 // from the users set. |
| 968 if (usersInCurrentBlock > 0) { | 979 if (usersInCurrentBlock > 0) { |
| 969 HInstruction current = otherBlock.first; | 980 HInstruction current = otherBlock.first; |
| 970 while (current !== other) { | 981 while (current !== other) { |
| 971 if (users.contains(current)) { | 982 if (users.contains(current)) { |
| 972 users.remove(current); | 983 users.remove(current); |
| 973 if (--usersInCurrentBlock == 0) break; | 984 if (--usersInCurrentBlock == 0) break; |
| 974 } | 985 } |
| 975 current = current.next; | 986 current = current.next; |
| (...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 HBasicBlock get start() => expression.start; | 2694 HBasicBlock get start() => expression.start; |
| 2684 HBasicBlock get end() { | 2695 HBasicBlock get end() { |
| 2685 // We don't create a switch block if there are no cases. | 2696 // We don't create a switch block if there are no cases. |
| 2686 assert(!statements.isEmpty()); | 2697 assert(!statements.isEmpty()); |
| 2687 return statements.last().end; | 2698 return statements.last().end; |
| 2688 } | 2699 } |
| 2689 | 2700 |
| 2690 bool accept(HStatementInformationVisitor visitor) => | 2701 bool accept(HStatementInformationVisitor visitor) => |
| 2691 visitor.visitSwitchInfo(this); | 2702 visitor.visitSwitchInfo(this); |
| 2692 } | 2703 } |
| OLD | NEW |