From 9507fa2c9545156747a5eb248bc1af3159bfd8c8 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Thu, 29 Oct 2015 15:08:57 -0700 Subject: Change a few places to use string version of GetTypeId GetTypeId is about 20% faster than GetStringId + integer GetTypeID since it does less binary searches. Change-Id: I876c4ac89ab206acca217b2287b0197ef2e408c2 --- compiler/driver/compiler_driver-inl.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'compiler/driver/compiler_driver-inl.h') diff --git a/compiler/driver/compiler_driver-inl.h b/compiler/driver/compiler_driver-inl.h index 1a7dbe3a9f..14ba81d193 100644 --- a/compiler/driver/compiler_driver-inl.h +++ b/compiler/driver/compiler_driver-inl.h @@ -187,15 +187,11 @@ inline std::pair CompilerDriver::IsClassOfStaticMemberAvailableToRef // Search dex file for localized ssb index, may fail if member's class is a parent // of the class mentioned in the dex file and there is no dex cache entry. std::string temp; - const DexFile::StringId* string_id = - dex_file->FindStringId(resolved_member->GetDeclaringClass()->GetDescriptor(&temp)); - if (string_id != nullptr) { - const DexFile::TypeId* type_id = - dex_file->FindTypeId(dex_file->GetIndexForStringId(*string_id)); - if (type_id != nullptr) { - // medium path, needs check of static storage base being initialized - storage_idx = dex_file->GetIndexForTypeId(*type_id); - } + const DexFile::TypeId* type_id = + dex_file->FindTypeId(resolved_member->GetDeclaringClass()->GetDescriptor(&temp)); + if (type_id != nullptr) { + // medium path, needs check of static storage base being initialized + storage_idx = dex_file->GetIndexForTypeId(*type_id); } } if (storage_idx != DexFile::kDexNoIndex) { -- cgit v1.2.3-59-g8ed1b