ART: Move kDexNoIndex to dex_file_types.h

Define the constant with the types to allow lowering the dependency
on DexFile.

Test: m
Change-Id: I3c61421db45be96d2057e01b1a7825883d8bd178
diff --git a/compiler/linker/arm/relative_patcher_arm_base.cc b/compiler/linker/arm/relative_patcher_arm_base.cc
index 6e63bf8..1c1b877 100644
--- a/compiler/linker/arm/relative_patcher_arm_base.cc
+++ b/compiler/linker/arm/relative_patcher_arm_base.cc
@@ -19,6 +19,7 @@
 #include "base/stl_util.h"
 #include "compiled_method.h"
 #include "debug/method_debug_info.h"
+#include "dex_file_types.h"
 #include "linker/output_stream.h"
 #include "oat.h"
 #include "oat_quick_method_header.h"
@@ -169,7 +170,7 @@
   // to place thunk will be soon enough, we need to reserve all needed thunks now. Code for
   // subsequent oat files can still call back to them.
   if (!unprocessed_method_call_patches_.empty()) {
-    ResolveMethodCalls(offset, MethodReference(nullptr, DexFile::kDexNoIndex));
+    ResolveMethodCalls(offset, MethodReference(nullptr, dex::kDexNoIndex));
   }
   for (ThunkData* data : unreserved_thunks_) {
     uint32_t thunk_offset = CompiledCode::AlignCode(offset, instruction_set_);
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index 7ae3866..4fcfdc0 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -33,6 +33,7 @@
 #include "debug/method_debug_info.h"
 #include "dex/verification_results.h"
 #include "dex_file-inl.h"
+#include "dex_file_types.h"
 #include "dexlayout.h"
 #include "driver/compiler_driver-inl.h"
 #include "driver/compiler_options.h"
@@ -667,11 +668,11 @@
       : writer_(writer),
         offset_(offset),
         dex_file_(nullptr),
-        class_def_index_(DexFile::kDexNoIndex) {}
+        class_def_index_(dex::kDexNoIndex) {}
 
   virtual bool StartClass(const DexFile* dex_file, size_t class_def_index) {
     DCHECK(dex_file_ == nullptr);
-    DCHECK_EQ(class_def_index_, DexFile::kDexNoIndex);
+    DCHECK_EQ(class_def_index_, dex::kDexNoIndex);
     dex_file_ = dex_file;
     class_def_index_ = class_def_index;
     return true;
@@ -682,7 +683,7 @@
   virtual bool EndClass() {
     if (kIsDebugBuild) {
       dex_file_ = nullptr;
-      class_def_index_ = DexFile::kDexNoIndex;
+      class_def_index_ = dex::kDexNoIndex;
     }
     return true;
   }
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 6567a3a..793e781 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -1236,7 +1236,7 @@
       const DexFile& caller_dex_file = *caller_compilation_unit_.GetDexFile();
       uint32_t dex_method_index = FindMethodIndexIn(
           method, caller_dex_file, invoke_instruction->GetDexMethodIndex());
-      if (dex_method_index == DexFile::kDexNoIndex) {
+      if (dex_method_index == dex::kDexNoIndex) {
         return false;
       }
       HInvokeVirtual* new_invoke = new (graph_->GetArena()) HInvokeVirtual(
diff --git a/compiler/optimizing/prepare_for_register_allocation.cc b/compiler/optimizing/prepare_for_register_allocation.cc
index 5de707a..2c856cd 100644
--- a/compiler/optimizing/prepare_for_register_allocation.cc
+++ b/compiler/optimizing/prepare_for_register_allocation.cc
@@ -16,6 +16,7 @@
 
 #include "prepare_for_register_allocation.h"
 
+#include "dex_file_types.h"
 #include "jni_internal.h"
 #include "optimizing_compiler_stats.h"
 #include "well_known_classes.h"
@@ -59,7 +60,7 @@
     HEnvironment* environment = new (arena) HEnvironment(arena,
                                                          /* number_of_vregs */ 0u,
                                                          char_at_method,
-                                                         /* dex_pc */ DexFile::kDexNoIndex,
+                                                         /* dex_pc */ dex::kDexNoIndex,
                                                          check);
     check->InsertRawEnvironment(environment);
   }
diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc
index b7840d7..7eb2188 100644
--- a/compiler/optimizing/stack_map_stream.cc
+++ b/compiler/optimizing/stack_map_stream.cc
@@ -18,6 +18,7 @@
 
 #include "art_method-inl.h"
 #include "base/stl_util.h"
+#include "dex_file_types.h"
 #include "optimizing/optimizing_compiler.h"
 #include "runtime.h"
 #include "scoped_thread_state_change-inl.h"
@@ -39,7 +40,7 @@
   current_entry_.inlining_depth = inlining_depth;
   current_entry_.inline_infos_start_index = inline_infos_.size();
   current_entry_.stack_mask_index = 0;
-  current_entry_.dex_method_index = DexFile::kDexNoIndex;
+  current_entry_.dex_method_index = dex::kDexNoIndex;
   current_entry_.dex_register_entry.num_dex_registers = num_dex_registers;
   current_entry_.dex_register_entry.locations_start_index = dex_register_locations_.size();
   current_entry_.dex_register_entry.live_dex_registers_mask = (num_dex_registers != 0)
@@ -226,7 +227,7 @@
   size_t invoke_infos_count = 0;
   size_t invoke_type_max = 0;
   for (const StackMapEntry& entry : stack_maps_) {
-    if (entry.dex_method_index != DexFile::kDexNoIndex) {
+    if (entry.dex_method_index != dex::kDexNoIndex) {
       native_pc_max = std::max(native_pc_max, entry.native_pc_code_offset.CompressedValue());
       method_index_max = std::max(method_index_max, static_cast<uint16_t>(entry.dex_method_index));
       invoke_type_max = std::max(invoke_type_max, static_cast<size_t>(entry.invoke_type));
@@ -240,7 +241,7 @@
 void StackMapStream::ComputeInlineInfoEncoding(InlineInfoEncoding* encoding,
                                                size_t dex_register_maps_bytes) {
   uint32_t method_index_max = 0;
-  uint32_t dex_pc_max = DexFile::kDexNoIndex;
+  uint32_t dex_pc_max = dex::kDexNoIndex;
   uint32_t extra_data_max = 0;
 
   uint32_t inline_info_index = 0;
@@ -256,8 +257,8 @@
         extra_data_max = std::max(
             extra_data_max, Low32Bits(reinterpret_cast<uintptr_t>(inline_entry.method)));
       }
-      if (inline_entry.dex_pc != DexFile::kDexNoIndex &&
-          (dex_pc_max == DexFile::kDexNoIndex || dex_pc_max < inline_entry.dex_pc)) {
+      if (inline_entry.dex_pc != dex::kDexNoIndex &&
+          (dex_pc_max == dex::kDexNoIndex || dex_pc_max < inline_entry.dex_pc)) {
         dex_pc_max = inline_entry.dex_pc;
       }
     }
@@ -362,7 +363,7 @@
                                             dex_register_locations_region);
     stack_map.SetDexRegisterMapOffset(encoding.stack_map.encoding, offset);
 
-    if (entry.dex_method_index != DexFile::kDexNoIndex) {
+    if (entry.dex_method_index != dex::kDexNoIndex) {
       InvokeInfo invoke_info(code_info.GetInvokeInfo(encoding, invoke_info_idx));
       invoke_info.SetNativePcCodeOffset(encoding.invoke_info.encoding, entry.native_pc_code_offset);
       invoke_info.SetInvokeType(encoding.invoke_info.encoding, entry.invoke_type);
@@ -561,7 +562,7 @@
   for (StackMapEntry& stack_map : stack_maps_) {
     const size_t index = dedupe.size();
     const uint32_t method_index = stack_map.dex_method_index;
-    if (method_index != DexFile::kDexNoIndex) {
+    if (method_index != dex::kDexNoIndex) {
       stack_map.dex_method_index_idx = dedupe.emplace(method_index, index).first->second;
       method_indices_[index] = method_index;
     }
@@ -569,7 +570,7 @@
   for (InlineInfoEntry& inline_info : inline_infos_) {
     const size_t index = dedupe.size();
     const uint32_t method_index = inline_info.method_index;
-    CHECK_NE(method_index, DexFile::kDexNoIndex);
+    CHECK_NE(method_index, dex::kDexNoIndex);
     inline_info.dex_method_index_idx = dedupe.emplace(method_index, index).first->second;
     method_indices_[index] = method_index;
   }
@@ -629,7 +630,7 @@
         DCHECK_EQ(stack_mask.LoadBit(b), 0u);
       }
     }
-    if (entry.dex_method_index != DexFile::kDexNoIndex) {
+    if (entry.dex_method_index != dex::kDexNoIndex) {
       InvokeInfo invoke_info = code_info.GetInvokeInfo(encoding, invoke_info_index);
       DCHECK_EQ(invoke_info.GetNativePcOffset(encoding.invoke_info.encoding, instruction_set_),
                 entry.native_pc_code_offset.Uint32Value(instruction_set_));
diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h
index e6471e1..a574566 100644
--- a/compiler/optimizing/stack_map_stream.h
+++ b/compiler/optimizing/stack_map_stream.h
@@ -126,7 +126,7 @@
   };
 
   struct InlineInfoEntry {
-    uint32_t dex_pc;  // DexFile::kDexNoIndex for intrinsified native methods.
+    uint32_t dex_pc;  // dex::kDexNoIndex for intrinsified native methods.
     ArtMethod* method;
     uint32_t method_index;
     DexRegisterMapEntry dex_register_entry;