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 visitAwait(HAwait node); | 9 R visitAwait(HAwait node); |
10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 | 1312 |
1313 HInstruction convertType(Compiler compiler, DartType type, int kind) { | 1313 HInstruction convertType(Compiler compiler, DartType type, int kind) { |
1314 if (type == null) return this; | 1314 if (type == null) return this; |
1315 type = type.unaliased; | 1315 type = type.unaliased; |
1316 // Only the builder knows how to create [HTypeConversion] | 1316 // Only the builder knows how to create [HTypeConversion] |
1317 // instructions with generics. It has the generic type context | 1317 // instructions with generics. It has the generic type context |
1318 // available. | 1318 // available. |
1319 assert(type.kind != TypeKind.TYPE_VARIABLE); | 1319 assert(type.kind != TypeKind.TYPE_VARIABLE); |
1320 assert(type.treatAsRaw || type.isFunctionType); | 1320 assert(type.treatAsRaw || type.isFunctionType); |
1321 if (type.isDynamic) return this; | 1321 if (type.isDynamic) return this; |
| 1322 if (type.isObject) return this; |
1322 // The type element is either a class or the void element. | 1323 // The type element is either a class or the void element. |
1323 Element element = type.element; | 1324 Element element = type.element; |
1324 if (identical(element, compiler.objectClass)) return this; | |
1325 JavaScriptBackend backend = compiler.backend; | 1325 JavaScriptBackend backend = compiler.backend; |
1326 if (type.kind != TypeKind.INTERFACE) { | 1326 if (type.kind != TypeKind.INTERFACE) { |
1327 return new HTypeConversion(type, kind, backend.dynamicType, this); | 1327 return new HTypeConversion(type, kind, backend.dynamicType, this); |
1328 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { | 1328 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { |
1329 // Boolean conversion checks work on non-nullable booleans. | 1329 // Boolean conversion checks work on non-nullable booleans. |
1330 return new HTypeConversion(type, kind, backend.boolType, this); | 1330 return new HTypeConversion(type, kind, backend.boolType, this); |
1331 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { | 1331 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { |
1332 throw 'creating compound check to $type (this = ${this})'; | 1332 throw 'creating compound check to $type (this = ${this})'; |
1333 } else { | 1333 } else { |
1334 TypeMask subtype = new TypeMask.subtype(element.declaration, | 1334 TypeMask subtype = new TypeMask.subtype(element.declaration, |
(...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3327 class HDynamicType extends HRuntimeType { | 3327 class HDynamicType extends HRuntimeType { |
3328 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3328 HDynamicType(DynamicType dartType, TypeMask instructionType) |
3329 : super(const <HInstruction>[], dartType, instructionType); | 3329 : super(const <HInstruction>[], dartType, instructionType); |
3330 | 3330 |
3331 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3331 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
3332 | 3332 |
3333 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3333 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
3334 | 3334 |
3335 bool typeEquals(HInstruction other) => other is HDynamicType; | 3335 bool typeEquals(HInstruction other) => other is HDynamicType; |
3336 } | 3336 } |
OLD | NEW |