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 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 currentBlock = node; | 111 currentBlock = node; |
112 visitInstructionList(node); | 112 visitInstructionList(node); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 class HGraph { | 116 class HGraph { |
117 HBasicBlock entry; | 117 HBasicBlock entry; |
118 HBasicBlock exit; | 118 HBasicBlock exit; |
119 bool isRecursiveMethod = false; | 119 bool isRecursiveMethod = false; |
120 bool calledInLoop = false; | 120 bool calledInLoop = false; |
121 bool highTypeLikelyhood = false; | |
122 final List<HBasicBlock> blocks; | 121 final List<HBasicBlock> blocks; |
123 | 122 |
124 // We canonicalize all constants used within a graph so we do not | 123 // We canonicalize all constants used within a graph so we do not |
125 // have to worry about them for global value numbering. | 124 // have to worry about them for global value numbering. |
126 Map<Constant, HConstant> constants; | 125 Map<Constant, HConstant> constants; |
127 | 126 |
128 HGraph() | 127 HGraph() |
129 : blocks = new List<HBasicBlock>(), | 128 : blocks = new List<HBasicBlock>(), |
130 constants = new Map<Constant, HConstant>() { | 129 constants = new Map<Constant, HConstant>() { |
131 entry = addNewBlock(); | 130 entry = addNewBlock(); |
(...skipping 2529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2661 HBasicBlock get start() => expression.start; | 2660 HBasicBlock get start() => expression.start; |
2662 HBasicBlock get end() { | 2661 HBasicBlock get end() { |
2663 // We don't create a switch block if there are no cases. | 2662 // We don't create a switch block if there are no cases. |
2664 assert(!statements.isEmpty()); | 2663 assert(!statements.isEmpty()); |
2665 return statements.last().end; | 2664 return statements.last().end; |
2666 } | 2665 } |
2667 | 2666 |
2668 bool accept(HStatementInformationVisitor visitor) => | 2667 bool accept(HStatementInformationVisitor visitor) => |
2669 visitor.visitSwitchInfo(this); | 2668 visitor.visitSwitchInfo(this); |
2670 } | 2669 } |
OLD | NEW |