Speed up method lookup in a different dex file.
Use already known name and proto.
Change-Id: I4505b81724bd6a0f3cf21ee6fed44774d38c4e15
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 9f30190..f9486c3 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -561,9 +561,11 @@
caller->GetDexCacheResolvedMethods()->Set(called->GetDexMethodIndex(), called);
} else {
// Calling from one dex file to another, need to compute the method index appropriate to
- // the caller's dex file.
+ // the caller's dex file. Since we get here only if the original called was a runtime
+ // method, we've got the correct dex_file and a dex_method_idx from above.
+ DCHECK(&MethodHelper(caller).GetDexFile() == dex_file);
uint32_t method_index =
- MethodHelper(called).FindDexMethodIndexInOtherDexFile(MethodHelper(caller).GetDexFile());
+ MethodHelper(called).FindDexMethodIndexInOtherDexFile(*dex_file, dex_method_idx);
if (method_index != DexFile::kDexNoIndex) {
caller->GetDexCacheResolvedMethods()->Set(method_index, called);
}