| 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 final JavaScriptBackend backend; | 6 final JavaScriptBackend backend; |
| 7 SsaCodeGeneratorTask(JavaScriptBackend backend) | 7 SsaCodeGeneratorTask(JavaScriptBackend backend) |
| 8 : this.backend = backend, | 8 : this.backend = backend, |
| 9 super(backend.compiler); | 9 super(backend.compiler); |
| 10 String get name() => 'SSA code generator'; | 10 String get name() => 'SSA code generator'; |
| (...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 endExpression(JSPrecedence.PREFIX_PRECEDENCE); | 1732 endExpression(JSPrecedence.PREFIX_PRECEDENCE); |
| 1733 } | 1733 } |
| 1734 } | 1734 } |
| 1735 | 1735 |
| 1736 visitParameterValue(HParameterValue node) { | 1736 visitParameterValue(HParameterValue node) { |
| 1737 assert(isGenerateAtUseSite(node)); | 1737 assert(isGenerateAtUseSite(node)); |
| 1738 buffer.add(variableNames.getName(node)); | 1738 buffer.add(variableNames.getName(node)); |
| 1739 } | 1739 } |
| 1740 | 1740 |
| 1741 visitPhi(HPhi node) { | 1741 visitPhi(HPhi node) { |
| 1742 HBasicBlock ifBlock = node.block.predecessors[0].predecessors[0]; | |
| 1743 // This method is only called for phis that are generated at use | 1742 // This method is only called for phis that are generated at use |
| 1744 // site. A phi can be generated at use site only if it is the | 1743 // site. A phi can be generated at use site only if it is the |
| 1745 // result of a logical operation. | 1744 // result of a logical operation. |
| 1745 HBasicBlock ifBlock = node.block.dominator; |
| 1746 assert(logicalOperations.contains(ifBlock.last)); | 1746 assert(logicalOperations.contains(ifBlock.last)); |
| 1747 HInstruction input = ifBlock.last.inputs[0]; | 1747 HInstruction input = ifBlock.last.inputs[0]; |
| 1748 if (input.isConstantFalse()) { | 1748 if (input.isConstantFalse()) { |
| 1749 use(node.inputs[1], expectedPrecedence); | 1749 use(node.inputs[1], expectedPrecedence); |
| 1750 } else if (input.isConstantTrue()) { | 1750 } else if (input.isConstantTrue()) { |
| 1751 use(node.inputs[0], expectedPrecedence); | 1751 use(node.inputs[0], expectedPrecedence); |
| 1752 } else { | 1752 } else { |
| 1753 String operation = node.inputs[1].isConstantFalse() ? '&&' : '||'; | 1753 String operation = node.inputs[1].isConstantFalse() ? '&&' : '||'; |
| 1754 JSBinaryOperatorPrecedence operatorPrecedence = | 1754 JSBinaryOperatorPrecedence operatorPrecedence = |
| 1755 JSPrecedence.binary[operation]; | 1755 JSPrecedence.binary[operation]; |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2692 startBailoutSwitch(); | 2692 startBailoutSwitch(); |
| 2693 } | 2693 } |
| 2694 } | 2694 } |
| 2695 | 2695 |
| 2696 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { | 2696 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { |
| 2697 if (labeledBlockInfo.body.start.hasGuards()) { | 2697 if (labeledBlockInfo.body.start.hasGuards()) { |
| 2698 endBailoutSwitch(); | 2698 endBailoutSwitch(); |
| 2699 } | 2699 } |
| 2700 } | 2700 } |
| 2701 } | 2701 } |
| OLD | NEW |