Workaround Darwin ContainedWithinExistingMap issue

Bug: 16861075
Change-Id: I577a0c7ede919e610c356e7c40dd60d87914dd3a
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index 4d3f8c9..0615abd 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -130,6 +130,7 @@
 uintptr_t MemMap::next_mem_pos_ = GenerateNextMemPos();
 #endif
 
+#if !defined(__APPLE__)  // TODO: Reanable after b/16861075 BacktraceMap issue is addressed.
 // Return true if the address range is contained in a single /proc/self/map entry.
 static bool ContainedWithinExistingMap(uintptr_t begin,
                                        uintptr_t end,
@@ -152,6 +153,7 @@
                             begin, end, maps.c_str());
   return false;
 }
+#endif
 
 // Return true if the address range does not conflict with any /proc/self/maps entry.
 static bool CheckNonOverlapping(uintptr_t begin,
@@ -386,8 +388,6 @@
                                  std::string* error_msg) {
   CHECK_NE(0, prot);
   CHECK_NE(0, flags & (MAP_SHARED | MAP_PRIVATE));
-  uintptr_t expected = reinterpret_cast<uintptr_t>(expected_ptr);
-  uintptr_t limit = expected + byte_count;
 
   // Note that we do not allow MAP_FIXED unless reuse == true, i.e we
   // expect his mapping to be contained within an existing map.
@@ -396,7 +396,11 @@
     // Only use this if you actually made the page reservation yourself.
     CHECK(expected_ptr != nullptr);
 
+#if !defined(__APPLE__)  // TODO: Reanable after b/16861075 BacktraceMap issue is addressed.
+    uintptr_t expected = reinterpret_cast<uintptr_t>(expected_ptr);
+    uintptr_t limit = expected + byte_count;
     DCHECK(ContainedWithinExistingMap(expected, limit, error_msg));
+#endif
     flags |= MAP_FIXED;
   } else {
     CHECK_EQ(0, flags & MAP_FIXED);