Method prologue and epilogues, add missing x86 functionality.

Enables compiling and running a number of JNI internal managed code
methods on the host.

Change-Id: I56fceb813d0cb24637bc784ba57f2d1d16911d48
diff --git a/src/compiled_method.cc b/src/compiled_method.cc
index b998b3c..259ee44 100644
--- a/src/compiled_method.cc
+++ b/src/compiled_method.cc
@@ -35,7 +35,12 @@
     : instruction_set_(instruction_set), frame_size_in_bytes_(frame_size_in_bytes),
       core_spill_mask_(core_spill_mask), fp_spill_mask_(fp_spill_mask) {
   CHECK_NE(code.size(), 0U);
-  CHECK_GE(vmap_table.size(), 1U);  // should always contain an entry for LR
+  if (instruction_set != kX86) {
+    CHECK_GE(vmap_table.size(), 1U);  // should always contain an entry for LR
+  }
+  DCHECK_EQ(vmap_table.size(),
+            static_cast<uint32_t>(__builtin_popcount(core_spill_mask)
+                                  + __builtin_popcount(fp_spill_mask)));
   CHECK_LE(vmap_table.size(), (1U << 16) - 1); // length must fit in 2^16-1
 
   size_t code_byte_count = code.size() * sizeof(code[0]);