Revert "Revert "Make libdexfile build independent of runtime dir""

This reverts commit 787784f9effb126b5d0d3dc97d544c4a477b5daf.

Reason for revert: Bot configuration issue.

Change-Id: I6a10bb4a9571f89c7e4dd095f9157e830a44e2de
Bug: 22322814
Test: make -j 50 checkbuild
diff --git a/compiler/Android.bp b/compiler/Android.bp
index 2e60e7d..4539659 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -184,6 +184,7 @@
     },
     generated_sources: ["art_compiler_operator_srcs"],
     shared_libs: [
+        "libdexfile",
         "libbase",
         "libcutils",  // for atrace.
         "liblzma",
diff --git a/compiler/dex/inline_method_analyser.cc b/compiler/dex/inline_method_analyser.cc
index ce67b85..dc044c1 100644
--- a/compiler/dex/inline_method_analyser.cc
+++ b/compiler/dex/inline_method_analyser.cc
@@ -142,7 +142,7 @@
     REQUIRES_SHARED(Locks::mutator_lock_) {
   DCHECK_EQ(invoke_direct->Opcode(), Instruction::INVOKE_DIRECT);
   if (kIsDebugBuild) {
-    CodeItemDataAccessor accessor(method);
+    CodeItemDataAccessor accessor(method->DexInstructionData());
     DCHECK_EQ(invoke_direct->VRegC_35c(),
               accessor.RegistersSize() - accessor.InsSize());
   }
@@ -324,9 +324,9 @@
         return false;
       }
       if (target_method->GetDeclaringClass()->IsObjectClass()) {
-        DCHECK_EQ(CodeItemDataAccessor(target_method).begin()->Opcode(), Instruction::RETURN_VOID);
+        DCHECK_EQ(target_method->DexInstructionData().begin()->Opcode(), Instruction::RETURN_VOID);
       } else {
-        CodeItemDataAccessor target_code_item(target_method);
+        CodeItemDataAccessor target_code_item(target_method->DexInstructionData());
         if (!target_code_item.HasCodeItem()) {
           return false;  // Native constructor?
         }
@@ -430,7 +430,7 @@
     InlineMethodAnalyser::IPutVariant(Instruction::IPUT_SHORT), "iget/iput_short variant");
 
 bool InlineMethodAnalyser::AnalyseMethodCode(ArtMethod* method, InlineMethod* result) {
-  CodeItemDataAccessor code_item(method);
+  CodeItemDataAccessor code_item(method->DexInstructionData());
   if (!code_item.HasCodeItem()) {
     // Native or abstract.
     return false;
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 60537fd..c617f54 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -932,7 +932,7 @@
     if (method->GetCodeItem() == nullptr) {
       return;  // native or abstract method
     }
-    CodeItemDataAccessor accessor(method);
+    CodeItemDataAccessor accessor(method->DexInstructionData());
     if (accessor.TriesSize() == 0) {
       return;  // nothing to process
     }
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 452be6f..035e5ce 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -392,8 +392,9 @@
   return single_impl;
 }
 
-static bool AlwaysThrows(ArtMethod* method) {
-  CodeItemDataAccessor accessor(method);
+static bool AlwaysThrows(ArtMethod* method)
+    REQUIRES_SHARED(Locks::mutator_lock_) {
+  CodeItemDataAccessor accessor(method->DexInstructionData());
   // Skip native methods, methods with try blocks, and methods that are too large.
   if (!accessor.HasCodeItem() ||
       accessor.TriesSize() != 0 ||
@@ -1418,7 +1419,7 @@
 
   bool same_dex_file = IsSameDexFile(*outer_compilation_unit_.GetDexFile(), *method->GetDexFile());
 
-  CodeItemDataAccessor accessor(method);
+  CodeItemDataAccessor accessor(method->DexInstructionData());
 
   if (!accessor.HasCodeItem()) {
     LOG_FAIL_NO_STAT()
@@ -1697,7 +1698,7 @@
   const DexFile::CodeItem* code_item = resolved_method->GetCodeItem();
   const DexFile& callee_dex_file = *resolved_method->GetDexFile();
   uint32_t method_index = resolved_method->GetDexMethodIndex();
-  CodeItemDebugInfoAccessor code_item_accessor(resolved_method);
+  CodeItemDebugInfoAccessor code_item_accessor(resolved_method->DexInstructionDebugInfo());
   ClassLinker* class_linker = caller_compilation_unit_.GetClassLinker();
   Handle<mirror::DexCache> dex_cache = NewHandleIfDifferent(resolved_method->GetDexCache(),
                                                             caller_compilation_unit_.GetDexCache(),