Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2260353002: Remove use of JS templates in reified type information (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/ssa/builder.dart
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index fe78ce20bc88ec77df550bc68dd242b7d74b257c..65af5faef8cf88617965bb74a2ed2e3315ab6f99 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -3798,38 +3798,22 @@ class SsaBuilder extends ast.Visitor
return new HLiteralList(inputs, backend.extendableArrayType);
}
- // TODO(karlklose): change construction of the representations to be GVN'able
- // (dartbug.com/7182).
HInstruction buildTypeArgumentRepresentations(DartType type) {
+ assert(!type.isTypeVariable);
// Compute the representation of the type arguments, including access
// to the runtime type information for type variables as instructions.
- if (type.isTypeVariable) {
- return buildLiteralList(<HInstruction>[addTypeVariableReference(type)]);
sra1 2016/08/19 22:21:32 This makes no sense and the path is infeasible. De
- } else {
- assert(type.element.isClass);
- InterfaceType interface = type;
- List<HInstruction> inputs = <HInstruction>[];
- List<js.Expression> templates = <js.Expression>[];
- for (DartType argument in interface.typeArguments) {
- // As we construct the template in stages, we have to make sure that for
- // each part the generated sub-template's holes match the index of the
- // inputs that are later used to instantiate it. We do this by starting
- // the indexing with the number of inputs from previous sub-templates.
- templates.add(rtiEncoder.getTypeRepresentationWithPlaceholders(argument,
- (variable) {
- HInstruction runtimeType = addTypeVariableReference(variable);
- inputs.add(runtimeType);
- }, firstPlaceholderIndex: inputs.length));
- }
- // TODO(sra): This is a fresh template each time. We can't let the
- // template manager build them.
- js.Template code =
- new js.Template(null, new js.ArrayInitializer(templates));
- HInstruction representation = new HForeignCode(
- code, backend.readableArrayType, inputs,
- nativeBehavior: native.NativeBehavior.PURE_ALLOCATION);
- return representation;
+ assert(type.element.isClass);
+ InterfaceType interface = type;
+ List<HInstruction> inputs = <HInstruction>[];
+ for (DartType argument in interface.typeArguments) {
+ inputs.add(analyzeTypeArgument(argument));
}
+ HInstruction representation = new HTypeInfoExpression(
+ TypeInfoExpressionKind.INSTANCE,
+ interface.element.thisType,
+ inputs,
+ backend.dynamicType);
+ return representation;
}
@override

Powered by Google App Engine
This is Rietveld 408576698