Fix JNI compiler for synchronized methods.

Calls to the monitor enter/exit routines were passing the JNI env with
the iterator in the wrong position. Reset the iterator to make sure it
is in the correct position for the monitor enter/exit call.

Also fix clobbering of arguments in registers when calling monitor enter
for synchronized methods on ARM.

Also some tidying of code/comments.

Change-Id: I5bf1dd7e65d925e768411cb5865919ee5f54edbf
diff --git a/src/assembler_x86.h b/src/assembler_x86.h
index 400a304..2c7f2d2 100644
--- a/src/assembler_x86.h
+++ b/src/assembler_x86.h
@@ -3,6 +3,7 @@
 #ifndef ART_SRC_ASSEMBLER_X86_H_
 #define ART_SRC_ASSEMBLER_X86_H_
 
+#include <vector>
 #include "assembler.h"
 #include "constants.h"
 #include "globals.h"
@@ -398,20 +399,26 @@
   void jmp(Register reg);
   void jmp(Label* label);
 
-  void lock();
+  Assembler* lock();
   void cmpxchgl(const Address& address, Register reg);
 
-  void fs();
+  Assembler* fs();
 
   //
   // Macros for High-level operations.
   //
 
   // Emit code that will create an activation on the stack
-  void BuildFrame(size_t frame_size, ManagedRegister method_reg);
+  void BuildFrame(size_t frame_size, ManagedRegister method_reg,
+                  const std::vector<ManagedRegister>& spill_regs);
 
   // Emit code that will remove an activation from the stack
-  void RemoveFrame(size_t frame_size);
+  void RemoveFrame(size_t frame_size,
+                   const std::vector<ManagedRegister>& spill_regs);
+
+  // Fill registers from spill area - no-op on x86
+  void FillFromSpillArea(const std::vector<ManagedRegister>& spill_regs,
+                         size_t displacement);
 
   void IncreaseFrameSize(size_t adjust);
   void DecreaseFrameSize(size_t adjust);
@@ -486,8 +493,7 @@
   void DoubleAbs(XmmRegister reg);
 
   void LockCmpxchgl(const Address& address, Register reg) {
-    lock();
-    cmpxchgl(address, reg);
+    lock()->cmpxchgl(address, reg);
   }
 
   //