In ASan, we have a custom OS X malloc zone and a few malloc-related interceptors implemented in asan_malloc_mac.cc. Since intercepting just malloc/realloc/free is not enough for OS X (we will miss some allocations), we need to implement the malloc zone for TSan as well.
This patch moves the malloc zone implementation into sanitizer_malloc_mac.inc and factors out the ASan-specific details, which remain in asan_malloc_mac.cc. After that, TSan can reuse that in tsan_malloc_mac.cc. All of this is done via macros (COMMON_MALLOC_*), mostly because of the stack trace handling in interceptors (and the interceptors themselves need to be in a .inc file).
There are a few pieces missing in the TSan's use of the malloc zone (e.g. COMMON_MALLOC_FILL_STATS is empty), but they're not really required and I'd like to first get to a point where we can actually *run* TSan without crashing during startup (before we implement non-essential features).
(This is part of an effort to port TSan to OS X, and it's one the very first steps. Don't expect TSan on OS X to actually work or pass tests at this point.)