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

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: 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
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..b247beaedfdc95740886fd811d3a563688c98968 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,17 @@ 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));
+ }
+ print(arguments);
kasperl 2013/11/01 10:30:57 Get rid of the printing.
karlklose 2013/11/01 10:35:01 Done.
+ callSetRuntimeTypeInfo(type.element, arguments, object);
+ }
+
visitLiteralList(LiteralList node) {
HInstruction instruction;
@@ -4516,6 +4529,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 +4731,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) {

Powered by Google App Engine
This is Rietveld 408576698