| 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 | 9 |
| 10 String generateMethod(WorkItem work, HGraph graph) { | 10 String generateMethod(WorkItem work, HGraph graph) { |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 void visitStaticStore(HStaticStore node) { | 1255 void visitStaticStore(HStaticStore node) { |
| 1256 compiler.registerStaticUse(node.element); | 1256 compiler.registerStaticUse(node.element); |
| 1257 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); | 1257 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 1258 buffer.add(compiler.namer.isolateAccess(node.element)); | 1258 buffer.add(compiler.namer.isolateAccess(node.element)); |
| 1259 buffer.add(' = '); | 1259 buffer.add(' = '); |
| 1260 use(node.inputs[0], JSPrecedence.ASSIGNMENT_PRECEDENCE); | 1260 use(node.inputs[0], JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 1261 endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); | 1261 endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 void visitLiteralList(HLiteralList node) { | 1264 void visitLiteralList(HLiteralList node) { |
| 1265 if (node.isConst) { | 1265 generateArrayLiteral(node); |
| 1266 // TODO(floitsch): Remove this when CTC handles arrays. | |
| 1267 SourceString name = new SourceString('makeLiteralListConst'); | |
| 1268 Element helper = compiler.findHelper(name); | |
| 1269 compiler.registerStaticUse(helper); | |
| 1270 beginExpression(JSPrecedence.CALL_PRECEDENCE); | |
| 1271 buffer.add(compiler.namer.isolateAccess(helper)); | |
| 1272 buffer.add('('); | |
| 1273 generateArrayLiteral(node); | |
| 1274 buffer.add(')'); | |
| 1275 endExpression(JSPrecedence.CALL_PRECEDENCE); | |
| 1276 } else { | |
| 1277 generateArrayLiteral(node); | |
| 1278 } | |
| 1279 } | 1266 } |
| 1280 | 1267 |
| 1281 void generateArrayLiteral(HLiteralList node) { | 1268 void generateArrayLiteral(HLiteralList node) { |
| 1282 buffer.add('['); | 1269 buffer.add('['); |
| 1283 int len = node.inputs.length; | 1270 int len = node.inputs.length; |
| 1284 for (int i = 0; i < len; i++) { | 1271 for (int i = 0; i < len; i++) { |
| 1285 if (i != 0) buffer.add(', '); | 1272 if (i != 0) buffer.add(', '); |
| 1286 use(node.inputs[i], JSPrecedence.ASSIGNMENT_PRECEDENCE); | 1273 use(node.inputs[i], JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 1287 } | 1274 } |
| 1288 buffer.add(']'); | 1275 buffer.add(']'); |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 startBailoutSwitch(); | 1848 startBailoutSwitch(); |
| 1862 } | 1849 } |
| 1863 } | 1850 } |
| 1864 | 1851 |
| 1865 void endElse(HIf node) { | 1852 void endElse(HIf node) { |
| 1866 if (node.elseBlock.hasGuards()) { | 1853 if (node.elseBlock.hasGuards()) { |
| 1867 endBailoutSwitch(); | 1854 endBailoutSwitch(); |
| 1868 } | 1855 } |
| 1869 } | 1856 } |
| 1870 } | 1857 } |
| OLD | NEW |