Revert "Support FastVerify with speed-profile."

This reverts commit 1c262ad3f1fd9f9b07d16afe70990cd8bfdc3bda.

Reason for revert: CHECKer failures e.g. https://ci.chromium.org/ui/p/art/builders/ci/host-x86-cms/8703/overview

Change-Id: I48fd251a52b5f18e3ea192bc2102df509d578aaf
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc
index 763d379..c60d974 100644
--- a/compiler/jni/quick/jni_compiler.cc
+++ b/compiler/jni/quick/jni_compiler.cc
@@ -154,11 +154,11 @@
     // -- Don't allow any objects as parameter or return value
     if (UNLIKELY(is_critical_native)) {
       CHECK(is_static)
-          << "@CriticalNative functions cannot be virtual since that would "
+          << "@CriticalNative functions cannot be virtual since that would"
           << "require passing a reference parameter (this), which is illegal "
           << dex_file.PrettyMethod(method_idx, /* with_signature= */ true);
       CHECK(!is_synchronized)
-          << "@CriticalNative functions cannot be synchronized since that would "
+          << "@CriticalNative functions cannot be synchronized since that would"
           << "require passing a (class and/or this) reference parameter, which is illegal "
           << dex_file.PrettyMethod(method_idx, /* with_signature= */ true);
       for (size_t i = 0; i < strlen(shorty); ++i) {
diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc
index 3a5ccee..6d4fdf3 100644
--- a/compiler/optimizing/reference_type_propagation.cc
+++ b/compiler/optimizing/reference_type_propagation.cc
@@ -539,14 +539,9 @@
   DCHECK_EQ(instr->GetType(), DataType::Type::kReference);
 
   ScopedObjectAccess soa(Thread::Current());
-  StackHandleScope<2> hs(soa.Self());
-  Handle<mirror::DexCache> dex_cache =
-      hs.NewHandle(FindDexCacheWithHint(soa.Self(), dex_file, hint_dex_cache_));
-  Handle<mirror::ClassLoader> loader = hs.NewHandle(dex_cache->GetClassLoader());
-  ObjPtr<mirror::Class> klass = Runtime::Current()->GetClassLinker()->ResolveType(
-      type_idx, dex_cache, loader);
-  DCHECK_EQ(klass == nullptr, soa.Self()->IsExceptionPending());
-  soa.Self()->ClearException();  // Clean up the exception left by type resolution if any.
+  ObjPtr<mirror::DexCache> dex_cache = FindDexCacheWithHint(soa.Self(), dex_file, hint_dex_cache_);
+  ObjPtr<mirror::Class> klass = Runtime::Current()->GetClassLinker()->LookupResolvedType(
+      type_idx, dex_cache, dex_cache->GetClassLoader());
   SetClassAsTypeInfo(instr, klass, is_exact);
 }
 
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index f4c3e2a..6c71372 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -1752,7 +1752,9 @@
     }
 
     // Setup VerifierDeps for compilation and report if we fail to parse the data.
