Chromium Code Reviews| Index: dart/lib/compiler/implementation/ssa/codegen.dart |
| diff --git a/dart/lib/compiler/implementation/ssa/codegen.dart b/dart/lib/compiler/implementation/ssa/codegen.dart |
| index 91f179dc4a9da9b9577922cbbe83d70de4e0b08f..aac27f7721d1aee0eb3062055c2afbf6b65a34cc 100644 |
| --- a/dart/lib/compiler/implementation/ssa/codegen.dart |
| +++ b/dart/lib/compiler/implementation/ssa/codegen.dart |
| @@ -902,23 +902,37 @@ class SsaCodeGenerator implements HVisitor { |
| } |
| visitIf(HIf node) { |
| + HInstruction condition = node.inputs[0]; |
| + int preVisitedBlocks = 1; |
|
Lasse Reichstein Nielsen
2012/03/30 12:56:02
I'd actually prefer to initialize it to zero, and
ahe
2012/03/30 13:15:52
Done.
|
| List<HBasicBlock> dominated = node.block.dominatedBlocks; |
| HIfBlockInformation info = node.blockInformation; |
| - startIf(node); |
| - assert(!isGenerateAtUseSite(node)); |
| - startThen(node); |
| - assert(node.thenBlock === dominated[0]); |
| - visitSubGraph(info.thenGraph); |
| - int preVisitedBlocks = 1; |
| - endThen(node); |
| - if (node.hasElse) { |
| - startElse(node); |
| - assert(node.elseBlock === dominated[1]); |
| - visitSubGraph(info.elseGraph); |
| - preVisitedBlocks = 2; |
| - endElse(node); |
| - } |
| - endIf(node); |
| + if (false && condition.isConstant()) { |
|
Lasse Reichstein Nielsen
2012/03/30 12:56:02
"false &&"?
ahe
2012/03/30 13:15:52
Done.
|
| + HConstant constant = condition; |
| + if (constant.constant.isTrue()) { |
| + visitSubGraph(info.thenGraph); |
|
Lasse Reichstein Nielsen
2012/03/30 12:56:02
Increment preVisitedBlocks here, or set it to 1, o
|
| + if (node.hasElse) { |
| + preVisitedBlocks = 2; |
| + } |
| + } else if (node.hasElse) { |
| + preVisitedBlocks = 2; |
|
Lasse Reichstein Nielsen
2012/03/30 12:56:02
Here you set it to 1 (possibly with comment about
|
| + visitSubGraph(info.elseGraph); |
|
Lasse Reichstein Nielsen
2012/03/30 12:56:02
And to 2 after visiting the else-part.
|
| + } |
| + } else { |
| + startIf(node); |
| + assert(!isGenerateAtUseSite(node)); |
| + startThen(node); |
| + assert(node.thenBlock === dominated[0]); |
| + visitSubGraph(info.thenGraph); |
| + endThen(node); |
| + if (node.hasElse) { |
| + startElse(node); |
| + assert(node.elseBlock === dominated[1]); |
| + visitSubGraph(info.elseGraph); |
| + preVisitedBlocks = 2; |
| + endElse(node); |
| + } |
| + endIf(node); |
| + } |
| if (info.joinBlock !== null && info.joinBlock.dominator !== node.block) { |
| // The join block is dominated by a block in one of the branches. |
| // The subgraph traversal never reached it, so we visit it here |