Remove NeedsDexCache logic from the compiler.

The compiled code and runtime stubs don't need to have direct access to
the dex cache anymore.

Test: test.py
Change-Id: Id3aab9b10445ba2599e1a9ffd8e36506a745bfec
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 50cedd2..e2d164e 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -2881,7 +2881,7 @@
 }
 
 void HInvoke::SetIntrinsic(Intrinsics intrinsic,
-                           IntrinsicNeedsEnvironmentOrCache needs_env_or_cache,
+                           IntrinsicNeedsEnvironment needs_env,
                            IntrinsicSideEffects side_effects,
                            IntrinsicExceptions exceptions) {
   intrinsic_ = intrinsic;
@@ -2895,8 +2895,7 @@
     case kAllSideEffects: SetSideEffects(SideEffects::AllExceptGCDependency()); break;
   }
 
-  if (needs_env_or_cache == kNoEnvironmentOrCache) {
-    opt.SetDoesNotNeedDexCache();
+  if (needs_env == kNoEnvironment) {
     opt.SetDoesNotNeedEnvironment();
   } else {
     // If we need an environment, that means there will be a call, which can trigger GC.
@@ -2926,17 +2925,6 @@
   return caller == nullptr ? GetBlock()->GetGraph()->GetDexFile() : *caller->GetDexFile();
 }
 
-bool HInvokeStaticOrDirect::NeedsDexCacheOfDeclaringClass() const {
-  if (GetMethodLoadKind() != MethodLoadKind::kRuntimeCall) {
-    return false;
-  }
-  if (!IsIntrinsic()) {
-    return true;
-  }
-  IntrinsicOptimizations opt(*this);
-  return !opt.GetDoesNotNeedDexCache();
-}
-
 std::ostream& operator<<(std::ostream& os, HInvokeStaticOrDirect::ClinitCheckRequirement rhs) {
   switch (rhs) {
     case HInvokeStaticOrDirect::ClinitCheckRequirement::kExplicit:
@@ -3114,19 +3102,19 @@
 #undef CHECK_INTRINSICS_ENUM_VALUES
 
 // Function that returns whether an intrinsic needs an environment or not.
-static inline IntrinsicNeedsEnvironmentOrCache NeedsEnvironmentOrCacheIntrinsic(Intrinsics i) {
+static inline IntrinsicNeedsEnvironment NeedsEnvironmentIntrinsic(Intrinsics i) {
   switch (i) {
     case Intrinsics::kNone:
-      return kNeedsEnvironmentOrCache;  // Non-sensical for intrinsic.
-#define OPTIMIZING_INTRINSICS(Name, InvokeType, NeedsEnvOrCache, SideEffects, Exceptions, ...) \
+      return kNeedsEnvironment;  // Non-sensical for intrinsic.
+#define OPTIMIZING_INTRINSICS(Name, InvokeType, NeedsEnv, SideEffects, Exceptions, ...) \
     case Intrinsics::k ## Name: \
-      return NeedsEnvOrCache;
+      return NeedsEnv;
 #include "intrinsics_list.h"
       INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
 #undef INTRINSICS_LIST
 #undef OPTIMIZING_INTRINSICS
   }
-  return kNeedsEnvironmentOrCache;
+  return kNeedsEnvironment;
 }
 
 // Function that returns whether an intrinsic has side effects.
@@ -3134,7 +3122,7 @@
   switch (i) {
     case Intrinsics::kNone:
       return kAllSideEffects;
-#define OPTIMIZING_INTRINSICS(Name, InvokeType, NeedsEnvOrCache, SideEffects, Exceptions, ...) \
+#define OPTIMIZING_INTRINSICS(Name, InvokeType, NeedsEnv, SideEffects, Exceptions, ...) \
     case Intrinsics::k ## Name: \
       return SideEffects;
 #include "intrinsics_list.h"
@@ -3150,7 +3138,7 @@
   switch (i) {
     case Intrinsics::kNone:
       return kCanThrow;
-#define OPTIMIZING_INTRINSICS(Name, InvokeType, NeedsEnvOrCache, SideEffects, Exceptions, ...) \
+#define OPTIMIZING_INTRINSICS(Name, InvokeType, NeedsEnv, SideEffects, Exceptions, ...) \
     case Intrinsics::k ## Name: \
       return Exceptions;
 #include "intrinsics_list.h"
@@ -3165,7 +3153,7 @@
   if (method != nullptr && method->IsIntrinsic()) {
     Intrinsics intrinsic = static_cast<Intrinsics>(method->GetIntrinsic());
     SetIntrinsic(intrinsic,
-                 NeedsEnvironmentOrCacheIntrinsic(intrinsic),
+                 NeedsEnvironmentIntrinsic(intrinsic),
                  GetSideEffectsIntrinsic(intrinsic),
                  GetExceptionsIntrinsic(intrinsic));
   }