diff options
Diffstat (limited to 'deps/v8/src/zone/zone.cc')
-rw-r--r-- | deps/v8/src/zone/zone.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/deps/v8/src/zone/zone.cc b/deps/v8/src/zone/zone.cc index 2b836f3778..9b5153d3f6 100644 --- a/deps/v8/src/zone/zone.cc +++ b/deps/v8/src/zone/zone.cc @@ -85,7 +85,7 @@ void Zone::DeleteAll() { // Traverse the chained list of segments and return them all to the allocator. for (Segment* current = segment_head_; current;) { Segment* next = current->next(); - size_t size = current->size(); + size_t size = current->total_size(); // Un-poison the segment content so we can re-use or zap it later. ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<void*>(current->start()), @@ -101,17 +101,16 @@ void Zone::DeleteAll() { segment_head_ = nullptr; } -// Creates a new segment, sets it size, and pushes it to the front +// Creates a new segment, sets its size, and pushes it to the front // of the segment chain. Returns the new segment. Segment* Zone::NewSegment(size_t requested_size) { - Segment* result = allocator_->GetSegment(requested_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; - } + Segment* result = allocator_->AllocateSegment(requested_size); + if (!result) return nullptr; + DCHECK_GE(result->total_size(), requested_size); + segment_bytes_allocated_ += result->total_size(); + result->set_zone(this); + result->set_next(segment_head_); + segment_head_ = result; return result; } @@ -128,7 +127,7 @@ Address Zone::NewExpand(size_t size) { // except that we employ a maximum segment size when we delete. This // is to avoid excessive malloc() and free() overhead. Segment* head = segment_head_; - const size_t old_size = (head == nullptr) ? 0 : head->size(); + const size_t old_size = head ? head->total_size() : 0; static const size_t kSegmentOverhead = sizeof(Segment) + kAlignmentInBytes; const size_t new_size_no_overhead = size + (old_size << 1); size_t new_size = kSegmentOverhead + new_size_no_overhead; |