| 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 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 return false; | 1117 return false; |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 HInstruction convertType(Compiler compiler, DartType type, int kind) { | 1120 HInstruction convertType(Compiler compiler, DartType type, int kind) { |
| 1121 if (type == null) return this; | 1121 if (type == null) return this; |
| 1122 type = type.unalias(compiler); | 1122 type = type.unalias(compiler); |
| 1123 // Only the builder knows how to create [HTypeConversion] | 1123 // Only the builder knows how to create [HTypeConversion] |
| 1124 // instructions with generics. It has the generic type context | 1124 // instructions with generics. It has the generic type context |
| 1125 // available. | 1125 // available. |
| 1126 assert(type.kind != TypeKind.TYPE_VARIABLE); | 1126 assert(type.kind != TypeKind.TYPE_VARIABLE); |
| 1127 assert(type.isRaw || type.kind == TypeKind.FUNCTION); | 1127 assert(type.treatAsRaw || type.kind == TypeKind.FUNCTION); |
| 1128 if (type.treatAsDynamic) return this; | 1128 if (type.treatAsDynamic) return this; |
| 1129 if (identical(type.element, compiler.objectClass)) return this; | 1129 if (identical(type.element, compiler.objectClass)) return this; |
| 1130 if (type.kind != TypeKind.INTERFACE) { | 1130 if (type.kind != TypeKind.INTERFACE) { |
| 1131 return new HTypeConversion(type, kind, HType.UNKNOWN, this); | 1131 return new HTypeConversion(type, kind, HType.UNKNOWN, this); |
| 1132 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { | 1132 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { |
| 1133 // Boolean conversion checks work on non-nullable booleans. | 1133 // Boolean conversion checks work on non-nullable booleans. |
| 1134 return new HTypeConversion(type, kind, HType.BOOLEAN, this); | 1134 return new HTypeConversion(type, kind, HType.BOOLEAN, this); |
| 1135 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.isRaw) { | 1135 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { |
| 1136 throw 'creating compound check to $type (this = ${this})'; | 1136 throw 'creating compound check to $type (this = ${this})'; |
| 1137 } else { | 1137 } else { |
| 1138 HType subtype = new HType.subtype(type, compiler); | 1138 HType subtype = new HType.subtype(type, compiler); |
| 1139 return new HTypeConversion(type, kind, subtype, this); | 1139 return new HTypeConversion(type, kind, subtype, this); |
| 1140 } | 1140 } |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 /** | 1143 /** |
| 1144 * Return whether the instructions do not belong to a loop or | 1144 * Return whether the instructions do not belong to a loop or |
| 1145 * belong to the same loop. | 1145 * belong to the same loop. |
| (...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2776 HBasicBlock get start => expression.start; | 2776 HBasicBlock get start => expression.start; |
| 2777 HBasicBlock get end { | 2777 HBasicBlock get end { |
| 2778 // We don't create a switch block if there are no cases. | 2778 // We don't create a switch block if there are no cases. |
| 2779 assert(!statements.isEmpty); | 2779 assert(!statements.isEmpty); |
| 2780 return statements.last.end; | 2780 return statements.last.end; |
| 2781 } | 2781 } |
| 2782 | 2782 |
| 2783 bool accept(HStatementInformationVisitor visitor) => | 2783 bool accept(HStatementInformationVisitor visitor) => |
| 2784 visitor.visitSwitchInfo(this); | 2784 visitor.visitSwitchInfo(this); |
| 2785 } | 2785 } |
| OLD | NEW |