Clean up Handle usage.

Prefer using ConstHandle instead of Handle as function arguments
since you can't assign new references to ConstHandle which helps
prevent bugs.

Changed NullHandle to be a ConstHandle so that you can never modify
it to be a non null reference.

Change-Id: I81cb979f6f8d5b49e5614966a2caf28c3701dd4f
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 2114ada..447003c 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -427,13 +427,12 @@
       Runtime* runtime = Runtime::Current();
       if (runtime != nullptr) {
         ScopedObjectAccess soa(Thread::Current());
-        StackHandleScope<2> hs(soa.Self());
+        StackHandleScope<1> hs(soa.Self());
         Handle<mirror::DexCache> dex_cache(
             hs.NewHandle(runtime->GetClassLinker()->FindDexCache(dex_file)));
-        NullHandle<mirror::ClassLoader> class_loader;
-        Handle<mirror::ArtMethod> method(hs.NewHandle<mirror::ArtMethod>(nullptr));
-        verifier::MethodVerifier verifier(&dex_file, &dex_cache, &class_loader, &class_def,
-                                          code_item, dex_method_idx, method, method_access_flags,
+        verifier::MethodVerifier verifier(&dex_file, dex_cache, NullHandle<mirror::ClassLoader>(),
+                                          &class_def, code_item, dex_method_idx,
+                                          NullHandle<mirror::ArtMethod>(), method_access_flags,
                                           true, true, true);
         verifier.Verify();
         DumpCode(*indent2_os, &verifier, oat_method, code_item);
@@ -699,13 +698,12 @@
                     uint32_t method_access_flags) {
     if ((method_access_flags & kAccNative) == 0) {
       ScopedObjectAccess soa(Thread::Current());
-      StackHandleScope<3> hs(soa.Self());
+      StackHandleScope<1> hs(soa.Self());
       Handle<mirror::DexCache> dex_cache(
           hs.NewHandle(Runtime::Current()->GetClassLinker()->FindDexCache(*dex_file)));
-      auto class_loader(hs.NewHandle<mirror::ClassLoader>(nullptr));
-      Handle<mirror::ArtMethod> method(hs.NewHandle<mirror::ArtMethod>(nullptr));
       verifier::MethodVerifier::VerifyMethodAndDump(os, dex_method_idx, dex_file, dex_cache,
-                                                    class_loader, &class_def, code_item, method,
+                                                    NullHandle<mirror::ClassLoader>(), &class_def,
+                                                    code_item, NullHandle<mirror::ArtMethod>(),
                                                     method_access_flags);
     }
   }