Chromium Code Reviews| Index: lib/compiler/implementation/ssa/codegen_helpers.dart |
| diff --git a/lib/compiler/implementation/ssa/codegen_helpers.dart b/lib/compiler/implementation/ssa/codegen_helpers.dart |
| index b747a08ab7f953bcf923bbb69097fdd88f463c73..4344721da0b14d7f8ad8f767a296dbf9ed10fc3e 100644 |
| --- a/lib/compiler/implementation/ssa/codegen_helpers.dart |
| +++ b/lib/compiler/implementation/ssa/codegen_helpers.dart |
| @@ -16,6 +16,11 @@ class SsaInstructionMerger extends HBaseVisitor { |
| List<HInstruction> expectedInputs; |
| Set<HInstruction> generateAtUseSite; |
| + void markAsGenerateAtUseSite(HInstruction instruction) { |
| + assert(!instruction.isStatement); |
| + generateAtUseSite.add(instruction); |
| + } |
| + |
| SsaInstructionMerger(this.generateAtUseSite); |
| void visitGraph(HGraph graph) { |
| @@ -60,7 +65,7 @@ class SsaInstructionMerger extends HBaseVisitor { |
| void visitTypeConversion(HTypeConversion instruction) { |
| if (!instruction.isChecked) { |
| - generateAtUseSite.add(instruction); |
| + markAsGenerateAtUseSite(instruction); |
| } else if (instruction.isCheckedModeCheck) { |
| // Checked mode checks compile to code that only use their input |
| // once, so we can safely visit them and try to merge the input. |
| @@ -70,7 +75,7 @@ class SsaInstructionMerger extends HBaseVisitor { |
| void tryGenerateAtUseSite(HInstruction instruction) { |
| if (instruction.isControlFlow()) return; |
| - generateAtUseSite.add(instruction); |
| + markAsGenerateAtUseSite(instruction); |
| } |
| bool isBlockSinglePredecessor(HBasicBlock block) { |
| @@ -119,9 +124,12 @@ class SsaInstructionMerger extends HBaseVisitor { |
| continue; |
| } |
| if (instruction.isCodeMotionInvariant()) { |
| - generateAtUseSite.add(instruction); |
| + markAsGenerateAtUseSite(instruction); |
| continue; |
| } |
| + if (instruction.isStatement) { |
|
ngeoffray
2012/08/17 13:08:58
Please explain which inputs can be statements. May
floitsch
2012/08/29 11:03:12
Changed to isJsStatement.
|
| + expectedInputs.clear(); |
| + } |
| // See if the current instruction is the next non-trivial |
| // expected input. |
| if (findInInputsAndPopNonMatching(instruction)) { |
| @@ -151,6 +159,11 @@ class SsaConditionMerger extends HGraphVisitor { |
| Set<HInstruction> generateAtUseSite; |
| Set<HInstruction> controlFlowOperators; |
| + void markAsGenerateAtUseSite(HInstruction instruction) { |
| + assert(!instruction.isStatement); |
| + generateAtUseSite.add(instruction); |
| + } |
| + |
| SsaConditionMerger(this.generateAtUseSite, this.controlFlowOperators); |
| void visitGraph(HGraph graph) { |
| @@ -222,6 +235,7 @@ class SsaConditionMerger extends HGraphVisitor { |
| HPhi phi = end.phis.first; |
| HInstruction thenInput = phi.inputs[0]; |
| HInstruction elseInput = phi.inputs[1]; |
| + if (thenInput.isStatement || elseInput.isStatement) return; |
| if (hasAnyStatement(elseBlock, elseInput)) return; |
| assert(elseBlock.successors.length == 1); |
| @@ -251,24 +265,24 @@ class SsaConditionMerger extends HGraphVisitor { |
| controlFlowOperators.add(startIf); |
| // If the operation is only used by the first instruction |
| - // of its block and is safe to be generated at use sute, mark it |
| + // of its block and is safe to be generated at use site, mark it |
| // so. |
| if (phi.usedBy.length == 1 |
| && phi.usedBy[0] === phi.block.first |
| && isSafeToGenerateAtUseSite(phi.usedBy[0], phi)) { |
| - generateAtUseSite.add(phi); |
| + markAsGenerateAtUseSite(phi); |
| } |
| if (elseInput.block === elseBlock) { |
| assert(elseInput.usedBy.length == 1); |
| - generateAtUseSite.add(elseInput); |
| + markAsGenerateAtUseSite(elseInput); |
| } |
| // If [thenInput] is defined in the first predecessor, then it is only used |
| // by [phi] and can be generated at use site. |
| if (thenInput.block === end.predecessors[0]) { |
| assert(thenInput.usedBy.length == 1); |
| - generateAtUseSite.add(thenInput); |
| + markAsGenerateAtUseSite(thenInput); |
| } |
| } |
| } |