4331 {
4332
4333 if (is_aot_) {
4334 OptimizeDeadParameters();
4335 }
4336
4337
4338
4339
4340
4341 const GrowableArray<CatchBlockEntryInstr*>& catch_entries =
4343
4344 for (auto catch_entry : catch_entries) {
4345
4346
4347
4348
4349
4350 GrowableArray<Definition*>* idefs = catch_entry->initial_definitions();
4351 GrowableArray<Definition*> cdefs(idefs->length());
4352 cdefs.AddArray(*idefs);
4353
4354
4355
4356
4357
4358 cdefs[flow_graph_->
EnvIndex(catch_entry->raw_exception_var())] =
nullptr;
4359 cdefs[flow_graph_->
EnvIndex(catch_entry->raw_stacktrace_var())] =
nullptr;
4360
4362 !block_it.
Done(); block_it.Advance()) {
4363 BlockEntryInstr* block = block_it.Current();
4364 if (block->try_index() == catch_entry->catch_try_index()) {
4365 for (ForwardInstructionIterator instr_it(block); !instr_it.Done();
4366 instr_it.Advance()) {
4367 Instruction* current = instr_it.Current();
4368 if (current->MayThrow()) {
4369 Environment*
env = current->env()->Outermost();
4371 for (intptr_t env_idx = 0; env_idx < cdefs.length(); ++env_idx) {
4372 if (cdefs[env_idx] !=
nullptr && !cdefs[env_idx]->
IsConstant() &&
4373 env->ValueAt(env_idx)->BindsToConstant()) {
4374
4375
4376 cdefs[env_idx] =
env->ValueAt(env_idx)->definition();
4377 }
4378 if (cdefs[env_idx] !=
env->ValueAt(env_idx)->definition()) {
4379
4380 cdefs[env_idx] = nullptr;
4381 }
4382 }
4383 }
4384 }
4385 }
4386 }
4387 for (intptr_t j = 0; j < idefs->length(); ++j) {
4388 if (cdefs[j] !=
nullptr && cdefs[j]->
IsConstant()) {
4389 Definition* old = (*idefs)[j];
4390 ConstantInstr* orig = cdefs[j]->AsConstant();
4391 ConstantInstr*
copy =
4392 new (flow_graph_->
zone()) ConstantInstr(orig->value());
4394 old->ReplaceUsesWith(
copy);
4395 copy->set_previous(old->previous());
4397 }
4398 }
4399 }
4400}
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
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)