Add way to select arena type at runtime

We now use MemMap for JIT, and malloc for everything else. This
should help fix the allegedly regressed compile times.

Change-Id: I6a6552738933f9d7ee3bd23f45e310818b19b70d
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 61798c3..0728646 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -788,7 +788,6 @@
   max_spins_before_thin_lock_inflation_ =
       runtime_options.GetOrDefault(Opt::MaxSpinsBeforeThinLockInflation);
 
-  arena_pool_.reset(new ArenaPool);
   monitor_list_ = new MonitorList;
   monitor_pool_ = MonitorPool::Create();
   thread_list_ = new ThreadList;
@@ -856,6 +855,11 @@
     CreateJit();
   }
 
+  // Use MemMap arena pool for jit, malloc otherwise. Malloc arenas are faster to allocate but
+  // can't be trimmed as easily.
+  const bool use_malloc = jit_options_.get() == nullptr;
+  arena_pool_.reset(new ArenaPool(use_malloc));
+
   BlockSignals();
   InitPlatformSignalHandlers();