Clear shared method bit when doing boot image profiling.

Otherwise, the profile saver thinks all methods in the boot image are
hot.

Test: 595-profile-saving
Bug: 223366272
Change-Id: Ieff95a6fe11cabfa9b3ccf1364b8dae080d08cf8
(cherry picked from commit 8bf5afd32336da9ae96668b2ef31f06678d30347)
Merged-In: Ieff95a6fe11cabfa9b3ccf1364b8dae080d08cf8
diff --git a/runtime/art_method.h b/runtime/art_method.h
index 9b11c26..d8bd380 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -265,6 +265,15 @@
     }
   }
 
+  void ClearMemorySharedMethod() REQUIRES_SHARED(Locks::mutator_lock_) {
+    if (IsIntrinsic() || IsAbstract()) {
+      return;
+    }
+    if (IsMemorySharedMethod()) {
+      ClearAccessFlags(kAccMemorySharedMethod);
+    }
+  }
+
   void ClearPreCompiled() REQUIRES_SHARED(Locks::mutator_lock_) {
     ClearAccessFlags(kAccPreCompiled | kAccCompileDontBother);
   }