Remove mirror:: and ArtMethod deps in utils.{h,cc}

The latest chapter in the ongoing saga of attempting to dump a DEX
file without having to start a whole runtime instance.  This episode
finds us removing references to ArtMethod/ArtField/mirror.

One aspect of this change that I would like to call out specfically
is that the utils versions of the "Pretty*" functions all were written
to accept nullptr as an argument.  I have split these functions up as
follows:
1) an instance method, such as PrettyClass that obviously requires
this != nullptr.
2) a static method, that behaves the same way as the util method, but
calls the instance method if p != nullptr.
This requires using a full class qualifier for the static methods,
which isn't exactly beautiful.  I have tried to remove as many cases
as possible where it was clear p != nullptr.

Bug: 22322814
Test: test-art-host
Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index afaec52..7d2abdf 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -617,7 +617,7 @@
   if (kTimeCompileMethod) {
     uint64_t duration_ns = NanoTime() - start_ns;
     if (duration_ns > MsToNs(driver->GetCompiler()->GetMaximumCompilationTimeBeforeWarning())) {
-      LOG(WARNING) << "Compilation of " << PrettyMethod(method_idx, dex_file)
+      LOG(WARNING) << "Compilation of " << dex_file.PrettyMethod(method_idx)
                    << " took " << PrettyDuration(duration_ns);
     }
   }
@@ -639,7 +639,7 @@
 
   if (self->IsExceptionPending()) {
     ScopedObjectAccess soa(self);
-    LOG(FATAL) << "Unexpected exception compiling: " << PrettyMethod(method_idx, dex_file) << "\n"
+    LOG(FATAL) << "Unexpected exception compiling: " << dex_file.PrettyMethod(method_idx) << "\n"
         << self->GetException()->Dump();
   }
 }
@@ -940,7 +940,7 @@
     return true;
   }
 
-  std::string tmp = PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file, true);
+  std::string tmp = method_ref.dex_file->PrettyMethod(method_ref.dex_method_index, true);
   return methods_to_compile_->find(tmp.c_str()) != methods_to_compile_->end();
 }
 
@@ -955,7 +955,7 @@
   if (kDebugProfileGuidedCompilation) {
     LOG(INFO) << "[ProfileGuidedCompilation] "
         << (result ? "Compiled" : "Skipped") << " method:"
-        << PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file, true);
+        << method_ref.dex_file->PrettyMethod(method_ref.dex_method_index, true);
   }
   return result;
 }
@@ -1679,7 +1679,7 @@
   const DexFile& original_dex_file = *klass->GetDexCache()->GetDexFile();
   if (&dex_file != &original_dex_file) {
     if (class_loader == nullptr) {
-      LOG(WARNING) << "Skipping class " << PrettyDescriptor(klass) << " from "
+      LOG(WARNING) << "Skipping class " << klass->PrettyDescriptor() << " from "
                    << dex_file.GetLocation() << " previously found in "
                    << original_dex_file.GetLocation();
     }
@@ -1991,7 +1991,7 @@
         manager_->GetCompiler()->SetHadHardVerifierFailure();
       }
     } else if (!SkipClass(jclass_loader, dex_file, klass.Get())) {
-      CHECK(klass->IsResolved()) << PrettyClass(klass.Get());
+      CHECK(klass->IsResolved()) << klass->PrettyClass();
       class_linker->VerifyClass(soa.Self(), klass, log_level_);
 
       if (klass->IsErroneous()) {
@@ -2002,13 +2002,14 @@
       }
 
       CHECK(klass->IsCompileTimeVerified() || klass->IsErroneous())
-          << PrettyDescriptor(klass.Get()) << ": state=" << klass->GetStatus();
+          << klass->PrettyDescriptor() << ": state=" << klass->GetStatus();
 
       // It is *very* problematic if there are verification errors in the boot classpath. For example,
       // we rely on things working OK without verification when the decryption dialog is brought up.
       // So abort in a debug build if we find this violated.
       DCHECK(!manager_->GetCompiler()->GetCompilerOptions().IsBootImage() || klass->IsVerified())
-          << "Boot classpath class " << PrettyClass(klass.Get()) << " failed to fully verify.";
+          << "Boot classpath class " << klass->PrettyClass()
+          << " failed to fully verify.";
     }
     soa.Self()->AssertNoPendingException();
   }
@@ -2446,14 +2447,14 @@
                                        CompiledMethod* const compiled_method,
                                        size_t non_relative_linker_patch_count) {
   DCHECK(GetCompiledMethod(method_ref) == nullptr)
-      << PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file);
+      << method_ref.dex_file->PrettyMethod(method_ref.dex_method_index);
   {
     MutexLock mu(Thread::Current(), compiled_methods_lock_);
     compiled_methods_.Put(method_ref, compiled_method);
     non_relative_linker_patch_count_ += non_relative_linker_patch_count;
   }
   DCHECK(GetCompiledMethod(method_ref) != nullptr)
-      << PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file);
+      << method_ref.dex_file->PrettyMethod(method_ref.dex_method_index);
 }
 
 void CompilerDriver::RemoveCompiledMethod(const MethodReference& method_ref) {
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index e323b16..20f0e5e 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -216,7 +216,7 @@
 
   const auto pointer_size = class_linker->GetImagePointerSize();
   for (auto& m : klass->GetDirectMethods(pointer_size)) {
-    std::string name = PrettyMethod(&m, true);
+    std::string name = m.PrettyMethod(true);
     const void* code = m.GetEntryPointFromQuickCompiledCodePtrSize(pointer_size);
     ASSERT_NE(code, nullptr);
     if (expected->find(name) != expected->end()) {
@@ -273,7 +273,7 @@
     const auto pointer_size = class_linker->GetImagePointerSize();
     size_t number_of_compiled_methods = 0;
     for (auto& m : klass->GetVirtualMethods(pointer_size)) {
-      std::string name = PrettyMethod(&m, true);
+      std::string name = m.PrettyMethod(true);
       const void* code = m.GetEntryPointFromQuickCompiledCodePtrSize(pointer_size);
       ASSERT_NE(code, nullptr);
       if (expected_methods.find(name) != expected_methods.end()) {
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 3c920d9..4eb6954 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -29,6 +29,8 @@
 
 namespace art {
 
+class DexFile;
+
 class CompilerOptions FINAL {
  public:
   // Guide heuristics to determine whether to compile method if profile data not available.
diff --git a/compiler/driver/dex_compilation_unit.cc b/compiler/driver/dex_compilation_unit.cc
index b0ee448..64fd9e7 100644
--- a/compiler/driver/dex_compilation_unit.cc
+++ b/compiler/driver/dex_compilation_unit.cc
@@ -45,7 +45,7 @@
 const std::string& DexCompilationUnit::GetSymbol() {
   if (symbol_.empty()) {
     symbol_ = "dex_";
-    symbol_ += MangleForJni(PrettyMethod(dex_method_idx_, *dex_file_));
+    symbol_ += MangleForJni(dex_file_->PrettyMethod(dex_method_idx_));
   }
   return symbol_;
 }