Force boot image strings into dex cache.

For const-string in the boot image, force the string into the dex-cache
so that slow paths aren't necessary.
Increases boot.art from 7M to 9.8M but reduces boot.oat by ~3M. Code
generated assuming no slow paths will be faster.

Change-Id: I6c7be390adf7c09b5e6872d05f7d69ab6384c618
diff --git a/src/compiler.cc b/src/compiler.cc
index 09360c1..b096912 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -574,16 +574,15 @@
 
 bool Compiler::CanAssumeStringIsPresentInDexCache(const DexFile& dex_file,
                                                   uint32_t string_idx) {
-  // TODO: Add support for loading strings referenced by image_classes_
   // See also Compiler::ResolveDexFile
 
-  // The following is a test saying that if we're building the image without a restricted set of
-  // image classes then we can assume the string is present in the dex cache if it is there now
-  bool result = IsImage() && image_classes_ == NULL;
-  if (result) {
+  bool result = false;
+  if (IsImage()) {
+    // We resolve all const-string strings when building for the image.
     ScopedObjectAccess soa(Thread::Current());
     DexCache* dex_cache = Runtime::Current()->GetClassLinker()->FindDexCache(dex_file);
-    result = dex_cache->GetResolvedString(string_idx) != NULL;
+    Runtime::Current()->GetClassLinker()->ResolveString(dex_file, string_idx, dex_cache);
+    result = true;
   }
   if (result) {
     stats_->StringInDexCache();