Fix preverify.

The thread-local allocation stack change:

  https://android-review.googlesource.com/82056

broke preverify. This change fixes it.

Change-Id: I2625e47d48d0fd48dff6c9210be6ebffe7a5f233
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index f1126ef..98db27a 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -1878,10 +1878,14 @@
 
 // Must do this with mutators suspended since we are directly accessing the allocation stacks.
 bool Heap::VerifyHeapReferences() {
-  Locks::mutator_lock_->AssertExclusiveHeld(Thread::Current());
+  Thread* self = Thread::Current();
+  Locks::mutator_lock_->AssertExclusiveHeld(self);
   // Lets sort our allocation stacks so that we can efficiently binary search them.
   allocation_stack_->Sort();
   live_stack_->Sort();
+  // Since we sorted the allocation stack content, need to revoke all
+  // thread-local allocation stacks.
+  RevokeAllThreadLocalAllocationStacks(self);
   VerifyObjectVisitor visitor(this);
   // Verify objects in the allocation stack since these will be objects which were:
   // 1. Allocated prior to the GC (pre GC verification).
@@ -1997,10 +2001,14 @@
 };
 
 bool Heap::VerifyMissingCardMarks() {
-  Locks::mutator_lock_->AssertExclusiveHeld(Thread::Current());
+  Thread* self = Thread::Current();
+  Locks::mutator_lock_->AssertExclusiveHeld(self);
 
   // We need to sort the live stack since we binary search it.
   live_stack_->Sort();
+  // Since we sorted the allocation stack content, need to revoke all
+  // thread-local allocation stacks.
+  RevokeAllThreadLocalAllocationStacks(self);
   VerifyLiveStackReferences visitor(this);
   GetLiveBitmap()->Visit(visitor);