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 | 9 |
| 10 String generateMethod(WorkItem work, HGraph graph) { | 10 String generateMethod(WorkItem work, HGraph graph) { |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 // TODO(floitsch): the compile-time constant handler and the codegen | 821 // TODO(floitsch): the compile-time constant handler and the codegen |
| 822 // need to work together to avoid the parenthesis. See r4928 for an | 822 // need to work together to avoid the parenthesis. See r4928 for an |
| 823 // implementation that still dealt with precedence. | 823 // implementation that still dealt with precedence. |
| 824 ConstantHandler handler = compiler.constantHandler; | 824 ConstantHandler handler = compiler.constantHandler; |
| 825 String name = handler.getNameForConstant(node.constant); | 825 String name = handler.getNameForConstant(node.constant); |
| 826 if (name === null) { | 826 if (name === null) { |
| 827 assert(!node.constant.isObject()); | 827 assert(!node.constant.isObject()); |
| 828 if (node.constant.isNum() | 828 if (node.constant.isNum() |
| 829 && expectedPrecedence == JSPrecedence.MEMBER_PRECEDENCE) { | 829 && expectedPrecedence == JSPrecedence.MEMBER_PRECEDENCE) { |
| 830 buffer.add('('); | 830 buffer.add('('); |
| 831 node.constant.writeJsCode(buffer, handler); | 831 node.constant.writeJsCode(buffer, handler); |
|
ngeoffray
2012/03/30 08:28:32
How about this one? Being a num helps you know it'
floitsch
2012/03/30 18:11:49
Done.
| |
| 832 buffer.add(')'); | 832 buffer.add(')'); |
| 833 } else { | 833 } else { |
| 834 node.constant.writeJsCode(buffer, handler); | 834 node.constant.writeCanonicalizedJsCode(buffer, handler); |
| 835 } | 835 } |
| 836 } else { | 836 } else { |
| 837 buffer.add(compiler.namer.CURRENT_ISOLATE); | 837 buffer.add(compiler.namer.CURRENT_ISOLATE); |
| 838 buffer.add("."); | 838 buffer.add("."); |
| 839 buffer.add(name); | 839 buffer.add(name); |
| 840 } | 840 } |
| 841 } | 841 } |
| 842 | 842 |
| 843 visitLoopBranch(HLoopBranch node) { | 843 visitLoopBranch(HLoopBranch node) { |
| 844 HBasicBlock branchBlock = currentBlock; | 844 HBasicBlock branchBlock = currentBlock; |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1561 startBailoutSwitch(); | 1561 startBailoutSwitch(); |
| 1562 } | 1562 } |
| 1563 } | 1563 } |
| 1564 | 1564 |
| 1565 void endElse(HIf node) { | 1565 void endElse(HIf node) { |
| 1566 if (node.elseBlock.hasGuards()) { | 1566 if (node.elseBlock.hasGuards()) { |
| 1567 endBailoutSwitch(); | 1567 endBailoutSwitch(); |
| 1568 } | 1568 } |
| 1569 } | 1569 } |
| 1570 } | 1570 } |
| OLD | NEW |