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

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

Issue 54293008: Set runtime type on list and map literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test for map literals. Created 7 years, 1 month 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/backend.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a1666a3546e3a339647cfd18b41eace501c3ce74..be88d47a15dbe92dd509582eb9d4de27ee15c651 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -2024,6 +2024,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
push(attachPosition(instruction, node));
}
+ HInstruction peek() => stack.last;
+
HInstruction pop() {
return stack.removeLast();
}
@@ -4501,6 +4503,16 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
}
}
+ void setRtiIfNeeded(HInstruction object, Node node) {
+ InterfaceType type = elements.getType(node);
+ if (!backend.classNeedsRti(type.element)) return;
+ List<HInstruction> arguments = <HInstruction>[];
+ for (DartType argument in type.typeArguments) {
+ arguments.add(analyzeTypeArgument(argument));
+ }
+ callSetRuntimeTypeInfo(type.element, arguments, object);
+ }
+
visitLiteralList(LiteralList node) {
HInstruction instruction;
@@ -4516,6 +4528,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
}
instruction = buildLiteralList(inputs);
add(instruction);
+ setRtiIfNeeded(instruction, node);
}
HType type = new HType.inferredForNode(currentElement, node, compiler);
@@ -4717,6 +4730,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
add(keyValuePairs);
HType mapType = new HType.nonNullSubtype(backend.mapLiteralClass, compiler);
pushInvokeStatic(node, backend.getMapMaker(), [keyValuePairs], mapType);
+ setRtiIfNeeded(peek(), node);
}
visitLiteralMapEntry(LiteralMapEntry node) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/backend.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698