Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1855)

Side by Side Diff: runtime/vm/redundancy_elimination.cc

Issue 2390423002: Fix try-catch optimizer. (Closed)
Patch Set: addressed comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/language/try_catch_regress_27483_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3354 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 if (block->try_index() == catch_entry->catch_try_index()) { 3365 if (block->try_index() == catch_entry->catch_try_index()) {
3366 for (ForwardInstructionIterator instr_it(block); 3366 for (ForwardInstructionIterator instr_it(block);
3367 !instr_it.Done(); 3367 !instr_it.Done();
3368 instr_it.Advance()) { 3368 instr_it.Advance()) {
3369 Instruction* current = instr_it.Current(); 3369 Instruction* current = instr_it.Current();
3370 if (current->MayThrow()) { 3370 if (current->MayThrow()) {
3371 Environment* env = current->env()->Outermost(); 3371 Environment* env = current->env()->Outermost();
3372 ASSERT(env != NULL); 3372 ASSERT(env != NULL);
3373 for (intptr_t env_idx = 0; env_idx < cdefs.length(); ++env_idx) { 3373 for (intptr_t env_idx = 0; env_idx < cdefs.length(); ++env_idx) {
3374 if (cdefs[env_idx] != NULL && 3374 if (cdefs[env_idx] != NULL &&
3375 !cdefs[env_idx]->IsConstant() &&
3375 env->ValueAt(env_idx)->BindsToConstant()) { 3376 env->ValueAt(env_idx)->BindsToConstant()) {
3377 // If the recorded definition is not a constant, record this
3378 // definition as the current constant definition.
3376 cdefs[env_idx] = env->ValueAt(env_idx)->definition(); 3379 cdefs[env_idx] = env->ValueAt(env_idx)->definition();
3377 } 3380 }
3378 if (cdefs[env_idx] != env->ValueAt(env_idx)->definition()) { 3381 if (cdefs[env_idx] != env->ValueAt(env_idx)->definition()) {
3382 // Non-constant definitions are reset to NULL.
3379 cdefs[env_idx] = NULL; 3383 cdefs[env_idx] = NULL;
3380 } 3384 }
3381 } 3385 }
3382 } 3386 }
3383 } 3387 }
3384 } 3388 }
3385 } 3389 }
3386 for (intptr_t j = 0; j < idefs->length(); ++j) { 3390 for (intptr_t j = 0; j < idefs->length(); ++j) {
3387 if (cdefs[j] != NULL && cdefs[j]->IsConstant()) { 3391 if (cdefs[j] != NULL && cdefs[j]->IsConstant()) {
3388 // TODO(fschneider): Use constants from the constant pool. 3392 // TODO(fschneider): Use constants from the constant pool.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3482 join->phis_ = NULL; 3486 join->phis_ = NULL;
3483 } else { 3487 } else {
3484 join->phis_->TruncateTo(to_index); 3488 join->phis_->TruncateTo(to_index);
3485 } 3489 }
3486 } 3490 }
3487 } 3491 }
3488 } 3492 }
3489 3493
3490 3494
3491 } // namespace dart 3495 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/try_catch_regress_27483_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698