4312 {
4313
4314 if (is_aot_) {
4315 OptimizeDeadParameters();
4316 }
4317
4318
4319
4320
4321
4322 const GrowableArray<CatchBlockEntryInstr*>& catch_entries =
4324
4325 for (auto catch_entry : catch_entries) {
4326
4327
4328
4329
4330
4331 GrowableArray<Definition*>* idefs = catch_entry->initial_definitions();
4332 GrowableArray<Definition*> cdefs(idefs->length());
4333 cdefs.AddArray(*idefs);
4334
4335
4336
4337
4338
4339 cdefs[flow_graph_->
EnvIndex(catch_entry->raw_exception_var())] =
nullptr;
4340 cdefs[flow_graph_->
EnvIndex(catch_entry->raw_stacktrace_var())] =
nullptr;
4341
4343 !block_it.Done(); block_it.Advance()) {
4344 BlockEntryInstr* block = block_it.Current();
4345 if (block->try_index() == catch_entry->catch_try_index()) {
4346 for (ForwardInstructionIterator instr_it(block); !instr_it.Done();
4347 instr_it.Advance()) {
4348 Instruction* current = instr_it.Current();
4349 if (current->MayThrow()) {
4350 Environment*
env = current->env()->Outermost();
4352 for (intptr_t env_idx = 0; env_idx < cdefs.length(); ++env_idx) {
4353 if (cdefs[env_idx] !=
nullptr && !cdefs[env_idx]->
IsConstant() &&
4354 env->ValueAt(env_idx)->BindsToConstant()) {
4355
4356
4357 cdefs[env_idx] =
env->ValueAt(env_idx)->definition();
4358 }
4359 if (cdefs[env_idx] !=
env->ValueAt(env_idx)->definition()) {
4360
4361 cdefs[env_idx] = nullptr;
4362 }
4363 }
4364 }
4365 }
4366 }
4367 }
4368 for (intptr_t j = 0; j < idefs->length(); ++j) {
4369 if (cdefs[j] !=
nullptr && cdefs[j]->
IsConstant()) {
4370 Definition* old = (*idefs)[j];
4371 ConstantInstr* orig = cdefs[j]->AsConstant();
4372 ConstantInstr*
copy =
4373 new (flow_graph_->
zone()) ConstantInstr(orig->value());
4375 old->ReplaceUsesWith(
copy);
4376 copy->set_previous(old->previous());
4378 }
4379 }
4380 }
4381}
GraphEntryInstr * graph_entry() const
void AllocateSSAIndex(Definition *def)
BlockIterator reverse_postorder_iterator() const
intptr_t EnvIndex(const LocalVariable *variable) const
const GrowableArray< CatchBlockEntryInstr * > & catch_entries() const
static bool IsConstant(Definition *def, int64_t *val)