Smarter image layout

Put strings in the dex file that resolves them.

Depth first traversal with overrides for class and dex cache. The
work list keeps track of what oat_index with each pushed item. This
means the static fields of a class will usually be in the same image.

Added layout test to image_test to make sure things are somewhat
reasonably attributed.

Bug: 28640955

Test: test-art-host

(cherry picked from commit 4e9c4e746617bad6a012d799d2f5cf9e01d24ea2)

Change-Id: I67a536c33aeed603b252d8e0f75622c9efbf2559
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 0a46e2e..954af76 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -1172,6 +1172,7 @@
   PointerSize image_pointer_size_;
 
   class FindVirtualMethodHolderVisitor;
+  friend struct CompilationHelper;  // For Compile in ImageTest.
   friend class ImageDumper;  // for DexLock
   friend class ImageWriter;  // for GetClassRoots
   friend class JniCompilerTest;  // for GetRuntimeQuickGenericJniStub