Compile filter for small applications and methods

Adds a filter per method and program size (in method count). Right now, options are treated
as runtime options...but we might want to change this and separate options for compilers and
runtime.

Change-Id: I8c3e925116119af8ffa95ff09f77bcfdd173767b
diff --git a/src/runtime.cc b/src/runtime.cc
index 25d26b8..d886fe3 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -364,6 +364,10 @@
   parsed->hook_exit_ = exit;
   parsed->hook_abort_ = NULL; // We don't call abort(3) by default; see Runtime::Abort.
 
+  parsed->small_mode_ = true;
+  parsed->small_mode_method_threshold_ = Runtime::kDefaultSmallModeMethodThreshold;
+  parsed->small_mode_method_dex_size_limit_ = Runtime::kDefaultSmallModeMethodDexSizeLimit;
+
 //  gLogVerbosity.class_linker = true; // TODO: don't check this in!
 //  gLogVerbosity.compiler = true; // TODO: don't check this in!
 //  gLogVerbosity.heap = true; // TODO: don't check this in!
@@ -571,6 +575,12 @@
       Trace::SetDefaultClockSource(kProfilerClockSourceWall);
     } else if (option == "-Xprofile:dualclock") {
       Trace::SetDefaultClockSource(kProfilerClockSourceDual);
+    } else if (option == "-small") {
+      parsed->small_mode_ = true;
+    } else if (StartsWith(option, "-small-mode-methods-max:")) {
+      parsed->small_mode_method_threshold_ = ParseIntegerOrDie(option);
+    } else if (StartsWith(option, "-small-mode-methods-size-max:")) {
+      parsed->small_mode_method_dex_size_limit_ = ParseIntegerOrDie(option);
     } else {
       if (!ignore_unrecognized) {
         // TODO: print usage via vfprintf
@@ -791,6 +801,10 @@
   is_zygote_ = options->is_zygote_;
   is_concurrent_gc_enabled_ = options->is_concurrent_gc_enabled_;
 
+  small_mode_ = options->small_mode_;
+  small_mode_method_threshold_ = options->small_mode_method_threshold_;
+  small_mode_method_dex_size_limit_ = options->small_mode_method_dex_size_limit_;
+
   vfprintf_ = options->hook_vfprintf_;
   exit_ = options->hook_exit_;
   abort_ = options->hook_abort_;