Skip to content

Commit c3c5ee8

Browse files
committed
Revert "Fold HTypeInfoReadVariable of instance creation."
Investigating failed test tools/test.py -mrelease --use-sdk -cdart2js --dart2js-batch -rd8 --reset-browser-configuration --write-debug-log --write-test-outcome-log --copy-coredumps --minified --fast-startup --checked -t120 co19/Language/Types/Parameterized_Types/Actual_Type_of_Declaration/actual_type_t05 [email protected] Review URL: https://codereview.chromium.org/2289593004 .
1 parent 0a23299 commit c3c5ee8

File tree

1 file changed

+4
-60
lines changed

1 file changed

+4
-60
lines changed

pkg/compiler/lib/src/ssa/optimize.dart

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,34 +1057,6 @@ class SsaInstructionSimplifier extends HBaseVisitor
10571057
return node;
10581058
}
10591059

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-
10881060
// Type variable evaluated in the context of a constant can be replaced with
10891061
// a ground term type.
10901062
if (object is HConstant) {
@@ -1095,38 +1067,10 @@ class SsaInstructionSimplifier extends HBaseVisitor
10951067
return node;
10961068
}
10971069

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.
11301074

11311075
return node;
11321076
}

0 commit comments

Comments
 (0)