ART: Move DexCache arrays to native.

This CL has a companion CL in libcore/
    https://android-review.googlesource.com/162985

Change-Id: Icbc9e20ad1b565e603195b12714762bb446515fa
diff --git a/compiler/dex/quick/x86/call_x86.cc b/compiler/dex/quick/x86/call_x86.cc
index 43167a1..9cb45a4 100644
--- a/compiler/dex/quick/x86/call_x86.cc
+++ b/compiler/dex/quick/x86/call_x86.cc
@@ -394,18 +394,19 @@
       cg->LoadCurrMethodDirect(arg0_ref);
       break;
     case 1:  // Get method->dex_cache_resolved_methods_
-      cg->LoadRefDisp(arg0_ref,
-                      ArtMethod::DexCacheResolvedMethodsOffset().Int32Value(),
-                      arg0_ref,
-                      kNotVolatile);
+      cg->LoadBaseDisp(arg0_ref,
+                       ArtMethod::DexCacheResolvedMethodsOffset(
+                           cu->target64 ? kX86_64PointerSize : kX86PointerSize).Int32Value(),
+                       arg0_ref,
+                       cu->target64 ? k64 : k32,
+                       kNotVolatile);
       break;
     case 2: {
       // Grab target method*
       CHECK_EQ(cu->dex_file, target_method.dex_file);
       const size_t pointer_size = GetInstructionSetPointerSize(cu->instruction_set);
       cg->LoadWordDisp(arg0_ref,
-                       mirror::Array::DataOffset(pointer_size).Uint32Value() +
-                       target_method.dex_method_index * pointer_size,
+                       cg->GetCachePointerOffset(target_method.dex_method_index, pointer_size),
                        arg0_ref);
       break;
     }
diff --git a/compiler/dex/quick/x86/int_x86.cc b/compiler/dex/quick/x86/int_x86.cc
index d1fe167..ecd23e9 100755
--- a/compiler/dex/quick/x86/int_x86.cc
+++ b/compiler/dex/quick/x86/int_x86.cc
@@ -3031,31 +3031,12 @@
   // The LoadRefDisp(s) below will work normally, even in 64 bit mode.
   RegStorage check_class = AllocTemp();
 
-  // If Method* is already in a register, we can save a copy.
-  RegLocation rl_method = mir_graph_->GetMethodLoc();
-  int32_t offset_of_type = mirror::Array::DataOffset(
-      sizeof(mirror::HeapReference<mirror::Class*>)).Int32Value() +
-      (sizeof(mirror::HeapReference<mirror::Class*>) * type_idx);
-
-  if (rl_method.location == kLocPhysReg) {
-    if (use_declaring_class) {
-      LoadRefDisp(rl_method.reg, ArtMethod::DeclaringClassOffset().Int32Value(),
-                  check_class, kNotVolatile);
-    } else {
-      LoadRefDisp(rl_method.reg, ArtMethod::DexCacheResolvedTypesOffset().Int32Value(),
-                  check_class, kNotVolatile);
-      LoadRefDisp(check_class, offset_of_type, check_class, kNotVolatile);
-    }
+  if (use_declaring_class) {
+    RegStorage r_method = LoadCurrMethodWithHint(check_class);
+    LoadRefDisp(r_method, ArtMethod::DeclaringClassOffset().Int32Value(),
+                check_class, kNotVolatile);
   } else {
-    LoadCurrMethodDirect(check_class);
-    if (use_declaring_class) {
-      LoadRefDisp(check_class, ArtMethod::DeclaringClassOffset().Int32Value(),
-                  check_class, kNotVolatile);
-    } else {
-      LoadRefDisp(check_class, ArtMethod::DexCacheResolvedTypesOffset().Int32Value(),
-                  check_class, kNotVolatile);
-      LoadRefDisp(check_class, offset_of_type, check_class, kNotVolatile);
-    }
+    LoadTypeFromCache(type_idx, check_class);
   }
 
   // Compare the computed class to the class in the object.