Exclude zygote methods from FreeAllMethodHeaders DCHECK

Zygote method set can change concurrently.

Bug: 175006160
Test: run jit-zygote configuration with the check enabled.
Change-Id: I973ab9303ade65ad7cad706b99e895b9c673ffb4
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 6a8cf69..adfee74 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -478,11 +478,14 @@
   RepackNativeDebugInfoForJit();
 
   // Check that the set of compiled methods exactly matches native debug information.
-  if (kIsDebugBuild) {
+  // Does not check zygote methods since they can change concurrently.
+  if (kIsDebugBuild && !Runtime::Current()->IsZygote()) {
     std::map<const void*, ArtMethod*> compiled_methods;
     VisitAllMethods([&](const void* addr, ArtMethod* method) {
-      CHECK(addr != nullptr && method != nullptr);
-      compiled_methods.emplace(addr, method);
+      if (!IsInZygoteExecSpace(addr)) {
+        CHECK(addr != nullptr && method != nullptr);
+        compiled_methods.emplace(addr, method);
+      }
     });
     std::set<const void*> debug_info;
     ForEachNativeDebugSymbol([&](const void* addr, size_t, const char* name) {
@@ -494,6 +497,7 @@
       for (auto it : compiled_methods) {
         CHECK_EQ(debug_info.count(it.first), 1u) << "No debug info: " << it.second->PrettyMethod();
       }
+      CHECK_EQ(compiled_methods.size(), debug_info.size());
     }
   }
 }