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/calling_convention_x86.cc b/src/calling_convention_x86.cc
index 2d9b07f..9420849 100644
--- a/src/calling_convention_x86.cc
+++ b/src/calling_convention_x86.cc
@@ -48,6 +48,27 @@
 
 // JNI calling convention
 
+size_t JniCallingConvention::FrameSize() {
+  // Return address and Method*
+  size_t frame_data_size = 2 * kPointerSize;
+  // Handles plus 2 words for SHB header
+  size_t handle_area_size = (HandleCount() + 2) * kPointerSize;
+  // Plus return value spill area size
+  return RoundUp(frame_data_size + handle_area_size + SizeOfReturnValue(), 16);
+}
+
+size_t JniCallingConvention::SpillAreaSize() {
+  // No spills, return address was pushed at the top of the frame
+  return 0;
+}
+
+std::vector<ManagedRegister>* JniCallingConvention::ComputeRegsToSpillPreCall()
+{
+  // No live values in registers (everything is on the stack) so never anything
+  // to preserve.
+  return  new std::vector<ManagedRegister>();
+}
+
 bool JniCallingConvention::IsOutArgRegister(ManagedRegister) {
   return false;  // Everything is passed by stack
 }