Refactor image loading.

Try to load all boot class path components from the same
place (system or dalvik cache) instead of looking for each
component image file separately.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: If5d9f39c6ec21d9be05fe36a42c70224d6fef27a
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 58becb1..222be14 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -318,12 +318,14 @@
   }
 
   // Load image space(s).
+  std::vector<std::unique_ptr<space::ImageSpace>> boot_image_spaces;
   if (space::ImageSpace::LoadBootImage(image_file_name,
                                        image_instruction_set,
-                                       &boot_image_spaces_,
+                                       &boot_image_spaces,
                                        &requested_alloc_space_begin)) {
-    for (auto space : boot_image_spaces_) {
-      AddSpace(space);
+    for (std::unique_ptr<space::ImageSpace>& space : boot_image_spaces) {
+      boot_image_spaces_.push_back(space.get());
+      AddSpace(space.release());
     }
   }