Fix ScopedArenaAllocator::Reset() for Create()d allocators.

Change-Id: I88cbb329911ed489768772218b49b6f1756ffd86
diff --git a/compiler/utils/scoped_arena_allocator.cc b/compiler/utils/scoped_arena_allocator.cc
index aeb2f76..2616150 100644
--- a/compiler/utils/scoped_arena_allocator.cc
+++ b/compiler/utils/scoped_arena_allocator.cc
@@ -115,10 +115,18 @@
 }
 
 ScopedArenaAllocator::~ScopedArenaAllocator() {
-  Reset();
+  DoReset();
 }
 
 void ScopedArenaAllocator::Reset() {
+  DoReset();
+  // If this allocator was Create()d, we need to move the arena_stack_->top_ptr_ past *this.
+  if (mark_ptr_ == reinterpret_cast<uint8_t*>(this)) {
+    arena_stack_->top_ptr_ = mark_ptr_ + RoundUp(sizeof(ScopedArenaAllocator), 8);
+  }
+}
+
+void ScopedArenaAllocator::DoReset() {
   DebugStackReference::CheckTop();
   DebugStackRefCounter::CheckNoRefs();
   arena_stack_->UpdatePeakStatsAndRestore(*this);