Compilation filter

This CL introduces a static compilation filter mechanism intended
to allow us to reduce compilation time and space requirements until
we have a profiling mechanism in place.

It supports 5 modes of filtering:

   o interpret-only (compile nothing)
   o deferred-compilation (compile only those methods believe to be
     compute-intensive)
   o space (optimized for space)
   o balanced (best return on space investment)
   o speed (compile everything)

A future CL will allow the default filtering mode to be set
via system property.  For now, you can pass it in via command
line as follows:

   dalvikvm -compiler-filter:[interpret-only|defer-compilation|
                              space|balanced|speed]

or dex2oat --runtime-arg -compiler-filter:[one of the above modes]

Creating a file named art/SMALL_ART will force the filter
default to interpret-only.  Later on we'll move this capability
to a persistent system property.

or modify kDefaultCompilerFilter in runtime.h

It also changes the compiler driver to allow the compilers to
decline to compile a method by return NULL.

Change-Id: Ic73411818f8bb845a4a19a05b0395c50902c534f
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index c8c4347..b339974 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -847,11 +847,6 @@
     options.push_back(std::make_pair(runtime_args[i], reinterpret_cast<void*>(NULL)));
   }
 
-#if ART_SMALL_MODE
-  options.push_back(std::make_pair("-small", reinterpret_cast<void*>(NULL)));
-#endif  // ART_SMALL_MODE
-
-
 #ifdef ART_SEA_IR_MODE
   options.push_back(std::make_pair("-sea_ir", reinterpret_cast<void*>(NULL)));
 #endif
@@ -910,18 +905,19 @@
     }
   }
 
-  // If we're in small mode, but the program is small, turn off small mode.
-  // It doesn't make a difference for the boot image, so let's skip the check
-  // altogether.
-  if (Runtime::Current()->IsSmallMode() && !image) {
+  /*
+   * If we're not in interpret-only mode, go ahead and compile small applications. Don't
+   * bother to check if we're doing the image.
+   */
+  if (!image && (Runtime::Current()->GetCompilerFilter() != Runtime::kInterpretOnly)) {
     size_t num_methods = 0;
     for (size_t i = 0; i != dex_files.size(); ++i) {
       const DexFile* dex_file = dex_files[i];
       CHECK(dex_file != NULL);
       num_methods += dex_file->NumMethodIds();
     }
-    if (num_methods <= Runtime::Current()->GetSmallModeMethodThreshold()) {
-      Runtime::Current()->SetSmallMode(false);
+    if (num_methods <= Runtime::Current()->GetNumDexMethodsThreshold()) {
+      Runtime::Current()->SetCompilerFilter(Runtime::kSpeed);
       LOG(INFO) << "Below method threshold, compiling anyways";
     }
   }