Chromium Code Reviews| 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'; |
| (...skipping 3275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3286 /// The COMPLETE form value is constructed from [dartType] by replacing the type | 3286 /// The COMPLETE form value is constructed from [dartType] by replacing the type |
| 3287 /// variables with consecutive values from [inputs], in the order generated by | 3287 /// variables with consecutive values from [inputs], in the order generated by |
| 3288 /// [DartType.forEachTypeVariable]. The type variables in [dartType] are | 3288 /// [DartType.forEachTypeVariable]. The type variables in [dartType] are |
| 3289 /// treated as 'holes' in the term, which means that it must be ensured at | 3289 /// treated as 'holes' in the term, which means that it must be ensured at |
| 3290 /// construction, that duplicate occurences of a type variable in [dartType] are | 3290 /// construction, that duplicate occurences of a type variable in [dartType] are |
| 3291 /// assigned the same value. | 3291 /// assigned the same value. |
| 3292 /// | 3292 /// |
| 3293 /// The INSTANCE form is constructed as a list of [inputs]. This is the same as | 3293 /// The INSTANCE form is constructed as a list of [inputs]. This is the same as |
| 3294 /// the COMPLETE form for the 'thisType', except the root term's type is | 3294 /// the COMPLETE form for the 'thisType', except the root term's type is |
| 3295 /// missing; this is implicit as the raw type of instance. The [dartType] of | 3295 /// missing; this is implicit as the raw type of instance. The [dartType] of |
| 3296 /// the INSTANCE form must be the thisType of some class. | 3296 /// the INSTANCE form must be a raw type of some class. |
|
sra1
2017/01/04 17:16:03
Can we avoid this change?
It breaks the invariant
Johnni Winther
2017/01/06 10:24:04
Done.
| |
| 3297 /// | 3297 /// |
| 3298 /// We want to remove the constrains on the INSTANCE form. In the meantime we | 3298 /// We want to remove the constrains on the INSTANCE form. In the meantime we |
| 3299 /// get by with a tree of TypeExpressions. Consider: | 3299 /// get by with a tree of TypeExpressions. Consider: |
| 3300 /// | 3300 /// |
| 3301 /// class Foo<T> { | 3301 /// class Foo<T> { |
| 3302 /// ... new Set<List<T>>() | 3302 /// ... new Set<List<T>>() |
| 3303 /// } | 3303 /// } |
| 3304 /// class Set<E1> { | 3304 /// class Set<E1> { |
| 3305 /// factory Set() => new _LinkedHashSet<E1>(); | 3305 /// factory Set() => new _LinkedHashSet<E1>(); |
| 3306 /// } | 3306 /// } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 3320 | 3320 |
| 3321 // TODO(sra): The INSTANCE form requires the actual instance for full | 3321 // TODO(sra): The INSTANCE form requires the actual instance for full |
| 3322 // interpretation. If the COMPLETE form was used on instances, then we could | 3322 // interpretation. If the COMPLETE form was used on instances, then we could |
| 3323 // simplify HTypeInfoReadVariable without an object. | 3323 // simplify HTypeInfoReadVariable without an object. |
| 3324 | 3324 |
| 3325 class HTypeInfoExpression extends HInstruction { | 3325 class HTypeInfoExpression extends HInstruction { |
| 3326 final TypeInfoExpressionKind kind; | 3326 final TypeInfoExpressionKind kind; |
| 3327 final DartType dartType; | 3327 final DartType dartType; |
| 3328 HTypeInfoExpression(this.kind, this.dartType, List<HInstruction> inputs, | 3328 HTypeInfoExpression(this.kind, this.dartType, List<HInstruction> inputs, |
| 3329 TypeMask instructionType) | 3329 TypeMask instructionType) |
| 3330 : super(inputs, instructionType) { | 3330 : super(inputs, instructionType) { |
|
sra1
2017/01/04 17:16:03
We could assert here that the number of type varia
Johnni Winther
2017/01/06 10:24:04
Done.
| |
| 3331 setUseGvn(); | 3331 setUseGvn(); |
| 3332 } | 3332 } |
| 3333 | 3333 |
| 3334 accept(HVisitor visitor) => visitor.visitTypeInfoExpression(this); | 3334 accept(HVisitor visitor) => visitor.visitTypeInfoExpression(this); |
| 3335 | 3335 |
| 3336 bool canThrow() => false; | 3336 bool canThrow() => false; |
| 3337 | 3337 |
| 3338 int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE; | 3338 int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE; |
| 3339 bool typeEquals(HInstruction other) => other is HTypeInfoExpression; | 3339 bool typeEquals(HInstruction other) => other is HTypeInfoExpression; |
| 3340 | 3340 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3448 class HDynamicType extends HRuntimeType { | 3448 class HDynamicType extends HRuntimeType { |
| 3449 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3449 HDynamicType(DynamicType dartType, TypeMask instructionType) |
| 3450 : super(const <HInstruction>[], dartType, instructionType); | 3450 : super(const <HInstruction>[], dartType, instructionType); |
| 3451 | 3451 |
| 3452 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3452 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
| 3453 | 3453 |
| 3454 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3454 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
| 3455 | 3455 |
| 3456 bool typeEquals(HInstruction other) => other is HDynamicType; | 3456 bool typeEquals(HInstruction other) => other is HDynamicType; |
| 3457 } | 3457 } |
| OLD | NEW |