OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/redundancy_elimination.h" | 5 #include "vm/redundancy_elimination.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/flow_graph.h" | 8 #include "vm/flow_graph.h" |
9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
10 #include "vm/il_printer.h" | 10 #include "vm/il_printer.h" |
(...skipping 2820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 // materializations are not actually used and some fail to compute because | 2831 // materializations are not actually used and some fail to compute because |
2832 // they are inserted in the block that is not dominated by the allocation. | 2832 // they are inserted in the block that is not dominated by the allocation. |
2833 // Remove them unused materializations from the graph. | 2833 // Remove them unused materializations from the graph. |
2834 void AllocationSinking::RemoveUnusedMaterializations() { | 2834 void AllocationSinking::RemoveUnusedMaterializations() { |
2835 intptr_t j = 0; | 2835 intptr_t j = 0; |
2836 for (intptr_t i = 0; i < materializations_.length(); i++) { | 2836 for (intptr_t i = 0; i < materializations_.length(); i++) { |
2837 MaterializeObjectInstr* mat = materializations_[i]; | 2837 MaterializeObjectInstr* mat = materializations_[i]; |
2838 if ((mat->input_use_list() == NULL) && (mat->env_use_list() == NULL)) { | 2838 if ((mat->input_use_list() == NULL) && (mat->env_use_list() == NULL)) { |
2839 // Check if this materialization failed to compute and remove any | 2839 // Check if this materialization failed to compute and remove any |
2840 // unforwarded loads. There were no loads from any allocation sinking | 2840 // unforwarded loads. There were no loads from any allocation sinking |
2841 // candidate in the beggining so it is safe to assume that any encountered | 2841 // candidate in the beginning so it is safe to assume that any encountered |
2842 // load was inserted by CreateMaterializationAt. | 2842 // load was inserted by CreateMaterializationAt. |
2843 for (intptr_t i = 0; i < mat->InputCount(); i++) { | 2843 for (intptr_t i = 0; i < mat->InputCount(); i++) { |
2844 LoadFieldInstr* load = mat->InputAt(i)->definition()->AsLoadField(); | 2844 LoadFieldInstr* load = mat->InputAt(i)->definition()->AsLoadField(); |
2845 if ((load != NULL) && | 2845 if ((load != NULL) && |
2846 (load->instance()->definition() == mat->allocation())) { | 2846 (load->instance()->definition() == mat->allocation())) { |
2847 load->ReplaceUsesWith(flow_graph_->constant_null()); | 2847 load->ReplaceUsesWith(flow_graph_->constant_null()); |
2848 load->RemoveFromGraph(); | 2848 load->RemoveFromGraph(); |
2849 } | 2849 } |
2850 } | 2850 } |
2851 mat->RemoveFromGraph(); | 2851 mat->RemoveFromGraph(); |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3377 join->phis_ = NULL; | 3377 join->phis_ = NULL; |
3378 } else { | 3378 } else { |
3379 join->phis_->TruncateTo(to_index); | 3379 join->phis_->TruncateTo(to_index); |
3380 } | 3380 } |
3381 } | 3381 } |
3382 } | 3382 } |
3383 } | 3383 } |
3384 | 3384 |
3385 | 3385 |
3386 } // namespace dart | 3386 } // namespace dart |
OLD | NEW |