| 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 import '../closure.dart'; | 5 import '../closure.dart'; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../common/backend_api.dart' show BackendClasses; | 7 import '../common/backend_api.dart' show BackendClasses; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| 11 import '../elements/elements.dart' | 11 import '../elements/elements.dart' show JumpTarget, LabelDefinition; |
| 12 show JumpTarget, LabelDefinition; | |
| 13 import '../elements/entities.dart'; | 12 import '../elements/entities.dart'; |
| 14 import '../elements/types.dart'; | 13 import '../elements/types.dart'; |
| 15 import '../io/source_information.dart'; | 14 import '../io/source_information.dart'; |
| 16 import '../js/js.dart' as js; | 15 import '../js/js.dart' as js; |
| 17 import '../js_backend/js_backend.dart'; | 16 import '../js_backend/js_backend.dart'; |
| 18 import '../native/native.dart' as native; | 17 import '../native/native.dart' as native; |
| 19 import '../tree/dartstring.dart' as ast; | 18 import '../tree/dartstring.dart' as ast; |
| 20 import '../types/constants.dart' show computeTypeMask; | 19 import '../types/constants.dart' show computeTypeMask; |
| 21 import '../types/types.dart'; | 20 import '../types/types.dart'; |
| 22 import '../universe/selector.dart' show Selector; | 21 import '../universe/selector.dart' show Selector; |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 | 1344 |
| 1346 HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) { | 1345 HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) { |
| 1347 if (type == null) return this; | 1346 if (type == null) return this; |
| 1348 type = type.unaliased; | 1347 type = type.unaliased; |
| 1349 // Only the builder knows how to create [HTypeConversion] | 1348 // Only the builder knows how to create [HTypeConversion] |
| 1350 // instructions with generics. It has the generic type context | 1349 // instructions with generics. It has the generic type context |
| 1351 // available. | 1350 // available. |
| 1352 assert(!type.isTypeVariable); | 1351 assert(!type.isTypeVariable); |
| 1353 assert(type.treatAsRaw || type.isFunctionType); | 1352 assert(type.treatAsRaw || type.isFunctionType); |
| 1354 if (type.isDynamic) return this; | 1353 if (type.isDynamic) return this; |
| 1355 if (type.isObject) return this; | 1354 if (type == closedWorld.commonElements.objectType) return this; |
| 1356 if (type.isVoid || type.isFunctionType || type.isMalformed) { | 1355 if (type.isVoid || type.isFunctionType || type.isMalformed) { |
| 1357 return new HTypeConversion( | 1356 return new HTypeConversion( |
| 1358 type, kind, closedWorld.commonMasks.dynamicType, this); | 1357 type, kind, closedWorld.commonMasks.dynamicType, this); |
| 1359 } | 1358 } |
| 1360 assert(type.isInterfaceType); | 1359 assert(type.isInterfaceType); |
| 1361 if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { | 1360 if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { |
| 1362 // Boolean conversion checks work on non-nullable booleans. | 1361 // Boolean conversion checks work on non-nullable booleans. |
| 1363 return new HTypeConversion( | 1362 return new HTypeConversion( |
| 1364 type, kind, closedWorld.commonMasks.boolType, this); | 1363 type, kind, closedWorld.commonMasks.boolType, this); |
| 1365 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { | 1364 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { |
| (...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3471 class HDynamicType extends HRuntimeType { | 3470 class HDynamicType extends HRuntimeType { |
| 3472 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3471 HDynamicType(DynamicType dartType, TypeMask instructionType) |
| 3473 : super(const <HInstruction>[], dartType, instructionType); | 3472 : super(const <HInstruction>[], dartType, instructionType); |
| 3474 | 3473 |
| 3475 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3474 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
| 3476 | 3475 |
| 3477 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3476 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
| 3478 | 3477 |
| 3479 bool typeEquals(HInstruction other) => other is HDynamicType; | 3478 bool typeEquals(HInstruction other) => other is HDynamicType; |
| 3480 } | 3479 } |
| OLD | NEW |