Revert "Inline across dex files."

bug: 19904089
bug: 19903495

This reverts commit 7e4c3508e4f5512650b63c41f7872a749e99aee9.

Change-Id: I15df746b5f1882cce78eedde6c05c0d3b69bfa4a
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 82d6357..968fe3e 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -85,9 +85,11 @@
     return false;
   }
 
-  bool can_use_dex_cache = true;
   if (resolved_method->GetDexFile()->GetLocation().compare(outer_dex_file.GetLocation()) != 0) {
-    can_use_dex_cache = false;
+    VLOG(compiler) << "Did not inline "
+                   << PrettyMethod(method_index, outer_dex_file)
+                   << " because it is in a different dex file";
+    return false;
   }
 
   const DexFile::CodeItem* code_item = resolved_method->GetCodeItem();
@@ -122,7 +124,7 @@
     return false;
   }
 
-  if (!TryBuildAndInline(resolved_method, invoke_instruction, method_index, can_use_dex_cache)) {
+  if (!TryBuildAndInline(resolved_method, invoke_instruction, method_index)) {
     resolved_method->SetShouldNotInline();
     return false;
   }
@@ -134,8 +136,7 @@
 
 bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method,
                                  HInvoke* invoke_instruction,
-                                 uint32_t method_index,
-                                 bool can_use_dex_cache) const {
+                                 uint32_t method_index) const {
   ScopedObjectAccess soa(Thread::Current());
   const DexFile::CodeItem* code_item = resolved_method->GetCodeItem();
   const DexFile& outer_dex_file = *outer_compilation_unit_.GetDexFile();
@@ -144,10 +145,10 @@
     nullptr,
     outer_compilation_unit_.GetClassLoader(),
     outer_compilation_unit_.GetClassLinker(),
-    *resolved_method->GetDexFile(),
+    outer_dex_file,
     code_item,
     resolved_method->GetDeclaringClass()->GetDexClassDefIndex(),
-    resolved_method->GetDexMethodIndex(),
+    method_index,
     resolved_method->GetAccessFlags(),
     nullptr);
 
@@ -158,7 +159,7 @@
   HGraphBuilder builder(callee_graph,
                         &dex_compilation_unit,
                         &outer_compilation_unit_,
-                        resolved_method->GetDexFile(),
+                        &outer_dex_file,
                         compiler_driver_,
                         &inline_stats);
 
@@ -199,7 +200,7 @@
 
   if (depth_ + 1 < kDepthLimit) {
     HInliner inliner(
-        callee_graph, dex_compilation_unit, compiler_driver_, stats_, depth_ + 1);
+        callee_graph, outer_compilation_unit_, compiler_driver_, stats_, depth_ + 1);
     inliner.Run();
   }
 
@@ -234,13 +235,6 @@
                        << " needs an environment";
         return false;
       }
-
-      if (!can_use_dex_cache && current->NeedsDexCache()) {
-        VLOG(compiler) << "Method " << PrettyMethod(method_index, outer_dex_file)
-                       << " could not be inlined because " << current->DebugName()
-                       << " it is in a different dex file and requires access to the dex cache";
-        return false;
-      }
     }
   }