Refactor MethodDebugInfo (input of DWARF writer).

Do not pass CompiledMethod pointer through since it is only available
during AOT compile but not during JIT compile or at runtime. Creating
mock CompiledMethod just pass data is proving increasingly tricky, so
copy the fields that we need to MethodDebugInfo instead.

Change-Id: I820297b41e769fcac488c0ff2d2ea0492bb13ed8
diff --git a/compiler/debug/elf_debug_info_writer.h b/compiler/debug/elf_debug_info_writer.h
index bddb054..af74d4c 100644
--- a/compiler/debug/elf_debug_info_writer.h
+++ b/compiler/debug/elf_debug_info_writer.h
@@ -117,17 +117,17 @@
 
   void Write(const ElfCompilationUnit& compilation_unit) {
     CHECK(!compilation_unit.methods.empty());
-    const Elf_Addr text_address = owner_->builder_->GetText()->Exists()
+    const Elf_Addr base_address = compilation_unit.is_code_address_text_relative
         ? owner_->builder_->GetText()->GetAddress()
         : 0;
-    const uintptr_t cu_size = compilation_unit.high_pc - compilation_unit.low_pc;
+    const uint64_t cu_size = compilation_unit.code_end - compilation_unit.code_address;
     using namespace dwarf;  // NOLINT. For easy access to DWARF constants.
 
     info_.StartTag(DW_TAG_compile_unit);
     info_.WriteString(DW_AT_producer, "Android dex2oat");
     info_.WriteData1(DW_AT_language, DW_LANG_Java);
     info_.WriteString(DW_AT_comp_dir, "$JAVA_SRC_ROOT");
-    info_.WriteAddr(DW_AT_low_pc, text_address + compilation_unit.low_pc);
+    info_.WriteAddr(DW_AT_low_pc, base_address + compilation_unit.code_address);
     info_.WriteUdata(DW_AT_high_pc, dchecked_integral_cast<uint32_t>(cu_size));
     info_.WriteSecOffset(DW_AT_stmt_list, compilation_unit.debug_line_offset);
 
@@ -165,8 +165,8 @@
       int start_depth = info_.Depth();
       info_.StartTag(DW_TAG_subprogram);
       WriteName(dex->GetMethodName(dex_method));
-      info_.WriteAddr(DW_AT_low_pc, text_address + mi->low_pc);
-      info_.WriteUdata(DW_AT_high_pc, dchecked_integral_cast<uint32_t>(mi->high_pc-mi->low_pc));
+      info_.WriteAddr(DW_AT_low_pc, base_address + mi->code_address);
+      info_.WriteUdata(DW_AT_high_pc, mi->code_size);
       std::vector<uint8_t> expr_buffer;
       Expression expr(&expr_buffer);
       expr.WriteOpCallFrameCfa();
@@ -176,8 +176,8 @@
       // Decode dex register locations for all stack maps.
       // It might be expensive, so do it just once and reuse the result.
       std::vector<DexRegisterMap> dex_reg_maps;
-      if (mi->IsFromOptimizingCompiler()) {
-        const CodeInfo code_info(mi->compiled_method->GetVmapTable().data());
+      if (mi->code_info != nullptr) {
+        const CodeInfo code_info(mi->code_info);
         StackMapEncoding encoding = code_info.ExtractEncoding();
         for (size_t s = 0; s < code_info.GetNumberOfStackMaps(); ++s) {
           const StackMap& stack_map = code_info.GetStackMapAt(s, encoding);
@@ -200,7 +200,7 @@
           // Write the stack location of the parameter.
           const uint32_t vreg = dex_code->registers_size_ - dex_code->ins_size_ + arg_reg;
           const bool is64bitValue = false;
-          WriteRegLocation(mi, dex_reg_maps, vreg, is64bitValue, compilation_unit.low_pc);
+          WriteRegLocation(mi, dex_reg_maps, vreg, is64bitValue, compilation_unit.code_address);
         }
         arg_reg++;
         info_.EndTag();
@@ -219,7 +219,7 @@
           if (dex_code != nullptr) {
             // Write the stack location of the parameter.
             const uint32_t vreg = dex_code->registers_size_ - dex_code->ins_size_ + arg_reg;
-            WriteRegLocation(mi, dex_reg_maps, vreg, is64bitValue, compilation_unit.low_pc);
+            WriteRegLocation(mi, dex_reg_maps, vreg, is64bitValue, compilation_unit.code_address);
           }
           arg_reg += is64bitValue ? 2 : 1;
           info_.EndTag();
@@ -246,7 +246,7 @@
                              dex_reg_maps,
                              var.reg_,
                              is64bitValue,
-                             compilation_unit.low_pc,
+                             compilation_unit.code_address,
                              var.start_address_,
                              var.end_address_);
             info_.EndTag();
@@ -445,14 +445,14 @@
                         const std::vector<DexRegisterMap>& dex_register_maps,
                         uint16_t vreg,
                         bool is64bitValue,
-                        uint32_t compilation_unit_low_pc,
+                        uint64_t compilation_unit_code_address,
                         uint32_t dex_pc_low = 0,
                         uint32_t dex_pc_high = 0xFFFFFFFF) {
     WriteDebugLocEntry(method_info,
                        dex_register_maps,
                        vreg,
                        is64bitValue,
-                       compilation_unit_low_pc,
+                       compilation_unit_code_address,
                        dex_pc_low,
                        dex_pc_high,
                        owner_->builder_->GetIsa(),