| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool calledInLoop = false; |
| 118 bool highTypeLikelyhood = false; |
| 118 final List<HBasicBlock> blocks; | 119 final List<HBasicBlock> blocks; |
| 119 | 120 |
| 120 // We canonicalize all constants used within a graph so we do not | 121 // We canonicalize all constants used within a graph so we do not |
| 121 // have to worry about them for global value numbering. | 122 // have to worry about them for global value numbering. |
| 122 Map<Constant, HConstant> constants; | 123 Map<Constant, HConstant> constants; |
| 123 | 124 |
| 124 HGraph() | 125 HGraph() |
| 125 : blocks = new List<HBasicBlock>(), | 126 : blocks = new List<HBasicBlock>(), |
| 126 constants = new Map<Constant, HConstant>() { | 127 constants = new Map<Constant, HConstant>() { |
| 127 entry = addNewBlock(); | 128 entry = addNewBlock(); |
| (...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 | 1789 |
| 1789 toString() => 'literal: $constant'; | 1790 toString() => 'literal: $constant'; |
| 1790 accept(HVisitor visitor) => visitor.visitConstant(this); | 1791 accept(HVisitor visitor) => visitor.visitConstant(this); |
| 1791 | 1792 |
| 1792 HType get guaranteedType() => constantType; | 1793 HType get guaranteedType() => constantType; |
| 1793 | 1794 |
| 1794 bool isConstant() => true; | 1795 bool isConstant() => true; |
| 1795 bool isConstantBoolean() => constant.isBool(); | 1796 bool isConstantBoolean() => constant.isBool(); |
| 1796 bool isConstantNull() => constant.isNull(); | 1797 bool isConstantNull() => constant.isNull(); |
| 1797 bool isConstantNumber() => constant.isNum(); | 1798 bool isConstantNumber() => constant.isNum(); |
| 1799 bool isConstantInteger() => constant.isInt(); |
| 1798 bool isConstantString() => constant.isString(); | 1800 bool isConstantString() => constant.isString(); |
| 1799 bool isConstantList() => constant.isList(); | 1801 bool isConstantList() => constant.isList(); |
| 1800 bool isConstantMap() => constant.isMap(); | 1802 bool isConstantMap() => constant.isMap(); |
| 1801 bool isConstantFalse() => constant.isFalse(); | 1803 bool isConstantFalse() => constant.isFalse(); |
| 1802 bool isConstantTrue() => constant.isTrue(); | 1804 bool isConstantTrue() => constant.isTrue(); |
| 1803 | 1805 |
| 1804 // Maybe avoid this if the literal is big? | 1806 // Maybe avoid this if the literal is big? |
| 1805 bool isCodeMotionInvariant() => true; | 1807 bool isCodeMotionInvariant() => true; |
| 1806 } | 1808 } |
| 1807 | 1809 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2584 HBasicBlock get start() => expression.start; | 2586 HBasicBlock get start() => expression.start; |
| 2585 HBasicBlock get end() { | 2587 HBasicBlock get end() { |
| 2586 // We don't create a switch block if there are no cases. | 2588 // We don't create a switch block if there are no cases. |
| 2587 assert(!statements.isEmpty()); | 2589 assert(!statements.isEmpty()); |
| 2588 return statements.last().end; | 2590 return statements.last().end; |
| 2589 } | 2591 } |
| 2590 | 2592 |
| 2591 bool accept(HStatementInformationVisitor visitor) => | 2593 bool accept(HStatementInformationVisitor visitor) => |
| 2592 visitor.visitSwitchInfo(this); | 2594 visitor.visitSwitchInfo(this); |
| 2593 } | 2595 } |
| OLD | NEW |