-    if (input_vdex_file_ != nullptr) {
+    // When we do profile guided optimizations, the compiler currently needs to run
+    // full verification.
+    if (!DoProfileGuidedOptimizations() && input_vdex_file_ != nullptr) {
       std::unique_ptr<verifier::VerifierDeps> verifier_deps(
           new verifier::VerifierDeps(dex_files, /*output_only=*/ false));
       if (!verifier_deps->ParseStoredData(dex_files, input_vdex_file_->GetVerifierDepsData())) {
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index df7835d..23bbe14 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -471,13 +471,7 @@
       const DexFile& dex_file,
       Handle<mirror::DexCache> dex_cache) {
     DCHECK(driver != nullptr);
-    const VerificationResults* results = driver->GetVerificationResults();
-    DCHECK(results != nullptr);
-    MethodReference method_ref(&dex_file, method_idx);
     CompiledMethod* compiled_method = nullptr;
-    if (results->IsUncompilableMethod(method_ref)) {
-      return compiled_method;
-    }
 
     if ((access_flags & kAccNative) != 0) {
       // Are we extracting only and have support for generic JNI down calls?
@@ -502,9 +496,14 @@
       // Method is annotated with @NeverCompile and should not be compiled.
     } else {
       const CompilerOptions& compiler_options = driver->GetCompilerOptions();
+      const VerificationResults* results = driver->GetVerificationResults();
+      DCHECK(results != nullptr);
+      MethodReference method_ref(&dex_file, method_idx);
       // Don't compile class initializers unless kEverything.
       bool compile = (compiler_options.GetCompilerFilter() == CompilerFilter::kEverything) ||
          ((access_flags & kAccConstructor) == 0) || ((access_flags & kAccStatic) == 0);
+      // Check if it's an uncompilable method found by the verifier.
+      compile = compile && !results->IsUncompilableMethod(method_ref);
       // Check if we should compile based on the profile.
       compile = compile && ShouldCompileBasedOnProfile(compiler_options, profile_index, method_ref);
 
@@ -1712,7 +1711,6 @@
     // a boot image class, or a class in a different dex file for multidex, and
     // we should not update the status in that case.
     if (&cls->GetDexFile() == &accessor.GetDexFile()) {
-      VLOG(compiler) << "Updating class status of " << std::string(descriptor) << " to " << status;
       ObjectLock<mirror::Class> lock(self, cls);
       mirror::Class::SetStatus(cls, status, self);
     }
@@ -1755,8 +1753,6 @@
       !GetCompilerOptions().IsAnyCompilationEnabled() &&
       !GetCompilerOptions().IsGeneratingImage();
 
-  const bool is_generating_image = GetCompilerOptions().IsGeneratingImage();
-
   // We successfully validated the dependencies, now update class status
   // of verified classes. Note that the dependencies also record which classes
   // could not be fully verified; we could try again, but that would hurt verification
@@ -1780,16 +1776,6 @@
         // fail, but that's OK.
         compiled_classes_.Insert(ref, existing, status);
       } else {
-        if (is_generating_image &&
-            status == ClassStatus::kVerifiedNeedsAccessChecks &&
-            GetCompilerOptions().IsImageClass(accessor.GetDescriptor())) {
-          // If the class will be in the image, we can rely on the ArtMethods
-          // telling that they need access checks.
-          VLOG(compiler) << "Promoting "
-                         << std::string(accessor.GetDescriptor())
-                         << " from needs access checks to verified given it is an image class";
-          status = ClassStatus::kVerified;
-        }
         // Update the class status, so later compilation stages know they don't need to verify
         // the class.
         LoadAndUpdateStatus(accessor, status, class_loader, soa.Self());
@@ -1797,7 +1783,7 @@
 
       // Vdex marks class as unverified for two reasons only:
       // 1. It has a hard failure, or
-      // 2. One of its method needs lock counting.
+      // 2. Once of its method needs lock counting.
       //
       // The optimizing compiler expects a method to not have a hard failure before
       // compiling it, so for simplicity just disable any compilation of methods
@@ -2157,7 +2143,6 @@
       // Also return early and don't store the class status in the recorded class status.
       return;
     }
-
     ClassStatus old_status = klass->GetStatus();
     // Only try to initialize classes that were successfully verified.
     if (klass->IsVerified()) {
diff --git a/test/660-clinit/profile b/test/660-clinit/profile
index 3fa1d3a..9eb4924 100644
--- a/test/660-clinit/profile
+++ b/test/660-clinit/profile
@@ -9,6 +9,5 @@
 LGs;
 LObjectRef;
 LInvokeStatic;
-LInImage;
 LClinitE;
 LPrint;
diff --git a/test/660-clinit/src/Main.java b/test/660-clinit/src/Main.java
index ba7a9d2..0d6837e 100644
--- a/test/660-clinit/src/Main.java
+++ b/test/660-clinit/src/Main.java
@@ -202,19 +202,13 @@
   }
 }
 
-class InImage {
-  static int exec(int a, int b) {
-    return a + b;
-  }
-}
-
 // test of INVOKE_STATIC instruction
 class InvokeStatic {
   static int a;
   static int b;
   static {
-    a = InImage.exec(10, 20);
-    b = InImage.exec(10, 20);
+    a = Add.exec(10, 20);
+    b = Mul.exec(10, 20);
   }
 }