Emit instance fields for java.lang.Object in hprof

Previously we omitted these fields.

(cherry picked from commit 0adc90eb0592e220f787f87dbef3a9b5c1db2080)

Bug: 20726205
Change-Id: I81c55919a4bd015bc0a4e7259a41a05dab534e11
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index 917fe43..922fc5f 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -1040,7 +1040,7 @@
   }
 
   // Instance fields for this class (no superclass fields)
-  int iFieldCount = klass->IsObjectClass() ? 0 : klass->NumInstanceFields();
+  int iFieldCount = klass->NumInstanceFields();
   if (klass->IsStringClass()) {
     __ AddU2((uint16_t)iFieldCount + 1);
   } else {
@@ -1114,7 +1114,7 @@
   // Write the instance data;  fields for this class, followed by super class fields,
   // and so on. Don't write the klass or monitor fields of Object.class.
   mirror::Class* orig_klass = klass;
-  while (!klass->IsObjectClass()) {
+  do {
     int ifieldCount = klass->NumInstanceFields();
     for (int i = 0; i < ifieldCount; ++i) {
       ArtField* f = klass->GetInstanceField(i);
@@ -1146,7 +1146,7 @@
     }
 
     klass = klass->GetSuperClass();
-  }
+  } while (klass != nullptr);
 
   // Output native value character array for strings.
   if (orig_klass->IsStringClass()) {