Clear the right data pointer.

Internally, stack_map_data is an offset of the roots_data allocation.
Pass both to the ClearData method, which will use the right pointer
to deallocate.

Test: test-art-host in debug mode
Change-Id: Ibfe38e7f1853870076048427f2efe7121c11c136
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 719faed..9d881f2 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -482,9 +482,16 @@
   return used_memory_for_data_;
 }
 
-void JitCodeCache::ClearData(Thread* self, void* data) {
+static const uint8_t* FromStackMapToRoots(const uint8_t* stack_map_data) {
+  return stack_map_data - ComputeRootTableSize(GetNumberOfRoots(stack_map_data));
+}
+
+void JitCodeCache::ClearData(Thread* self,
+                             uint8_t* stack_map_data,
+                             uint8_t* roots_data) {
+  DCHECK_EQ(FromStackMapToRoots(stack_map_data), roots_data);
   MutexLock mu(self, lock_);
-  FreeData(reinterpret_cast<uint8_t*>(data));
+  FreeData(reinterpret_cast<uint8_t*>(roots_data));
 }
 
 void JitCodeCache::ReserveData(Thread* self,