Don't do a read barrier in GetProfilingInfo.

ProfilingInfos are handled by the JIT, which treats declaring classes
of methods having these ProfilingInfo as weak roots. So it might be
possible the JIT requests a ProfilingInfo for a class that is going
to be unloaded (and that's ok, as the memory for the ProfilingInfo
is reclaimed by the JIT and is done before unloading the class).

bug: 62914384
Test: test.py
Change-Id: I84571786c1569782fb02d68257c4f70b195f27b6
diff --git a/runtime/art_method.h b/runtime/art_method.h
index d537764..396c878 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -451,7 +451,11 @@
   }
 
   ProfilingInfo* GetProfilingInfo(PointerSize pointer_size) {
-    DCHECK(!IsNative());
+    // Don't do a read barrier in the DCHECK, as GetProfilingInfo is called in places
+    // where the declaring class is treated as a weak reference (accessing it with
+    // a read barrier would either prevent unloading the class, or crash the runtime if
+    // the GC wants to unload it).
+    DCHECK(!IsNative<kWithoutReadBarrier>());
     return reinterpret_cast<ProfilingInfo*>(GetDataPtrSize(pointer_size));
   }