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

Side by Side Diff: dart/frog/leg/ssa/codegen.dart

Issue 9453021: Start supporting fixed length and immutable lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Handle constant list expressions. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/frog/leg/ssa/nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 String generate(WorkItem work, HGraph graph) { 9 String generate(WorkItem work, HGraph graph) {
10 return measure(() { 10 return measure(() {
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 791
792 void visitLoad(HLoad node) { 792 void visitLoad(HLoad node) {
793 buffer.add('${local(node.local)}'); 793 buffer.add('${local(node.local)}');
794 } 794 }
795 795
796 void visitLocal(HLocal node) { 796 void visitLocal(HLocal node) {
797 buffer.add('var ${local(node)}'); 797 buffer.add('var ${local(node)}');
798 } 798 }
799 799
800 void visitLiteralList(HLiteralList node) { 800 void visitLiteralList(HLiteralList node) {
801 if (node.isConst) {
802 // TODO(floitsch): Remove this when CTC handles arrays.
803 SourceString name = new SourceString('makeLiteralListConst');
804 Element helper = compiler.findHelper(name);
805 compiler.registerStaticUse(helper);
806 beginExpression(JSPrecedence.CALL_PRECEDENCE);
807 buffer.add(compiler.namer.isolateAccess(helper));
808 buffer.add('(');
809 generateArrayLiteral(node);
810 buffer.add(')');
811 endExpression(JSPrecedence.CALL_PRECEDENCE);
812 } else {
813 generateArrayLiteral(node);
814 }
815 }
816
817 void generateArrayLiteral(HLiteralList node) {
801 buffer.add('['); 818 buffer.add('[');
802 int len = node.inputs.length; 819 int len = node.inputs.length;
803 for (int i = 0; i < len; i++) { 820 for (int i = 0; i < len; i++) {
804 if (i != 0) buffer.add(', '); 821 if (i != 0) buffer.add(', ');
805 use(node.inputs[i], JSPrecedence.ASSIGNMENT_PRECEDENCE); 822 use(node.inputs[i], JSPrecedence.ASSIGNMENT_PRECEDENCE);
806 } 823 }
807 buffer.add(']'); 824 buffer.add(']');
808 } 825 }
809 826
810 void visitIndex(HIndex node) { 827 void visitIndex(HIndex node) {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 startBailoutSwitch(); 1346 startBailoutSwitch();
1330 } 1347 }
1331 } 1348 }
1332 1349
1333 void endElse(HIf node) { 1350 void endElse(HIf node) {
1334 if (node.elseBlock.hasBailouts()) { 1351 if (node.elseBlock.hasBailouts()) {
1335 endBailoutSwitch(); 1352 endBailoutSwitch();
1336 } 1353 }
1337 } 1354 }
1338 } 1355 }
OLDNEW
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/frog/leg/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698