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 4f1af1efdf943c47e3bb9197ba47a007b4341c40..9f54ceb5ae57faa1a6f19425085745c52bb9401c 100644 |
--- a/pkg/compiler/lib/src/ssa/builder.dart |
+++ b/pkg/compiler/lib/src/ssa/builder.dart |
@@ -1494,11 +1494,33 @@ class SsaBuilder extends ast.Visitor |
HInstruction newObject; |
if (!isNativeUpgradeFactory) { |
- newObject = new HCreate( |
- classElement, constructorArguments, ssaType, instantiatedTypes); |
+ // Create the runtime type information, if needed. |
+ bool hasRtiInput = false; |
+ if (backend.classNeedsRtiField(classElement)) { |
+ // Read the values of the type arguments and create a |
+ // HTypeInfoExpression to set on the newly create object. |
+ hasRtiInput = true; |
+ List<HInstruction> typeArguments = <HInstruction>[]; |
+ classElement.typeVariables.forEach((TypeVariableType typeVariable) { |
+ HInstruction argument = localsHandler |
+ .readLocal(localsHandler.getTypeVariableAsLocal(typeVariable)); |
+ typeArguments.add(argument); |
+ }); |
+ |
+ HInstruction typeInfo = new HTypeInfoExpression( |
+ TypeInfoExpressionKind.INSTANCE, |
+ classElement.thisType, |
+ typeArguments, |
+ backend.dynamicType); |
+ add(typeInfo); |
+ constructorArguments.add(typeInfo); |
+ } |
+ |
+ newObject = new HCreate(classElement, constructorArguments, ssaType, |
+ instantiatedTypes: instantiatedTypes, hasRtiInput: hasRtiInput); |
if (function != null) { |
- // TODO(johnniwinther): Provide source information for creation |
- // through synthetic constructors. |
+ // TODO(johnniwinther): Provide source information for creation through |
+ // synthetic constructors. |
newObject.sourceInformation = |
sourceInformationBuilder.buildCreate(function); |
} |
@@ -1516,26 +1538,6 @@ class SsaBuilder extends ast.Visitor |
} |
} |
removeInlinedInstantiation(type); |
- // Create the runtime type information, if needed. |
- if (classElement.typeVariables.isNotEmpty && |
- backend.classNeedsRti(classElement)) { |
- // Read the values of the type arguments and create a HTypeInfoExpression |
- // to set on the newly create object. |
- List<HInstruction> typeArguments = <HInstruction>[]; |
- classElement.typeVariables.forEach((TypeVariableType typeVariable) { |
- HInstruction argument = localsHandler |
- .readLocal(localsHandler.getTypeVariableAsLocal(typeVariable)); |
- typeArguments.add(argument); |
- }); |
- |
- HInstruction typeInfo = new HTypeInfoExpression( |
- TypeInfoExpressionKind.INSTANCE, |
- classElement.thisType, |
- typeArguments, |
- backend.dynamicType); |
- add(typeInfo); |
- newObject = callSetRuntimeTypeInfo(typeInfo, newObject); |
- } |
// Generate calls to the constructor bodies. |
HInstruction interceptor = null; |