Ensure getConstString uses slow path for non-image compilation

Change-Id: If7f0eeb277e1ddc9028c90d4b8fab1621f1ea77e
diff --git a/src/compiler/CompilerIR.h b/src/compiler/CompilerIR.h
index 8dcf56b..dac63cf 100644
--- a/src/compiler/CompilerIR.h
+++ b/src/compiler/CompilerIR.h
@@ -186,7 +186,8 @@
     int numInsts;
     int numBlocks;
     GrowableList blockList;
-    const Method *method;
+    const Compiler* compiler;
+    const Method* method;
     LIR* firstLIRInsn;
     LIR* lastLIRInsn;
     LIR* literalList;                   // Constants
diff --git a/src/compiler/Frontend.cc b/src/compiler/Frontend.cc
index d0c92f6..33dbba4 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -711,6 +711,7 @@
     oatInit(compiler);
 
     memset(&cUnit, 0, sizeof(cUnit));
+    cUnit.compiler = &compiler;
     cUnit.method = method;
     cUnit.instructionSet = (OatInstructionSetType)insnSet;
     cUnit.insns = code_item->insns_;
diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc
index 094d10c..d88960f 100644
--- a/src/compiler/codegen/arm/Thumb2/Gen.cc
+++ b/src/compiler/codegen/arm/Thumb2/Gen.cc
@@ -651,7 +651,7 @@
     /* NOTE: Most strings should be available at compile time */
     const art::String* str = cUnit->method->GetDexCacheStrings()->
         Get(mir->dalvikInsn.vB);
-    if (SLOW_STRING_PATH || (str == NULL)) {
+    if (SLOW_STRING_PATH || (str == NULL) || !cUnit->compiler->IsImage()) {
         oatFlushAllRegs(cUnit);
         oatLockCallTemps(cUnit); // Using explicit registers
         loadCurrMethodDirect(cUnit, r2);