Remove disable card marks, fix SetPatchLocation.

Should slightly improve performance. Added a no thread suspension allowed in patch oat code and
methods.

Added a new function to class linker, GetOatCodeFor which takes in a method reference instead of
pointer.

This fixes the issue where pruned methods were getting re-loaded during code and method patching.

Change-Id: I676bb88cb021b6d2e0db00adbcf1f2f04f82b72a
diff --git a/src/heap.h b/src/heap.h
index 984a329..8ed5881 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -230,28 +230,19 @@
   // Must be called if a field of an Object in the heap changes, and before any GC safe-point.
   // The call is not needed if NULL is stored in the field.
   void WriteBarrierField(const Object* dst, MemberOffset /*offset*/, const Object* /*new_value*/) {
-    if (!card_marking_disabled_) {
-      card_table_->MarkCard(dst);
-    }
+    card_table_->MarkCard(dst);
   }
 
   // Write barrier for array operations that update many field positions
   void WriteBarrierArray(const Object* dst, int /*start_offset*/,
                          size_t /*length TODO: element_count or byte_count?*/) {
-    if (UNLIKELY(!card_marking_disabled_)) {
-      card_table_->MarkCard(dst);
-    }
+    card_table_->MarkCard(dst);
   }
 
   CardTable* GetCardTable() {
     return card_table_.get();
   }
 
-  void DisableCardMarking() {
-    // TODO: we shouldn't need to disable card marking, this is here to help the image_writer
-    card_marking_disabled_ = true;
-  }
-
   void AddFinalizerReference(Thread* self, Object* object);
 
   size_t GetBytesAllocated() const;
@@ -412,10 +403,6 @@
   // If we have a zygote space.
   bool have_zygote_space_;
 
-  // Used by the image writer to disable card marking on copied objects
-  // TODO: remove
-  bool card_marking_disabled_;
-
   // Guards access to the state of GC, associated conditional variable is used to signal when a GC
   // completes.
   Mutex* gc_complete_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;