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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 } | 957 } |
958 | 958 |
959 HType get guaranteedType() => HType.BOOLEAN; | 959 HType get guaranteedType() => HType.BOOLEAN; |
960 | 960 |
961 accept(HVisitor visitor) => visitor.visitBoolify(this); | 961 accept(HVisitor visitor) => visitor.visitBoolify(this); |
962 int typeCode() => 0; | 962 int typeCode() => 0; |
963 bool typeEquals(other) => other is HBoolify; | 963 bool typeEquals(other) => other is HBoolify; |
964 bool dataEquals(HInstruction other) => true; | 964 bool dataEquals(HInstruction other) => true; |
965 } | 965 } |
966 | 966 |
967 class HCheck extends HInstruction { | 967 /** |
| 968 * A [HCheck] instruction is an instruction that might do a dynamic |
| 969 * check at runtime on another instruction. To have proper instruction |
| 970 * dependencies in the graph, instructions that depend on the check |
| 971 * being done reference the [HCheck] instruction instead of the |
| 972 * instruction itself. |
| 973 */ |
| 974 abstract class HCheck extends HInstruction { |
968 HCheck(inputs) : super(inputs); | 975 HCheck(inputs) : super(inputs); |
969 | |
970 // TODO(floitsch): make class abstract instead of adding an abstract method. | |
971 abstract accept(HVisitor visitor); | |
972 | |
973 HInstruction get checkedInput() => inputs[0]; | 976 HInstruction get checkedInput() => inputs[0]; |
974 } | 977 } |
975 | 978 |
976 class HTypeGuard extends HCheck { | 979 class HTypeGuard extends HCheck { |
977 final int state; | 980 final int state; |
978 final HType guardedType; | 981 final HType guardedType; |
979 bool isOn = false; | 982 bool isOn = false; |
980 HTypeGuard(this.guardedType, this.state, List<HInstruction> env) : super(env); | 983 HTypeGuard(this.guardedType, this.state, List<HInstruction> env) : super(env); |
981 | 984 |
982 void prepareGvn() { | 985 void prepareGvn() { |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 HBasicBlock get start() => expression.start; | 2567 HBasicBlock get start() => expression.start; |
2565 HBasicBlock get end() { | 2568 HBasicBlock get end() { |
2566 // We don't create a switch block if there are no cases. | 2569 // We don't create a switch block if there are no cases. |
2567 assert(!statements.isEmpty()); | 2570 assert(!statements.isEmpty()); |
2568 return statements.last().end; | 2571 return statements.last().end; |
2569 } | 2572 } |
2570 | 2573 |
2571 bool accept(HStatementInformationVisitor visitor) => | 2574 bool accept(HStatementInformationVisitor visitor) => |
2572 visitor.visitSwitchInfo(this); | 2575 visitor.visitSwitchInfo(this); |
2573 } | 2576 } |
OLD | NEW |