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/utf.cc b/src/utf.cc
index 31fbe97..52f03a9 100644
--- a/src/utf.cc
+++ b/src/utf.cc
@@ -87,6 +87,20 @@
   return ((one & 0x0f) << 12) | ((two & 0x3f) << 6) | (three & 0x3f);
 }
 
+int CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(const char* utf8_1, const char* utf8_2) {
+  for (;;) {
+    uint16_t c1 = GetUtf16FromUtf8(&utf8_1);
+    uint16_t c2 = GetUtf16FromUtf8(&utf8_2);
+    if (c1 == 0) {
+      return (c2 == 0) ? 0 : -1;
+    } else if (c2 == 0) {
+      return 1;
+    } else if (c1 != c2) {
+      return c1 > c2 ? 1 : -1;
+    }
+  }
+}
+
 size_t CountUtf8Bytes(const uint16_t* chars, size_t char_count) {
   size_t result = 0;
   while (char_count--) {