[Memory] Fix OS::Allocate on Windows / Cygwin.

- Changes assert to reflect that we might exceed the number of attempts
  to allocate a padded memory region while attempting to get an aligned
  allocation and return null instead.

Bug: chromium:813587
Change-Id: I0e225f50b7a64a2f2a72de15322525574445efbd
Reviewed-on: https://chromium-review.googlesource.com/926968
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51401}
This commit is contained in:
Bill Budge 2018-02-20 10:35:21 -08:00 committed by Commit Bot
parent f64a87c45a
commit f812038c06
2 changed files with 2 additions and 2 deletions

View File

@ -139,7 +139,7 @@ void* OS::Allocate(void* address, size_t size, size_t alignment,
// base will be nullptr.
if (base != nullptr) break;
}
DCHECK_EQ(base, aligned_base);
DCHECK_IMPLIES(base, base == aligned_base);
return reinterpret_cast<void*>(base);
}

View File

@ -829,7 +829,7 @@ void* OS::Allocate(void* address, size_t size, size_t alignment,
// base will be nullptr.
if (base != nullptr) break;
}
DCHECK_EQ(base, aligned_base);
DCHECK_IMPLIES(base, base == aligned_base);
return reinterpret_cast<void*>(base);
}