Refactor the use of Method by the compiler.

Remove the dependence on the Method object in dex2oat, allowing lazier
resolution.
Introduce new find and iterators in DexFile to simplify common
operations and avoid misuse of class data items.

Change-Id: I39fb8252190f543d89d8b233076355cec310fe08
diff --git a/src/dex_cache.h b/src/dex_cache.h
index ee1731a..8cd9b12 100644
--- a/src/dex_cache.h
+++ b/src/dex_cache.h
@@ -33,13 +33,7 @@
     Set(MethodIndex(method_idx), method_idx);
   }
 
-  void SetResolvedDirectMethod(uint32_t method_idx, Method* method) {
-    CHECK(method != NULL);
-    CHECK(method->IsDirect()) << PrettyMethod(method);
-    CHECK(method->GetCode() != NULL) << PrettyMethod(method);
-    Set(CodeIndex(method_idx),   reinterpret_cast<int32_t>(method->GetCode()));
-    Set(MethodIndex(method_idx), reinterpret_cast<int32_t>(method));
-  }
+  void SetResolvedDirectMethod(uint32_t method_idx, Method* method);
 
   static size_t LengthAsArray(size_t elements) {
     return kMax * elements;