[heap] Add debug checks for linear allocation area top and limit.

BUG=chromium:659165

Review-Url: https://codereview.chromium.org/2455103002
Cr-Commit-Position: refs/heads/master@{#40629}
This commit is contained in:
ulan 2016-10-27 09:08:01 -07:00 committed by Commit bot
parent 0ddddcb862
commit b7dae10e5b

View File

@ -2563,6 +2563,13 @@ FreeSpace* FreeList::FindNodeFor(size_t size_in_bytes, size_t* node_size) {
HeapObject* FreeList::Allocate(size_t size_in_bytes) {
DCHECK(size_in_bytes <= kMaxBlockSize);
DCHECK(IsAligned(size_in_bytes, kPointerSize));
DCHECK_LE(owner_->top(), owner_->limit());
#ifdef DEBUG
if (owner_->top() != owner_->limit()) {
DCHECK_EQ(Page::FromAddress(owner_->top()),
Page::FromAddress(owner_->limit() - 1));
}
#endif
// Don't free list allocate if there is linear space available.
DCHECK_LT(static_cast<size_t>(owner_->limit() - owner_->top()),
size_in_bytes);