DO NOT MERGE. Only have a portable entrypoint in portable builds.

Bug: 16214885

Change-Id: Iff7b7415efdbdabd7e6020e221a540f6a774c852
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index 1823366..1e6c038 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -217,8 +217,11 @@
     // No code? You must mean to go into the interpreter.
     // Or the generic JNI...
     if (!method->IsNative()) {
-      const void* method_code = kUsePortableCompiler ? GetPortableToInterpreterBridge()
-          : GetQuickToInterpreterBridge();
+#if defined(ART_USE_PORTABLE_COMPILER)
+      const void* method_code = GetPortableToInterpreterBridge();
+#else
+      const void* method_code = GetQuickToInterpreterBridge();
+#endif
       OatFile::OatMethod oat_method = CreateOatMethod(method_code, nullptr);
       oat_method.LinkMethod(method);
       method->SetEntryPointFromInterpreter(interpreter::artInterpreterToInterpreterBridge);
@@ -231,6 +234,7 @@
     }
   }
   // Create bridges to transition between different kinds of compiled bridge.
+#if defined(ART_USE_PORTABLE_COMPILER)
   if (method->GetEntryPointFromPortableCompiledCode() == nullptr) {
     method->SetEntryPointFromPortableCompiledCode(GetPortableToQuickBridge());
   } else {
@@ -238,6 +242,9 @@
     method->SetEntryPointFromQuickCompiledCode(GetQuickToPortableBridge());
     method->SetIsPortableCompiled();
   }
+#else
+  CHECK(method->GetEntryPointFromQuickCompiledCode() != nullptr);
+#endif
 }
 
 void CommonCompilerTest::MakeExecutable(const void* code_start, size_t code_length) {
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index 9ae9bd4..9ba6645 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -129,10 +129,12 @@
                                            << " "
                                            << dex->GetMethodDeclaringClassDescriptor(dex->GetMethodId(i))
                                            << " " << dex->GetMethodName(dex->GetMethodId(i));
+#if defined(ART_USE_PORTABLE_COMPILER)
     EXPECT_TRUE(method->GetEntryPointFromPortableCompiledCode() != NULL) << "method_idx=" << i
                                            << " "
                                            << dex->GetMethodDeclaringClassDescriptor(dex->GetMethodId(i))
                                            << " " << dex->GetMethodName(dex->GetMethodId(i));
+#endif
   }
   EXPECT_EQ(dex->NumFieldIds(), dex_cache->NumResolvedFields());
   for (size_t i = 0; i < dex_cache->NumResolvedFields(); i++) {
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index ba7e13f..c6fc115 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -739,17 +739,23 @@
 
   // The resolution method has a special trampoline to call.
   if (UNLIKELY(orig == Runtime::Current()->GetResolutionMethod())) {
+#if defined(ART_USE_PORTABLE_COMPILER)
     copy->SetEntryPointFromPortableCompiledCode<kVerifyNone>(GetOatAddress(portable_resolution_trampoline_offset_));
+#endif
     copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_resolution_trampoline_offset_));
   } else if (UNLIKELY(orig == Runtime::Current()->GetImtConflictMethod())) {
+#if defined(ART_USE_PORTABLE_COMPILER)
     copy->SetEntryPointFromPortableCompiledCode<kVerifyNone>(GetOatAddress(portable_imt_conflict_trampoline_offset_));
+#endif
     copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_imt_conflict_trampoline_offset_));
   } else {
     // We assume all methods have code. If they don't currently then we set them to the use the
     // resolution trampoline. Abstract methods never have code and so we need to make sure their
     // use results in an AbstractMethodError. We use the interpreter to achieve this.
     if (UNLIKELY(orig->IsAbstract())) {
+#if defined(ART_USE_PORTABLE_COMPILER)
       copy->SetEntryPointFromPortableCompiledCode<kVerifyNone>(GetOatAddress(portable_to_interpreter_bridge_offset_));
+#endif
       copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_to_interpreter_bridge_offset_));
       copy->SetEntryPointFromInterpreter<kVerifyNone>(reinterpret_cast<EntryPointFromInterpreter*>
           (const_cast<byte*>(GetOatAddress(interpreter_to_interpreter_bridge_offset_))));
@@ -759,8 +765,9 @@
       copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(quick_code);
 
       // Portable entrypoint:
-      const byte* portable_code = GetOatAddress(orig->GetPortableOatCodeOffset());
       bool portable_is_interpreted = false;
+#if defined(ART_USE_PORTABLE_COMPILER)
+      const byte* portable_code = GetOatAddress(orig->GetPortableOatCodeOffset());
       if (portable_code != nullptr &&
           (!orig->IsStatic() || orig->IsConstructor() || orig->GetDeclaringClass()->IsInitialized())) {
         // We have code for a non-static or initialized method, just use the code.
@@ -780,7 +787,7 @@
         portable_code = GetOatAddress(portable_resolution_trampoline_offset_);
       }
       copy->SetEntryPointFromPortableCompiledCode<kVerifyNone>(portable_code);
-
+#endif
       // JNI entrypoint:
       if (orig->IsNative()) {
         // The native method's pointer is set to a stub to lookup via dlsym.
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index 4626f38..ed1175b 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -80,8 +80,10 @@
         CompileMethod(method);
         ASSERT_TRUE(method->GetEntryPointFromQuickCompiledCode() != nullptr)
             << method_name << " " << method_sig;
+#if defined(ART_USE_PORTABLE_COMPILER)
         ASSERT_TRUE(method->GetEntryPointFromPortableCompiledCode() != nullptr)
             << method_name << " " << method_sig;
+#endif
       }
     }
   }