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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 abstract class HVisitor<R> { | 7 abstract class HVisitor<R> { |
8 R visitAdd(HAdd node); | 8 R visitAdd(HAdd node); |
9 R visitBailoutTarget(HBailoutTarget node); | 9 R visitBailoutTarget(HBailoutTarget node); |
10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 void assignDominators() { | 215 void assignDominators() { |
216 // Run through the blocks in order of increasing ids so we are | 216 // Run through the blocks in order of increasing ids so we are |
217 // guaranteed that we have computed dominators for all blocks | 217 // guaranteed that we have computed dominators for all blocks |
218 // higher up in the dominator tree. | 218 // higher up in the dominator tree. |
219 for (int i = 0, length = blocks.length; i < length; i++) { | 219 for (int i = 0, length = blocks.length; i < length; i++) { |
220 HBasicBlock block = blocks[i]; | 220 HBasicBlock block = blocks[i]; |
221 List<HBasicBlock> predecessors = block.predecessors; | 221 List<HBasicBlock> predecessors = block.predecessors; |
222 if (block.isLoopHeader()) { | 222 if (block.isLoopHeader()) { |
223 assert(predecessors.length >= 2); | |
224 block.assignCommonDominator(predecessors[0]); | 223 block.assignCommonDominator(predecessors[0]); |
225 } else { | 224 } else { |
226 for (int j = predecessors.length - 1; j >= 0; j--) { | 225 for (int j = predecessors.length - 1; j >= 0; j--) { |
227 block.assignCommonDominator(predecessors[j]); | 226 block.assignCommonDominator(predecessors[j]); |
228 } | 227 } |
229 } | 228 } |
230 } | 229 } |
231 } | 230 } |
232 | 231 |
233 bool isValid() { | 232 bool isValid() { |
(...skipping 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3002 HBasicBlock get start => expression.start; | 3001 HBasicBlock get start => expression.start; |
3003 HBasicBlock get end { | 3002 HBasicBlock get end { |
3004 // We don't create a switch block if there are no cases. | 3003 // We don't create a switch block if there are no cases. |
3005 assert(!statements.isEmpty); | 3004 assert(!statements.isEmpty); |
3006 return statements.last.end; | 3005 return statements.last.end; |
3007 } | 3006 } |
3008 | 3007 |
3009 bool accept(HStatementInformationVisitor visitor) => | 3008 bool accept(HStatementInformationVisitor visitor) => |
3010 visitor.visitSwitchInfo(this); | 3009 visitor.visitSwitchInfo(this); |
3011 } | 3010 } |
OLD | NEW |