[asan] get rid of std::map. No STL and almost no libstdc++ left. 

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@145706 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc
index 5518641..609c007 100644
--- a/lib/asan/asan_rtl.cc
+++ b/lib/asan/asan_rtl.cc
@@ -174,6 +174,23 @@
   CHECK(res == (void*)beg);
 }
 
+// ---------------------- LowLevelAllocator ------------- {{{1
+void *LowLevelAllocator::Allocate(size_t size) {
+  CHECK((size & (size - 1)) == 0 && "size must be a power of two");
+  if (allocated_end_ - allocated_current_ < size) {
+    size_t size_to_allocate = Max(size, kPageSize);
+    allocated_current_ = (char*)asan_mmap(0, size_to_allocate,
+                                          PROT_READ | PROT_WRITE,
+                                          MAP_PRIVATE | MAP_ANON, -1, 0);
+    CHECK((allocated_current_ != (char*)-1) && "Can't mmap");
+    allocated_end_ = allocated_current_ + size_to_allocate;
+  }
+  CHECK(allocated_end_ - allocated_current_ >= size);
+  void *res = allocated_current_;
+  allocated_current_ += size;
+  return res;
+}
+
 // ---------------------- DescribeAddress -------------------- {{{1
 static bool DescribeStackAddress(uintptr_t addr, uintptr_t access_size) {
   AsanThread *t = asanThreadRegistry().FindThreadByStackAddress(addr);