Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index a2ddc04b9174f2ec7b95f68acd3acd199ee0a848..3cc8ade284e4a029d399529198fdf9f2b38c8f87 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -437,6 +437,28 @@ void HLoopInformation::RegisterBackEdge(HBasicBlock* block) { |
| } |
| +void HLoopInformation::ProcessEdge(HBasicBlock* destination) { |
| + HLoopInformation* target_loop = destination->current_loop(); |
| + if (IsInThisLoop(target_loop)) return; |
| + |
| + HLoopInformation* current_loop = this; |
| + while (current_loop != NULL) { |
| + if (target_loop == current_loop) return; |
| + current_loop->exits_count_++; |
| + current_loop = current_loop->parent_loop(); |
| + } |
| +} |
| + |
| + |
| +void HLoopInformation::ProcessThrow() { |
| + HLoopInformation* current_loop = this; |
| + while (current_loop != NULL) { |
|
Jakob Kummerow
2013/04/17 11:34:15
Please add a comment saying that when we support t
Massi
2013/05/07 11:32:03
Done.
|
| + current_loop->exits_count_++; |
| + current_loop = current_loop->parent_loop(); |
| + } |
| +} |
| + |
| + |
| HBasicBlock* HLoopInformation::GetLastBackEdge() const { |
| int max_id = -1; |
| HBasicBlock* result = NULL; |
| @@ -2017,6 +2039,14 @@ void HGraph::OrderBlocks() { |
| HBasicBlock* b = reverse_result[i]; |
| blocks_.Add(b, zone()); |
| b->set_block_id(index++); |
| + |
| + HLoopInformation* loop = b->current_loop(); |
| + if (loop != NULL) { |
| + for (int i = 0; i < b->end()->SuccessorCount(); i++) { |
| + HBasicBlock* successor = b->end()->SuccessorAt(i); |
| + loop->ProcessEdge(successor); |
| + } |
| + } |
| } |
| } |
| @@ -3413,6 +3443,12 @@ void HInferRepresentation::Analyze() { |
| current->CheckFlag(HInstruction::kFlexibleRepresentation)) { |
| current->ChangeRepresentation(Representation::Tagged()); |
| } |
| + |
| + if (current->IsThrow()) { |
|
Jakob Kummerow
2013/04/17 11:34:15
Let's move this into the block ordering phase wher
Massi
2013/05/07 11:32:03
Done.
|
| + if (block->current_loop() != NULL) { |
| + block->current_loop()->ProcessThrow(); |
| + } |
| + } |
| } |
| } |
| } |