Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) { | |
|
floitsch
2012/02/24 10:15:09
You can keep this code (as otherwise you can't tes
ahe
2012/02/27 11:51:12
Done.
| |
| 802 SourceString name = new SourceString('makeLiteralListConst'); | |
| 803 Element helper = compiler.findHelper(name); | |
| 804 compiler.registerStaticUse(helper); | |
| 805 beginExpression(JSPrecedence.CALL_PRECEDENCE); | |
| 806 buffer.add(compiler.namer.isolateAccess(helper)); | |
| 807 buffer.add('('); | |
| 808 generateArrayLiteral(node); | |
| 809 buffer.add(')'); | |
| 810 endExpression(JSPrecedence.CALL_PRECEDENCE); | |
| 811 } else { | |
| 812 generateArrayLiteral(node); | |
| 813 } | |
| 814 } | |
| 815 | |
| 816 void generateArrayLiteral(HLiteralList node) { | |
| 801 buffer.add('['); | 817 buffer.add('['); |
| 802 int len = node.inputs.length; | 818 int len = node.inputs.length; |
| 803 for (int i = 0; i < len; i++) { | 819 for (int i = 0; i < len; i++) { |
| 804 if (i != 0) buffer.add(', '); | 820 if (i != 0) buffer.add(', '); |
| 805 use(node.inputs[i], JSPrecedence.ASSIGNMENT_PRECEDENCE); | 821 use(node.inputs[i], JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 806 } | 822 } |
| 807 buffer.add(']'); | 823 buffer.add(']'); |
| 808 } | 824 } |
| 809 | 825 |
| 810 void visitIndex(HIndex node) { | 826 void visitIndex(HIndex node) { |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1329 startBailoutSwitch(); | 1345 startBailoutSwitch(); |
| 1330 } | 1346 } |
| 1331 } | 1347 } |
| 1332 | 1348 |
| 1333 void endElse(HIf node) { | 1349 void endElse(HIf node) { |
| 1334 if (node.elseBlock.hasBailouts()) { | 1350 if (node.elseBlock.hasBailouts()) { |
| 1335 endBailoutSwitch(); | 1351 endBailoutSwitch(); |
| 1336 } | 1352 } |
| 1337 } | 1353 } |
| 1338 } | 1354 } |
| OLD | NEW |