diff options
Diffstat (limited to 'compiler/optimizing/builder.cc')
| -rw-r--r-- | compiler/optimizing/builder.cc | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index cbb41b1837..a21c311d90 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -616,8 +616,8 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction, DCHECK((optimized_invoke_type == invoke_type) || (optimized_invoke_type != kDirect) || compiler_driver_->GetCompilerOptions().GetCompilePic()); bool is_recursive = - (target_method.dex_method_index == dex_compilation_unit_->GetDexMethodIndex()); - DCHECK(!is_recursive || (target_method.dex_file == dex_compilation_unit_->GetDexFile())); + (target_method.dex_method_index == outer_compilation_unit_->GetDexMethodIndex()); + DCHECK(!is_recursive || (target_method.dex_file == outer_compilation_unit_->GetDexFile())); invoke = new (arena_) HInvokeStaticOrDirect( arena_, number_of_arguments, return_type, dex_pc, target_method.dex_method_index, is_recursive, optimized_invoke_type); @@ -711,7 +711,7 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction, uint16_t field_index = instruction.VRegB_21c(); ScopedObjectAccess soa(Thread::Current()); - StackHandleScope<5> hs(soa.Self()); + StackHandleScope<4> hs(soa.Self()); Handle<mirror::DexCache> dex_cache(hs.NewHandle( dex_compilation_unit_->GetClassLinker()->FindDexCache(*dex_compilation_unit_->GetDexFile()))); Handle<mirror::ClassLoader> class_loader(hs.NewHandle( @@ -724,10 +724,8 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction, return false; } - Handle<mirror::DexCache> outer_dex_cache(hs.NewHandle( - outer_compilation_unit_->GetClassLinker()->FindDexCache(*outer_compilation_unit_->GetDexFile()))); Handle<mirror::Class> referrer_class(hs.NewHandle(compiler_driver_->ResolveCompilingMethodsClass( - soa, outer_dex_cache, class_loader, outer_compilation_unit_))); + soa, dex_cache, class_loader, outer_compilation_unit_))); // The index at which the field's class is stored in the DexCache's type array. uint32_t storage_index; @@ -740,7 +738,7 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction, // TODO: find out why this check is needed. bool is_in_dex_cache = compiler_driver_->CanAssumeTypeIsPresentInDexCache( - *dex_compilation_unit_->GetDexFile(), storage_index); + *outer_compilation_unit_->GetDexFile(), storage_index); bool is_initialized = resolved_field->GetDeclaringClass()->IsInitialized() && is_in_dex_cache; bool is_referrer_class = (referrer_class.Get() == resolved_field->GetDeclaringClass()); @@ -2060,31 +2058,13 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32 return true; } // NOLINT(readability/fn_size) -HIntConstant* HGraphBuilder::GetIntConstant0() { - if (constant0_ != nullptr) { - return constant0_; - } - constant0_ = new(arena_) HIntConstant(0); - entry_block_->AddInstruction(constant0_); - return constant0_; -} - -HIntConstant* HGraphBuilder::GetIntConstant1() { - if (constant1_ != nullptr) { - return constant1_; - } - constant1_ = new(arena_) HIntConstant(1); - entry_block_->AddInstruction(constant1_); - return constant1_; -} - HIntConstant* HGraphBuilder::GetIntConstant(int32_t constant) { switch (constant) { - case 0: return GetIntConstant0(); - case 1: return GetIntConstant1(); + case 0: return graph_->GetIntConstant0(); + case 1: return graph_->GetIntConstant1(); default: { HIntConstant* instruction = new (arena_) HIntConstant(constant); - entry_block_->AddInstruction(instruction); + graph_->AddConstant(instruction); return instruction; } } @@ -2092,7 +2072,7 @@ HIntConstant* HGraphBuilder::GetIntConstant(int32_t constant) { HLongConstant* HGraphBuilder::GetLongConstant(int64_t constant) { HLongConstant* instruction = new (arena_) HLongConstant(constant); - entry_block_->AddInstruction(instruction); + graph_->AddConstant(instruction); return instruction; } |