| Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| index f665897410b5e694f008f1bbb584d07a01a66e6e..7d422706e3c23a28817f5cc320de85eacc1a218a 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| @@ -2518,12 +2518,12 @@ class TransformingVisitor extends DeepRecursiveVisitor {
|
| TypeExpression typeExpression = instance.typeInformation;
|
| assert(typeExpression.kind == TypeExpressionKind.INSTANCE);
|
| ClassElement context = node.variable.element.enclosingClass;
|
| + ClassElement createdClass = instance.classElement;
|
| // In the general case, a substitution could generate a large type
|
| // term. Avoid this by restricting to direct indexing.
|
| // TODO(sra): Also include cases that require substitution but the end
|
| // result is the same as some indexing or a simple constant type.
|
| - if (!functionCompiler.glue.needsSubstitutionForTypeVariableAccess(
|
| - context)) {
|
| + if (backend.rti.isTrivialSubstitution(createdClass, context)) {
|
| int index = functionCompiler.glue.getTypeVariableIndex(node.variable);
|
| if (0 <= index && index < typeExpression.argumentRefs.length) {
|
| node.replaceUsesWith(typeExpression.argument(index));
|
| @@ -2534,6 +2534,16 @@ class TransformingVisitor extends DeepRecursiveVisitor {
|
| }
|
| return null;
|
| }
|
| +
|
| + bool isNullConstant(Primitive prim) => prim is Constant && prim.value.isNull;
|
| +
|
| + visitCreateInstance(CreateInstance node) {
|
| + Primitive typeInformation = node.typeInformation;
|
| + if (typeInformation is TypeExpression &&
|
| + typeInformation.arguments.every(isNullConstant)) {
|
| + node..typeInformationRef.unlink()..typeInformationRef = null;
|
| + }
|
| + }
|
| }
|
|
|
| /**
|
|
|