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 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3346 | 3346 |
3347 // Initialize cdefs with the original initial definitions (ParameterInstr). | 3347 // Initialize cdefs with the original initial definitions (ParameterInstr). |
3348 // The following representation is used: | 3348 // The following representation is used: |
3349 // ParameterInstr => unknown | 3349 // ParameterInstr => unknown |
3350 // ConstantInstr => known constant | 3350 // ConstantInstr => known constant |
3351 // NULL => non-constant | 3351 // NULL => non-constant |
3352 GrowableArray<Definition*>* idefs = catch_entry->initial_definitions(); | 3352 GrowableArray<Definition*>* idefs = catch_entry->initial_definitions(); |
3353 GrowableArray<Definition*> cdefs(idefs->length()); | 3353 GrowableArray<Definition*> cdefs(idefs->length()); |
3354 cdefs.AddArray(*idefs); | 3354 cdefs.AddArray(*idefs); |
3355 | 3355 |
3356 // exception_var and stacktrace_var are never constant. | 3356 // exception_var and stacktrace_var are never constant. In asynchronous or |
3357 intptr_t ex_idx = base - catch_entry->exception_var().index(); | 3357 // generator functions they may be context-allocated in which case they are |
3358 intptr_t st_idx = base - catch_entry->stacktrace_var().index(); | 3358 // not tracked in the environment anyway. |
3359 cdefs[ex_idx] = cdefs[st_idx] = NULL; | 3359 if (!catch_entry->exception_var().is_captured()) { |
| 3360 cdefs[base - catch_entry->exception_var().index()] = NULL; |
| 3361 } |
| 3362 if (!catch_entry->stacktrace_var().is_captured()) { |
| 3363 cdefs[base - catch_entry->stacktrace_var().index()] = NULL; |
| 3364 } |
3360 | 3365 |
3361 for (BlockIterator block_it = flow_graph->reverse_postorder_iterator(); | 3366 for (BlockIterator block_it = flow_graph->reverse_postorder_iterator(); |
3362 !block_it.Done(); | 3367 !block_it.Done(); |
3363 block_it.Advance()) { | 3368 block_it.Advance()) { |
3364 BlockEntryInstr* block = block_it.Current(); | 3369 BlockEntryInstr* block = block_it.Current(); |
3365 if (block->try_index() == catch_entry->catch_try_index()) { | 3370 if (block->try_index() == catch_entry->catch_try_index()) { |
3366 for (ForwardInstructionIterator instr_it(block); | 3371 for (ForwardInstructionIterator instr_it(block); |
3367 !instr_it.Done(); | 3372 !instr_it.Done(); |
3368 instr_it.Advance()) { | 3373 instr_it.Advance()) { |
3369 Instruction* current = instr_it.Current(); | 3374 Instruction* current = instr_it.Current(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3486 join->phis_ = NULL; | 3491 join->phis_ = NULL; |
3487 } else { | 3492 } else { |
3488 join->phis_->TruncateTo(to_index); | 3493 join->phis_->TruncateTo(to_index); |
3489 } | 3494 } |
3490 } | 3495 } |
3491 } | 3496 } |
3492 } | 3497 } |
3493 | 3498 |
3494 | 3499 |
3495 } // namespace dart | 3500 } // namespace dart |
OLD | NEW |