Index: src/lithium.cc |
diff --git a/src/lithium.cc b/src/lithium.cc |
index 790a2182b176ac5d86e701e01395297d90c6e5ca..48763892d15f4b762ca45e98c22dc9ee906b61d8 100644 |
--- a/src/lithium.cc |
+++ b/src/lithium.cc |
@@ -492,6 +492,51 @@ void LChunk::set_allocated_double_registers(BitVector* allocated_registers) { |
} |
+LInstruction* LChunkBuilder::ElideControlInstruction( |
+ HControlInstruction* instr, |
+ bool condition) { |
+ HBasicBlock* successor = condition |
+ ? instr->FirstSuccessor() |
+ : instr->SecondSuccessor(); |
+ HBasicBlock* unreachable = condition |
+ ? instr->SecondSuccessor() |
+ : instr->FirstSuccessor(); |
+ unreachable->MarkUnreachable(); |
+ return new(zone()) LGoto(successor->block_id()); |
+} |
+ |
+ |
+void LChunkBuilder::PropagateUnreachableBlockMarks() { |
Michael Starzinger
2013/08/16 15:02:20
As discussed offline: This looks like it should be
Jakob Kummerow
2013/08/30 11:52:43
Am I missing something, or is this method never ca
|
+ // If there is unreachable code in the graph, propagate the unreachable marks |
+ // using a fixed-point iteration. |
+ if (graph()->HasUnreachableCode()) { |
Jakob Kummerow
2013/08/20 08:46:56
You can avoid a level of indentation by turning th
|
+ bool changed = true; |
+ const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); |
+ while (changed) { |
+ changed = false; |
+ for (int i = 0; i < blocks->length(); i++) { |
+ HBasicBlock* block = blocks->at(i); |
+ if (block->IsReachable()) { |
+ bool is_reachable = blocks->at(0) == block; |
+ for (HPredecessorIterator it(block); !it.Done(); it.Advance()) { |
+ HBasicBlock* predecessor = it.Current(); |
+ if (predecessor->IsReachable() && |
+ !predecessor->IsDeoptimizing()) { |
+ is_reachable = true; |
+ break; |
+ } |
+ } |
+ if (!is_reachable) { |
+ block->MarkUnreachable(); |
+ changed = true; |
+ } |
+ } |
+ } |
+ } |
+ } |
+} |
+ |
+ |
LPhase::~LPhase() { |
if (ShouldProduceTraceOutput()) { |
isolate()->GetHTracer()->TraceLithium(name(), chunk_); |