ART: Ensure order of field gaps

Disambiguate field gaps of same size by starting offset. That will
make the priority queue stable.

Bug: 19413180
Change-Id: I6302a8bbdc590af7e9ec4f332c386c375fa8d8cd
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 8609807..d8166e2 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -157,8 +157,8 @@
   }
   bool operator() (const FieldGap& lhs, const FieldGap& rhs)
       NO_THREAD_SAFETY_ANALYSIS {
-    // Sort by gap size, largest first.
-    return lhs.size > rhs.size;
+    // Sort by gap size, largest first. Secondary sort by starting offset.
+    return lhs.size > rhs.size || (lhs.size == rhs.size && lhs.start_offset < rhs.start_offset);
   }
 };
 typedef std::priority_queue<FieldGap, std::vector<FieldGap>, FieldGapsComparator> FieldGaps;