@@ -1057,34 +1057,6 @@ class SsaInstructionSimplifier extends HBaseVisitor
1057
1057
return node;
1058
1058
}
1059
1059
1060
- /// Read the type variable from an allocation of type [createdClass] , where
1061
- /// [selectTypeArgumentFromObjectCreation] extracts the type argument from
1062
- /// the allocation for factory constructor call.
1063
- HInstruction finishSubstituted (ClassElement createdClass,
1064
- HInstruction selectTypeArgumentFromObjectCreation (int index)) {
1065
- HInstruction instructionForTypeVariable (TypeVariableType tv) {
1066
- return selectTypeArgumentFromObjectCreation (
1067
- createdClass.thisType.typeArguments.indexOf (tv));
1068
- }
1069
-
1070
- DartType type = createdClass.thisType
1071
- .asInstanceOf (variable.element.enclosingClass)
1072
- .typeArguments[variable.element.index];
1073
- if (type is TypeVariableType ) {
1074
- return instructionForTypeVariable (type);
1075
- }
1076
- List <HInstruction > arguments = < HInstruction > [];
1077
- type.forEachTypeVariable ((v) {
1078
- arguments.add (instructionForTypeVariable (v));
1079
- });
1080
- HInstruction replacement = new HTypeInfoExpression (
1081
- TypeInfoExpressionKind .COMPLETE ,
1082
- type,
1083
- arguments,
1084
- backend.dynamicType);
1085
- return replacement;
1086
- }
1087
-
1088
1060
// Type variable evaluated in the context of a constant can be replaced with
1089
1061
// a ground term type.
1090
1062
if (object is HConstant ) {
@@ -1095,38 +1067,10 @@ class SsaInstructionSimplifier extends HBaseVisitor
1095
1067
return node;
1096
1068
}
1097
1069
1098
- // Look for an allocation with type information and re-write type variable
1099
- // as a function of the type parameters of the allocation. This effectively
1100
- // store-forwards a type variable read through an allocation.
1101
-
1102
- // Match:
1103
- //
1104
- // setRuntimeTypeInfo(
1105
- // HForeignNew(ClassElement),
1106
- // HTypeInfoExpression(t_0, t_1, t_2, ...));
1107
- //
1108
- // The `t_i` are the values of the type parameters of ClassElement.
1109
- if (object is HInvokeStatic ) {
1110
- if (object.element == helpers.setRuntimeTypeInfo) {
1111
- HInstruction allocation = object.inputs[0 ];
1112
- if (allocation is HForeignNew ) {
1113
- HInstruction typeInfo = object.inputs[1 ];
1114
- if (typeInfo is HTypeInfoExpression ) {
1115
- return finishSubstituted (
1116
- allocation.element, (int index) => typeInfo.inputs[index]);
1117
- }
1118
- }
1119
- return node;
1120
- }
1121
- // TODO(sra): Factory constructors pass type arguments after the value
1122
- // arguments. The [select] argument indexes into these type arguments.
1123
- }
1124
-
1125
- // Non-generic type (which extends or mixes in a generic type, for example
1126
- // CodeUnits extends UnmodifiableListBase<int>).
1127
- if (object is HForeignNew ) {
1128
- return finishGroundType (object.element.thisType);
1129
- }
1070
+ // TODO(sra): HTypeInfoReadVariable on an instance creation can be replaced
1071
+ // with an input of the instance creation's HTypeInfoExpression (or a
1072
+ // HTypeInfoExpression of an input). This would in effect store-forward the
1073
+ // type parameters.
1130
1074
1131
1075
return node;
1132
1076
}
0 commit comments