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

Side by Side Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10539042: Recognize nested logical operations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
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 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 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 endExpression(JSPrecedence.PREFIX_PRECEDENCE); 1717 endExpression(JSPrecedence.PREFIX_PRECEDENCE);
1718 } 1718 }
1719 } 1719 }
1720 1720
1721 visitParameterValue(HParameterValue node) { 1721 visitParameterValue(HParameterValue node) {
1722 assert(isGenerateAtUseSite(node)); 1722 assert(isGenerateAtUseSite(node));
1723 buffer.add(variableNames.getName(node)); 1723 buffer.add(variableNames.getName(node));
1724 } 1724 }
1725 1725
1726 visitPhi(HPhi node) { 1726 visitPhi(HPhi node) {
1727 HBasicBlock ifBlock = node.block.predecessors[0].predecessors[0];
1728 // This method is only called for phis that are generated at use 1727 // This method is only called for phis that are generated at use
1729 // site. A phi can be generated at use site only if it is the 1728 // site. A phi can be generated at use site only if it is the
1730 // result of a logical operation. 1729 // result of a logical operation.
1730 HBasicBlock ifBlock = node.block.dominator;
1731 assert(logicalOperations.contains(ifBlock.last)); 1731 assert(logicalOperations.contains(ifBlock.last));
1732 HInstruction input = ifBlock.last.inputs[0]; 1732 HInstruction input = ifBlock.last.inputs[0];
1733 if (input.isConstantFalse()) { 1733 if (input.isConstantFalse()) {
1734 use(node.inputs[1], expectedPrecedence); 1734 use(node.inputs[1], expectedPrecedence);
1735 } else if (input.isConstantTrue()) { 1735 } else if (input.isConstantTrue()) {
1736 use(node.inputs[0], expectedPrecedence); 1736 use(node.inputs[0], expectedPrecedence);
1737 } else { 1737 } else {
1738 String operation = node.inputs[1].isConstantFalse() ? '&&' : '||'; 1738 String operation = node.inputs[1].isConstantFalse() ? '&&' : '||';
1739 JSBinaryOperatorPrecedence operatorPrecedence = 1739 JSBinaryOperatorPrecedence operatorPrecedence =
1740 JSPrecedence.binary[operation]; 1740 JSPrecedence.binary[operation];
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 startBailoutSwitch(); 2673 startBailoutSwitch();
2674 } 2674 }
2675 } 2675 }
2676 2676
2677 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2677 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2678 if (labeledBlockInfo.body.start.hasGuards()) { 2678 if (labeledBlockInfo.body.start.hasGuards()) {
2679 endBailoutSwitch(); 2679 endBailoutSwitch();
2680 } 2680 }
2681 } 2681 }
2682 } 2682 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698