Store zygote compiled code in a shared map.

- Store flags in the ArtMethod to know that it is compiled by the zygote
- Query the map when entering a zygote compiled method from the
interpreter.

Bug: 119800099
Test: boots
Change-Id: Ib1a38266573e28d371034d02d6bb83f9b8b2e317
diff --git a/runtime/art_method.h b/runtime/art_method.h
index 5dc43a3..9c74d83 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -201,9 +201,9 @@
   }
 
   bool IsMiranda() {
-    // The kAccMiranda flag value is used with a different meaning for native methods,
-    // so we need to check the kAccNative flag as well.
-    return (GetAccessFlags() & (kAccNative | kAccMiranda)) == kAccMiranda;
+    // The kAccMiranda flag value is used with a different meaning for native methods and methods
+    // marked kAccCompileDontBother, so we need to check these flags as well.
+    return (GetAccessFlags() & (kAccNative | kAccMiranda | kAccCompileDontBother)) == kAccMiranda;
   }
 
   // Returns true if invoking this method will not throw an AbstractMethodError or
@@ -212,15 +212,34 @@
     return !IsAbstract() && !IsDefaultConflicting();
   }
 
+  bool IsZygoteCompiled() {
+    uint32_t expected = (kAccZygoteCompiled | kAccCompileDontBother);
+    return (GetAccessFlags() & expected) == expected;
+  }
+
+  void SetZygoteCompiled() {
+    DCHECK(IsInvokable());
+    DCHECK(IsCompilable());
+    AddAccessFlags(kAccZygoteCompiled | kAccCompileDontBother);
+  }
+
+  void ClearZygoteCompiled() {
+    ClearAccessFlags(kAccZygoteCompiled | kAccCompileDontBother);
+  }
+
   bool IsCompilable() {
     if (IsIntrinsic()) {
       // kAccCompileDontBother overlaps with kAccIntrinsicBits.
       return true;
     }
+    if (IsZygoteCompiled()) {
+      return true;
+    }
     return (GetAccessFlags() & kAccCompileDontBother) == 0;
   }
 
   void SetDontCompile() {
+    DCHECK(!IsMiranda());
     AddAccessFlags(kAccCompileDontBother);
   }