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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 229083002: Revert "Construct literal maps using factory constructor." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 8c1d2df8f9c712e76997d7d504537a61b286d0e3..7ee27ee56b56183a0e46fb890bbb59897ebe116f 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -5039,55 +5039,19 @@ class SsaBuilder extends ResolvedVisitor {
stack.add(addConstant(node));
return;
}
- List<HInstruction> listInputs = <HInstruction>[];
+ List<HInstruction> inputs = <HInstruction>[];
for (Link<ast.Node> link = node.entries.nodes;
!link.isEmpty;
link = link.tail) {
visit(link.head);
- listInputs.add(pop());
- listInputs.add(pop());
- }
-
- Element constructor;
- List<HInstruction> inputs = <HInstruction>[];
-
- if (listInputs.isEmpty) {
- constructor = backend.mapLiteralConstructorEmpty;
- } else {
- constructor = backend.mapLiteralConstructor;
- HLiteralList keyValuePairs = buildLiteralList(listInputs);
- add(keyValuePairs);
- inputs.add(keyValuePairs);
- }
-
- assert(constructor.isFactoryConstructor());
-
- FunctionElement functionElement = constructor;
- constructor = functionElement.redirectionTarget;
-
- InterfaceType type = elements.getType(node);
- InterfaceType expectedType = functionElement.computeTargetType(type);
-
- if (constructor.isFactoryConstructor()) {
- compiler.enqueuer.codegen.registerFactoryWithTypeArguments(elements);
- }
-
- ClassElement cls = constructor.getEnclosingClass();
-
- if (backend.classNeedsRti(cls)) {
- Link<DartType> typeVariable = cls.typeVariables;
- expectedType.typeArguments.forEach((DartType argument) {
- inputs.add(analyzeTypeArgument(argument));
- typeVariable = typeVariable.tail;
- });
- assert(typeVariable.isEmpty);
- }
-
- TypeMask returnTypeMask = TypeMaskFactory.inferredReturnTypeForElement(
- constructor, compiler);
- addInlinedInstantiation(expectedType);
- pushInvokeStatic(node, constructor, inputs, returnTypeMask);
- removeInlinedInstantiation(expectedType);
+ inputs.add(pop());
+ inputs.add(pop());
+ }
+ HLiteralList keyValuePairs = buildLiteralList(inputs);
+ add(keyValuePairs);
+ TypeMask mapType = new TypeMask.nonNullSubtype(backend.mapLiteralClass);
+ pushInvokeStatic(node, backend.getMapMaker(), [keyValuePairs], mapType);
+ stack.add(setRtiIfNeeded(pop(), node));
}
visitLiteralMapEntry(ast.LiteralMapEntry node) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/backend.dart ('k') | sdk/lib/_internal/lib/collection_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698