| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 visitBitAnd(HBitAnd node); | 7 R visitBitAnd(HBitAnd node); |
| 8 R visitBitNot(HBitNot node); | 8 R visitBitNot(HBitNot node); |
| 9 R visitBitOr(HBitOr node); | 9 R visitBitOr(HBitOr node); |
| 10 R visitBitXor(HBitXor node); | 10 R visitBitXor(HBitXor node); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 currentBlock = node; | 108 currentBlock = node; |
| 109 visitInstructionList(node); | 109 visitInstructionList(node); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 class HGraph { | 113 class HGraph { |
| 114 HBasicBlock entry; | 114 HBasicBlock entry; |
| 115 HBasicBlock exit; | 115 HBasicBlock exit; |
| 116 bool isRecursiveMethod = false; | 116 bool isRecursiveMethod = false; |
| 117 bool calledInLoop = false; |
| 117 final List<HBasicBlock> blocks; | 118 final List<HBasicBlock> blocks; |
| 118 | 119 |
| 119 // We canonicalize all constants used within a graph so we do not | 120 // We canonicalize all constants used within a graph so we do not |
| 120 // have to worry about them for global value numbering. | 121 // have to worry about them for global value numbering. |
| 121 Map<Constant, HConstant> constants; | 122 Map<Constant, HConstant> constants; |
| 122 | 123 |
| 123 HGraph() | 124 HGraph() |
| 124 : blocks = new List<HBasicBlock>(), | 125 : blocks = new List<HBasicBlock>(), |
| 125 constants = new Map<Constant, HConstant>() { | 126 constants = new Map<Constant, HConstant>() { |
| 126 entry = addNewBlock(); | 127 entry = addNewBlock(); |
| (...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2580 HBasicBlock get start() => expression.start; | 2581 HBasicBlock get start() => expression.start; |
| 2581 HBasicBlock get end() { | 2582 HBasicBlock get end() { |
| 2582 // We don't create a switch block if there are no cases. | 2583 // We don't create a switch block if there are no cases. |
| 2583 assert(!statements.isEmpty()); | 2584 assert(!statements.isEmpty()); |
| 2584 return statements.last().end; | 2585 return statements.last().end; |
| 2585 } | 2586 } |
| 2586 | 2587 |
| 2587 bool accept(HStatementInformationVisitor visitor) => | 2588 bool accept(HStatementInformationVisitor visitor) => |
| 2588 visitor.visitSwitchInfo(this); | 2589 visitor.visitSwitchInfo(this); |
| 2589 } | 2590 } |
| OLD | NEW |