Upgrade to latest dlmalloc. Refactor Heap and related APIs to use STL like naming.

We fail assertions in the existing heap code, as does Dalvik. This refactoring
is to clean the heap and space APIs and to reduce duplication of data
and thereby solve a failing assertion in the card table.

This change also wires up clearing of soft references including before
out-of-memory errors are reported.

In doing this change it was made clear that mspaces are buggy (and
violating invariants with the garbage collector). This
change upgrades to an un-Android molested version of dlmalloc-2.8.5 and
implements a version of the mspace morecore routine under ART control.

run-test 061-out-of-memory is updated for current heap sizes.

Change-Id: I377e83ab2a8c78afb9b1881f03356929e2c9dc64
diff --git a/src/zip_archive.cc b/src/zip_archive.cc
index 73728a2..fd7086f 100644
--- a/src/zip_archive.cc
+++ b/src/zip_archive.cc
@@ -121,7 +121,7 @@
 }
 
 static bool CopyFdToMemory(MemMap& mem_map, int in, size_t count) {
-  uint8_t* dst = mem_map.GetAddress();
+  uint8_t* dst = mem_map.Begin();
   std::vector<uint8_t> buf(kBufSize);
   while (count != 0) {
     size_t bytes_to_read = (count > kBufSize) ? kBufSize : count;
@@ -134,7 +134,7 @@
     dst += bytes_to_read;
     count -= bytes_to_read;
   }
-  DCHECK_EQ(dst, mem_map.GetLimit());
+  DCHECK_EQ(dst, mem_map.End());
   return true;
 }
 
@@ -165,7 +165,7 @@
 };
 
 static bool InflateToMemory(MemMap& mem_map, int in, size_t uncompressed_length, size_t compressed_length) {
-  uint8_t* dst = mem_map.GetAddress();
+  uint8_t* dst = mem_map.Begin();
   UniquePtr<uint8_t[]> read_buf(new uint8_t[kBufSize]);
   UniquePtr<uint8_t[]> write_buf(new uint8_t[kBufSize]);
   if (read_buf.get() == NULL || write_buf.get() == NULL) {
@@ -235,7 +235,7 @@
     return false;
   }
 
-  DCHECK_EQ(dst, mem_map.GetLimit());
+  DCHECK_EQ(dst, mem_map.End());
   return true;
 }
 
@@ -438,8 +438,8 @@
 }
 
 bool ZipArchive::Parse() {
-  const byte* cd_ptr = dir_map_->GetAddress();
-  size_t cd_length = dir_map_->GetLength();
+  const byte* cd_ptr = dir_map_->Begin();
+  size_t cd_length = dir_map_->Size();
 
   // Walk through the central directory, adding entries to the hash
   // table and verifying values.