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

Unified Diff: dart/frog/leg/ssa/builder.dart

Issue 9558005: Implement literal maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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: dart/frog/leg/ssa/builder.dart
diff --git a/dart/frog/leg/ssa/builder.dart b/dart/frog/leg/ssa/builder.dart
index 9db538b274b2a99adeeb0344025f2d09cbd55fff..22f99de89a7390ce5b25cedabaf392f0dc909aed 100644
--- a/dart/frog/leg/ssa/builder.dart
+++ b/dart/frog/leg/ssa/builder.dart
@@ -93,6 +93,10 @@ class Interceptors {
Element getExceptionUnwrapper() {
return compiler.findHelper(const SourceString('unwrapException'));
}
+
+ Element getMapMaker() {
+ return compiler.findHelper(const SourceString('makeLiteralMap'));
+ }
}
class SsaBuilderTask extends CompilerTask {
@@ -2236,11 +2240,22 @@ class SsaBuilder implements Visitor {
}
visitLiteralMap(LiteralMap node) {
- generateUnimplemented('literal map not implemented', isExpression: true);
+ List<HInstruction> inputs = <HInstruction>[];
+ for (Link<Node> link = node.entries.nodes;
+ !link.isEmpty();
+ link = link.tail) {
+ visit(link.head);
+ inputs.addLast(pop());
+ inputs.addLast(pop());
+ }
+ push(new HLiteralList(inputs, node.isConst()));
+ push(new HStatic(interceptors.getMapMaker()));
ngeoffray 2012/03/01 08:36:09 Note that you don't really need to push, you could
ahe 2012/03/06 15:34:12 Done.
+ push(new HInvokeStatic(Selector.INVOCATION_1, <HInstruction>[pop(), pop()]));
ngeoffray 2012/03/01 08:36:09 Line too long.
ahe 2012/03/06 15:34:12 Done.
}
visitLiteralMapEntry(LiteralMapEntry node) {
- compiler.unimplemented('SsaBuilder.visitLiteralMapEntry', node: node);
+ visit(node.value);
+ visit(node.key);
}
visitNamedArgument(NamedArgument node) {

Powered by Google App Engine
This is Rietveld 408576698