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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 // All isFunctions work on the propagated types. | 864 // All isFunctions work on the propagated types. |
865 bool isArray(HTypeMap types) => types[this].isArray(); | 865 bool isArray(HTypeMap types) => types[this].isArray(); |
866 bool isReadableArray(HTypeMap types) => types[this].isReadableArray(); | 866 bool isReadableArray(HTypeMap types) => types[this].isReadableArray(); |
867 bool isMutableArray(HTypeMap types) => types[this].isMutableArray(); | 867 bool isMutableArray(HTypeMap types) => types[this].isMutableArray(); |
868 bool isExtendableArray(HTypeMap types) => types[this].isExtendableArray(); | 868 bool isExtendableArray(HTypeMap types) => types[this].isExtendableArray(); |
869 bool isFixedArray(HTypeMap types) => types[this].isFixedArray(); | 869 bool isFixedArray(HTypeMap types) => types[this].isFixedArray(); |
870 bool isBoolean(HTypeMap types) => types[this].isBoolean(); | 870 bool isBoolean(HTypeMap types) => types[this].isBoolean(); |
871 bool isInteger(HTypeMap types) => types[this].isInteger(); | 871 bool isInteger(HTypeMap types) => types[this].isInteger(); |
872 bool isDouble(HTypeMap types) => types[this].isDouble(); | 872 bool isDouble(HTypeMap types) => types[this].isDouble(); |
873 bool isNumber(HTypeMap types) => types[this].isNumber(); | 873 bool isNumber(HTypeMap types) => types[this].isNumber(); |
| 874 bool isNumberOrNull(HTypeMap types) => types[this].isNumberOrNull(); |
874 bool isString(HTypeMap types) => types[this].isString(); | 875 bool isString(HTypeMap types) => types[this].isString(); |
875 bool isTypeUnknown(HTypeMap types) => types[this].isUnknown(); | 876 bool isTypeUnknown(HTypeMap types) => types[this].isUnknown(); |
876 bool isIndexablePrimitive(HTypeMap types) | 877 bool isIndexablePrimitive(HTypeMap types) |
877 => types[this].isIndexablePrimitive(); | 878 => types[this].isIndexablePrimitive(); |
878 bool isPrimitive(HTypeMap types) => types[this].isPrimitive(); | 879 bool isPrimitive(HTypeMap types) => types[this].isPrimitive(); |
879 bool canBePrimitive(HTypeMap types) => types[this].canBePrimitive(); | 880 bool canBePrimitive(HTypeMap types) => types[this].canBePrimitive(); |
880 bool canBeNull(HTypeMap types) => types[this].canBeNull(); | 881 bool canBeNull(HTypeMap types) => types[this].canBeNull(); |
881 | 882 |
882 /** | 883 /** |
883 * This is the type the instruction is guaranteed to have. It does not | 884 * This is the type the instruction is guaranteed to have. It does not |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 | 1122 |
1122 HInstruction current = this; | 1123 HInstruction current = this; |
1123 while (current != null) { | 1124 while (current != null) { |
1124 if (identical(current, other)) return true; | 1125 if (identical(current, other)) return true; |
1125 current = current.next; | 1126 current = current.next; |
1126 } | 1127 } |
1127 return false; | 1128 return false; |
1128 } | 1129 } |
1129 | 1130 |
1130 | 1131 |
1131 HInstruction convertType(Compiler compiler, | 1132 HInstruction convertType(Compiler compiler, DartType type, int kind) { |
1132 Element sourceElement, | |
1133 int kind) { | |
1134 DartType type = sourceElement.computeType(compiler); | |
1135 if (type == null) return this; | 1133 if (type == null) return this; |
1136 if (identical(type.element, compiler.dynamicClass)) return this; | 1134 if (identical(type.element, compiler.dynamicClass)) return this; |
1137 if (identical(type.element, compiler.objectClass)) return this; | 1135 if (identical(type.element, compiler.objectClass)) return this; |
1138 | 1136 |
1139 // If the original can't be null, type conversion also can't produce null. | 1137 // If the original can't be null, type conversion also can't produce null. |
1140 bool canBeNull = this.guaranteedType.canBeNull(); | 1138 bool canBeNull = this.guaranteedType.canBeNull(); |
1141 HType convertedType = | 1139 HType convertedType = |
1142 new HType.fromBoundedType(type, compiler, canBeNull); | 1140 new HType.fromBoundedType(type, compiler, canBeNull); |
1143 | 1141 |
1144 // No need to convert if we know the instruction has | 1142 // No need to convert if we know the instruction has |
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 HBasicBlock get start => expression.start; | 3002 HBasicBlock get start => expression.start; |
3005 HBasicBlock get end { | 3003 HBasicBlock get end { |
3006 // We don't create a switch block if there are no cases. | 3004 // We don't create a switch block if there are no cases. |
3007 assert(!statements.isEmpty); | 3005 assert(!statements.isEmpty); |
3008 return statements.last.end; | 3006 return statements.last.end; |
3009 } | 3007 } |
3010 | 3008 |
3011 bool accept(HStatementInformationVisitor visitor) => | 3009 bool accept(HStatementInformationVisitor visitor) => |
3012 visitor.visitSwitchInfo(this); | 3010 visitor.visitSwitchInfo(this); |
3013 } | 3011 } |
OLD | NEW |