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

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

Issue 2319863002: Revert "dart2js: Pass type information to constructor rather than add later." (Closed)
Patch Set: Created 4 years, 3 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 9f54ceb5ae57faa1a6f19425085745c52bb9401c..4f1af1efdf943c47e3bb9197ba47a007b4341c40 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -1494,33 +1494,11 @@ class SsaBuilder extends ast.Visitor
HInstruction newObject;
if (!isNativeUpgradeFactory) {
- // 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);
+ newObject = new HCreate(
+ classElement, constructorArguments, ssaType, instantiatedTypes);
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);
}
@@ -1538,6 +1516,26 @@ 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;
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698