| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3364 } else { | 3364 } else { |
| 3365 // TODO(vegorov): this can be optimized for the case of a single | 3365 // TODO(vegorov): this can be optimized for the case of a single |
| 3366 // predecessor. | 3366 // predecessor. |
| 3367 // TODO(vegorov): this can be reordered to reduce amount of operations | 3367 // TODO(vegorov): this can be reordered to reduce amount of operations |
| 3368 // temp->CopyFrom(first_predecessor) | 3368 // temp->CopyFrom(first_predecessor) |
| 3369 temp->SetAll(); | 3369 temp->SetAll(); |
| 3370 ASSERT(block->PredecessorCount() > 0); | 3370 ASSERT(block->PredecessorCount() > 0); |
| 3371 for (intptr_t i = 0; i < block->PredecessorCount(); i++) { | 3371 for (intptr_t i = 0; i < block->PredecessorCount(); i++) { |
| 3372 BlockEntryInstr* pred = block->PredecessorAt(i); | 3372 BlockEntryInstr* pred = block->PredecessorAt(i); |
| 3373 BitVector* pred_out = out_[pred->preorder_number()]; | 3373 BitVector* pred_out = out_[pred->preorder_number()]; |
| 3374 temp->Intersect(*pred_out); | 3374 temp->Intersect(pred_out); |
| 3375 } | 3375 } |
| 3376 } | 3376 } |
| 3377 | 3377 |
| 3378 if (!temp->Equals(*block_in)) { | 3378 if (!temp->Equals(*block_in)) { |
| 3379 // If IN set has changed propagate the change to OUT set. | 3379 // If IN set has changed propagate the change to OUT set. |
| 3380 block_in->CopyFrom(temp); | 3380 block_in->CopyFrom(temp); |
| 3381 if (block_out->KillAndAdd(block_kill, block_in)) { | 3381 if (block_out->KillAndAdd(block_kill, block_in)) { |
| 3382 // If OUT set has changed then we have new values available out of | 3382 // If OUT set has changed then we have new values available out of |
| 3383 // the block. Compute these values creating phi where necessary. | 3383 // the block. Compute these values creating phi where necessary. |
| 3384 for (BitVector::Iterator it(block_out); | 3384 for (BitVector::Iterator it(block_out); |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5016 if (changed) { | 5016 if (changed) { |
| 5017 // We may have changed the block order and the dominator tree. | 5017 // We may have changed the block order and the dominator tree. |
| 5018 flow_graph->DiscoverBlocks(); | 5018 flow_graph->DiscoverBlocks(); |
| 5019 GrowableArray<BitVector*> dominance_frontier; | 5019 GrowableArray<BitVector*> dominance_frontier; |
| 5020 flow_graph->ComputeDominators(&dominance_frontier); | 5020 flow_graph->ComputeDominators(&dominance_frontier); |
| 5021 } | 5021 } |
| 5022 } | 5022 } |
| 5023 | 5023 |
| 5024 | 5024 |
| 5025 } // namespace dart | 5025 } // namespace dart |
| OLD | NEW |