| 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 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3175 | 3175 |
| 3176 void AllocationSinking::ExitsCollector::CollectTransitively(Definition* alloc) { | 3176 void AllocationSinking::ExitsCollector::CollectTransitively(Definition* alloc) { |
| 3177 exits_.TruncateTo(0); | 3177 exits_.TruncateTo(0); |
| 3178 worklist_.TruncateTo(0); | 3178 worklist_.TruncateTo(0); |
| 3179 | 3179 |
| 3180 worklist_.Add(alloc); | 3180 worklist_.Add(alloc); |
| 3181 | 3181 |
| 3182 // Note: worklist potentially will grow while we are iterating over it. | 3182 // Note: worklist potentially will grow while we are iterating over it. |
| 3183 // We are not removing allocations from the worklist not to waste space on | 3183 // We are not removing allocations from the worklist not to waste space on |
| 3184 // the side maintaining BitVector of already processed allocations: worklist | 3184 // the side maintaining BitVector of already processed allocations: worklist |
| 3185 // is expected to be very small thus linear search in it is just as effecient | 3185 // is expected to be very small thus linear search in it is just as efficient |
| 3186 // as a bitvector. | 3186 // as a bitvector. |
| 3187 for (intptr_t i = 0; i < worklist_.length(); i++) { | 3187 for (intptr_t i = 0; i < worklist_.length(); i++) { |
| 3188 Collect(worklist_[i]); | 3188 Collect(worklist_[i]); |
| 3189 } | 3189 } |
| 3190 } | 3190 } |
| 3191 | 3191 |
| 3192 | 3192 |
| 3193 void AllocationSinking::InsertMaterializations(Definition* alloc) { | 3193 void AllocationSinking::InsertMaterializations(Definition* alloc) { |
| 3194 // Collect all fields that are written for this instance. | 3194 // Collect all fields that are written for this instance. |
| 3195 ZoneGrowableArray<const Object*>* slots = | 3195 ZoneGrowableArray<const Object*>* slots = |
| (...skipping 181 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 |