Commit b0e4bf13 authored by Ali Ijaz Sheikh's avatar Ali Ijaz Sheikh Committed by Commit Bot

[heap] add assertions to ensure step size remains positive

These assertions would have caught the bug closer to the source.

BUG=v8:7313

Change-Id: I19b75c3fc7bff8216dda370114ff00326f128116
Reviewed-on: https://chromium-review.googlesource.com/887175Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Ali Ijaz Sheikh <ofrobots@google.com>
Cr-Commit-Position: refs/heads/master@{#50910}
parent 203e5916
...@@ -6688,6 +6688,7 @@ void AllocationObserver::AllocationStep(int bytes_allocated, ...@@ -6688,6 +6688,7 @@ void AllocationObserver::AllocationStep(int bytes_allocated,
step_size_ = GetNextStepSize(); step_size_ = GetNextStepSize();
bytes_to_next_step_ = step_size_; bytes_to_next_step_ = step_size_;
} }
DCHECK_GE(bytes_to_next_step_, 0);
} }
namespace { namespace {
......
...@@ -1371,7 +1371,7 @@ intptr_t Space::GetNextInlineAllocationStepSize() { ...@@ -1371,7 +1371,7 @@ intptr_t Space::GetNextInlineAllocationStepSize() {
next_step = next_step ? Min(next_step, observer->bytes_to_next_step()) next_step = next_step ? Min(next_step, observer->bytes_to_next_step())
: observer->bytes_to_next_step(); : observer->bytes_to_next_step();
} }
DCHECK(allocation_observers_.size() == 0 || next_step != 0); DCHECK(allocation_observers_.size() == 0 || next_step > 0);
return next_step; return next_step;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment