Chromium Code Reviews| Index: runtime/vm/flow_graph.cc |
| =================================================================== |
| --- runtime/vm/flow_graph.cc (revision 37442) |
| +++ runtime/vm/flow_graph.cc (working copy) |
| @@ -1000,6 +1000,30 @@ |
| void FlowGraph::RemoveDeadPhis(GrowableArray<PhiInstr*>* live_phis) { |
| + // Augment live_phis with those that have implicit real used at |
| + // potentially throwing instructions if there is a try-catch in this graph. |
| + if (graph_entry()->SuccessorCount() > 1) { |
| + for (BlockIterator it(postorder_iterator()); !it.Done(); it.Advance()) { |
| + JoinEntryInstr* join = it.Current()->AsJoinEntry(); |
| + if (join == NULL) continue; |
| + for (PhiIterator phi_it(join); !phi_it.Done(); phi_it.Advance()) { |
| + PhiInstr* phi = phi_it.Current(); |
| + if (phi == NULL || phi->env_use_list() == NULL) continue; |
|
Vyacheslav Egorov (Google)
2014/06/18 14:21:27
You can skip any phis that has non empty input_use
Florian Schneider
2014/06/18 14:25:40
Done.
|
| + for (Value::Iterator it(phi->env_use_list()); |
| + !it.Done(); |
| + it.Advance()) { |
| + Value* use = it.Current(); |
| + if (use->instruction()->MayThrow() && |
| + use->instruction()->GetBlock()->InsideTryBlock()) { |
| + live_phis->Add(phi); |
| + phi->mark_alive(); |
| + break; |
| + } |
| + } |
| + } |
| + } |
| + } |
| + |
| while (!live_phis->is_empty()) { |
| PhiInstr* phi = live_phis->RemoveLast(); |
| for (intptr_t i = 0; i < phi->InputCount(); i++) { |
| @@ -1014,7 +1038,7 @@ |
| for (BlockIterator it(postorder_iterator()); !it.Done(); it.Advance()) { |
| JoinEntryInstr* join = it.Current()->AsJoinEntry(); |
| - if (join != NULL) join->RemoveDeadPhis(constant_null()); |
| + if (join != NULL) join->RemoveDeadPhis(constant_dead()); |
| } |
| } |