From 917d01680714b2295f109f8fea0aa06764a30b70 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Tue, 24 Nov 2015 18:25:35 +0000 Subject: Don't generate a slow path for strings in the dex cache. Change-Id: I1d258f1a89bf0ec7c7ddd134be9215d480f0b09a --- compiler/driver/compiler_driver.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index a05105b84e..a1a92aa7a4 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -1134,15 +1134,21 @@ bool CompilerDriver::CanAssumeStringIsPresentInDexCache(const DexFile& dex_file, // See also Compiler::ResolveDexFile bool result = false; - if (IsBootImage()) { - // We resolve all const-string strings when building for the image. + if (IsBootImage() || Runtime::Current()->UseJit()) { ScopedObjectAccess soa(Thread::Current()); StackHandleScope<1> hs(soa.Self()); ClassLinker* const class_linker = Runtime::Current()->GetClassLinker(); Handle dex_cache(hs.NewHandle(class_linker->FindDexCache( soa.Self(), dex_file, false))); - class_linker->ResolveString(dex_file, string_idx, dex_cache); - result = true; + if (IsBootImage()) { + // We resolve all const-string strings when building for the image. + class_linker->ResolveString(dex_file, string_idx, dex_cache); + result = true; + } else { + // Just check whether the dex cache already has the string. + DCHECK(Runtime::Current()->UseJit()); + result = (dex_cache->GetResolvedString(string_idx) != nullptr); + } } if (result) { stats_->StringInDexCache(); -- cgit v1.2.3-59-g8ed1b