Skip to content

Commit

Permalink
[zone] Fix propagation of OOM in Zone::NewSegment.
Browse files Browse the repository at this point in the history
This fixes various allocator methods to properly propagate {nullptr} to
callers without accidentally dereferencing it. We also disable one test
case for stress mode as it runs out of memory due to inlining limits
being lifted in the stress mode.

R=bmeurer@chromium.org
TEST=mjsunit/array-natives-elements
BUG=v8:6061

Change-Id: Id0a7b826a8612d00b4f4ae8aa0bea011c50890ca
Reviewed-on: https://chromium-review.googlesource.com/451365
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43672}
  • Loading branch information
Michael Starzinger authored and Commit Bot committed Mar 8, 2017
1 parent 6560707 commit fb887b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/zone/accounting-allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ Segment* AccountingAllocator::GetSegment(size_t bytes) {
Segment* result = GetSegmentFromPool(bytes);
if (result == nullptr) {
result = AllocateSegment(bytes);
result->Initialize(bytes);
if (result != nullptr) {
result->Initialize(bytes);
}
}

return result;
Expand Down
4 changes: 2 additions & 2 deletions src/zone/zone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ void Zone::DeleteAll() {
// of the segment chain. Returns the new segment.
Segment* Zone::NewSegment(size_t requested_size) {
Segment* result = allocator_->GetSegment(requested_size);
DCHECK_GE(result->size(), requested_size);
segment_bytes_allocated_ += result->size();
if (result != nullptr) {
DCHECK_GE(result->size(), requested_size);
segment_bytes_allocated_ += result->size();
result->set_zone(this);
result->set_next(segment_head_);
segment_head_ = result;
Expand Down
1 change: 1 addition & 0 deletions test/mjsunit/mjsunit.status
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@
['variant == stress', {
'es6/array-iterator-turbo': [SKIP],

'array-natives-elements': [SKIP],
'ignition/regress-599001-verifyheap': [SKIP],
'unicode-test': [SKIP],
}], # variant == stress
Expand Down

0 comments on commit fb887b8

Please sign in to comment.