Change root visitor to use Object**.

Simplifies code and improves the performance of root visiting since
we usually don't need to check to see if the object moved.

Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
diff --git a/runtime/arch/arm/context_arm.h b/runtime/arch/arm/context_arm.h
index 020cae0..4a0d082 100644
--- a/runtime/arch/arm/context_arm.h
+++ b/runtime/arch/arm/context_arm.h
@@ -45,6 +45,11 @@
     SetGPR(PC, new_pc);
   }
 
+  virtual uintptr_t* GetGPRAddress(uint32_t reg) {
+    DCHECK_LT(reg, static_cast<uint32_t>(kNumberOfCoreRegisters));
+    return gprs_[reg];
+  }
+
   virtual uintptr_t GetGPR(uint32_t reg) {
     DCHECK_LT(reg, static_cast<uint32_t>(kNumberOfCoreRegisters));
     return *gprs_[reg];
diff --git a/runtime/arch/context.h b/runtime/arch/context.h
index 3d11178..83bbb11 100644
--- a/runtime/arch/context.h
+++ b/runtime/arch/context.h
@@ -49,6 +49,9 @@
   // Set the program counter value
   virtual void SetPC(uintptr_t new_pc) = 0;
 
+  // Gets the given GPRs address.
+  virtual uintptr_t* GetGPRAddress(uint32_t reg) = 0;
+
   // Read the given GPR
   virtual uintptr_t GetGPR(uint32_t reg) = 0;
 
diff --git a/runtime/arch/mips/context_mips.h b/runtime/arch/mips/context_mips.h
index 4145cd3..d5f27ae 100644
--- a/runtime/arch/mips/context_mips.h
+++ b/runtime/arch/mips/context_mips.h
@@ -43,6 +43,11 @@
     SetGPR(RA, new_pc);
   }
 
+  virtual uintptr_t* GetGPRAddress(uint32_t reg) {
+    DCHECK_LT(reg, static_cast<uint32_t>(kNumberOfCoreRegisters));
+    return gprs_[reg];
+  }
+
   virtual uintptr_t GetGPR(uint32_t reg) {
     CHECK_LT(reg, static_cast<uint32_t>(kNumberOfCoreRegisters));
     return *gprs_[reg];
diff --git a/runtime/arch/x86/context_x86.cc b/runtime/arch/x86/context_x86.cc
index d7dca64..5cf3001 100644
--- a/runtime/arch/x86/context_x86.cc
+++ b/runtime/arch/x86/context_x86.cc
@@ -26,7 +26,7 @@
 static const uintptr_t gZero = 0;
 
 void X86Context::Reset() {
-  for (int i = 0; i < kNumberOfCpuRegisters; i++) {
+  for (size_t  i = 0; i < kNumberOfCpuRegisters; i++) {
     gprs_[i] = NULL;
   }
   gprs_[ESP] = &esp_;
diff --git a/runtime/arch/x86/context_x86.h b/runtime/arch/x86/context_x86.h
index 598314d..031fc92 100644
--- a/runtime/arch/x86/context_x86.h
+++ b/runtime/arch/x86/context_x86.h
@@ -43,8 +43,12 @@
     eip_ = new_pc;
   }
 
+  virtual uintptr_t* GetGPRAddress(uint32_t reg) {
+    DCHECK_LT(reg, kNumberOfCpuRegisters);
+    return gprs_[reg];
+  }
+
   virtual uintptr_t GetGPR(uint32_t reg) {
-    const uint32_t kNumberOfCpuRegisters = 8;
     DCHECK_LT(reg, kNumberOfCpuRegisters);
     return *gprs_[reg];
   }
diff --git a/runtime/arch/x86_64/context_x86_64.cc b/runtime/arch/x86_64/context_x86_64.cc
index 4d1131c..1310402 100644
--- a/runtime/arch/x86_64/context_x86_64.cc
+++ b/runtime/arch/x86_64/context_x86_64.cc
@@ -26,7 +26,7 @@
 static const uintptr_t gZero = 0;
 
 void X86_64Context::Reset() {
-  for (int i = 0; i < kNumberOfCpuRegisters; i++) {
+  for (size_t i = 0; i < kNumberOfCpuRegisters; i++) {
     gprs_[i] = NULL;
   }
   gprs_[RSP] = &rsp_;
diff --git a/runtime/arch/x86_64/context_x86_64.h b/runtime/arch/x86_64/context_x86_64.h
index 3e49165..37cd74c 100644
--- a/runtime/arch/x86_64/context_x86_64.h
+++ b/runtime/arch/x86_64/context_x86_64.h
@@ -43,8 +43,12 @@
     rip_ = new_pc;
   }
 
+  virtual uintptr_t* GetGPRAddress(uint32_t reg) {
+    DCHECK_LT(reg, kNumberOfCpuRegisters);
+    return gprs_[reg];
+  }
+
   virtual uintptr_t GetGPR(uint32_t reg) {
-    const uint32_t kNumberOfCpuRegisters = 8;
     DCHECK_LT(reg, kNumberOfCpuRegisters);
     return *gprs_[reg];
   }