Add support for -Xverify:none mode.

This mode skips all verification and compilation.
Public bug: https://code.google.com/p/android/issues/detail?id=67664

Change-Id: Idd00ab8e9e46d129c02988b063c41a507e07bf5b
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index c10dd84..a120d05 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -598,6 +598,11 @@
                                 ThreadPool* thread_pool, TimingLogger* timings) {
   LoadImageClasses(timings);
 
+  if (!compiler_options_->IsVerificationEnabled()) {
+    VLOG(compiler) << "Verify none mode specified, skipping pre-compilation";
+    return;
+  }
+
   Resolve(class_loader, dex_files, thread_pool, timings);
 
   Verify(class_loader, dex_files, thread_pool, timings);
@@ -1872,7 +1877,7 @@
 
   if ((access_flags & kAccNative) != 0) {
     // Are we interpreting only and have support for generic JNI down calls?
-    if ((compiler_options_->GetCompilerFilter() == CompilerOptions::kInterpretOnly) &&
+    if (!compiler_options_->IsCompilationEnabled() &&
         (instruction_set_ == kX86_64 || instruction_set_ == kArm64)) {
       // Leaving this empty will trigger the generic JNI version
     } else {
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 0cca1e9..20c6bc8 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -22,7 +22,8 @@
 class CompilerOptions {
  public:
   enum CompilerFilter {
-    kInterpretOnly,       // Compile nothing.
+    kVerifyNone,          // Skip verification and compile nothing except JNI stubs.
+    kInterpretOnly,       // Compile nothing except JNI stubs.
     kProfiled,            // Compile based on profile.
     kSpace,               // Maximize space savings.
     kBalanced,            // Try to get the best performance return on compilation investment.
@@ -86,6 +87,15 @@
     compiler_filter_ = compiler_filter;
   }
 
+  bool IsCompilationEnabled() const {
+    return ((compiler_filter_ != CompilerOptions::kVerifyNone) &&
+            (compiler_filter_ != CompilerOptions::kInterpretOnly));
+  }
+
+  bool IsVerificationEnabled() const {
+    return (compiler_filter_ != CompilerOptions::kVerifyNone);
+  }
+
   size_t GetHugeMethodThreshold() const {
     return huge_method_threshold_;
   }