Treat PhantomReferences like normal object

PhantomReferences are classes like sun.misc.Cleaner (I think that's the
only type).

This change:
* Uses Class::GetIFields() instead of Object::VisitReference() to
  visit references for PhantomReferences. This way,
  the `sun.misc.Cleaner.referent` field is included. This is useful for
  understanding native allocation sizes.
* Avoids emitting field_ids for each PhantomReference objects. The
  field_ids emitted in the types are enough (they are for normal
  classes).

Tested by building, flashing, getting a perfetto heap dump of systemui
and loading into the perfetto ui at aosp/1869189

Bug: 194395971
Change-Id: Id2b5a1c80550a3d43c8b0289c198324fb327ecbc
diff --git a/perfetto_hprof/perfetto_hprof.cc b/perfetto_hprof/perfetto_hprof.cc
index face456..669fb0c 100644
--- a/perfetto_hprof/perfetto_hprof.cc
+++ b/perfetto_hprof/perfetto_hprof.cc
@@ -509,7 +509,8 @@
   std::vector<std::pair<std::string, art::mirror::Object*>> referred_objects;
   ReferredObjectsFinder objf(&referred_objects);
 
-  if (klass->GetClassFlags() != art::mirror::kClassFlagNormal) {
+  if (klass->GetClassFlags() != art::mirror::kClassFlagNormal &&
+      klass->GetClassFlags() != art::mirror::kClassFlagPhantomReference) {
     obj->VisitReferences(objf, art::VoidFunctor());
   } else {
     for (art::mirror::Class* cls = klass; cls != nullptr; cls = cls->GetSuperClass().Ptr()) {
@@ -725,7 +726,8 @@
     uint64_t base_obj_id = EncodeBaseObjId(referred_objects, min_nonnull_ptr);
 
     const bool emit_field_ids = klass->GetClassFlags() != art::mirror::kClassFlagObjectArray &&
-                                klass->GetClassFlags() != art::mirror::kClassFlagNormal;
+                                klass->GetClassFlags() != art::mirror::kClassFlagNormal &&
+                                klass->GetClassFlags() != art::mirror::kClassFlagPhantomReference;
 
     for (const auto& p : referred_objects) {
       const std::string& field_name = p.first;