Fix ClearEntryPointsInZygoteExecSpace.

Methods allocated in the shared region now don't have a profiling
info.

Also move test 689-zygote-jit-deopt to now use proper ZygoteHooks APIs
to fork from zygote, and have non-bionic build create a shared region.

Test: 689-zygote-jit-deopt
Bug: 119800099
Change-Id: I400618673a0b5b2ba7389e46d692ea6a58dbeea8
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 8f4d0d4..960018c 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -917,19 +917,11 @@
 
 void JitCodeCache::ClearEntryPointsInZygoteExecSpace() {
   MutexLock mu(Thread::Current(), *Locks::jit_lock_);
-  // Iterate over profiling infos to know which methods may have been JITted. Note that
-  // to be JITted, a method must have a profiling info.
-  for (ProfilingInfo* info : profiling_infos_) {
-    ArtMethod* method = info->GetMethod();
+  for (const auto& it : method_code_map_) {
+    ArtMethod* method = it.second;
     if (IsInZygoteExecSpace(method->GetEntryPointFromQuickCompiledCode())) {
       method->SetEntryPointFromQuickCompiledCode(GetQuickToInterpreterBridge());
     }
-    // If zygote does method tracing, or in some configuration where
-    // the JIT zygote does GC, we also need to clear the saved entry point
-    // in the profiling info.
-    if (IsInZygoteExecSpace(info->GetSavedEntryPoint())) {
-      info->SetSavedEntryPoint(nullptr);
-    }
   }
 }
 
@@ -1742,13 +1734,6 @@
     return;
   }
 
-  if (private_region_.IsValid()) {
-    // In case the zygote was running with its own private region (happens for
-    // unit tests), move the region to the shared one.
-    CHECK(!shared_region_.IsValid());
-    std::swap(shared_region_, private_region_);
-  }
-
   // Reset all statistics to be specific to this process.
   number_of_compilations_ = 0;
   number_of_osr_compilations_ = 0;