Revert "[zone] Keep one page when we Zone::Reset for reuse"

This reverts commit 8c359f64e2.

Reason for revert: Tentative revert for ASAN breakage

Original change's description:
> [zone] Keep one page when we Zone::Reset for reuse
> 
> Change-Id: I50c6124d3da5b35d4156c066f38d10d2dc966567
> Reviewed-on: https://chromium-review.googlesource.com/c/1349246
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#57793}

TBR=ishell@chromium.org,verwaest@chromium.org

Change-Id: Iff319b5f0ad1a65b1171d219a02a4a75d33910bd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1349248
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57797}
This commit is contained in:
Toon Verwaest 2018-11-23 20:43:58 +00:00 committed by Commit Bot
parent 4ae9ae50cc
commit 2418d22a37
3 changed files with 5 additions and 12 deletions

View File

@ -1488,7 +1488,7 @@ void DeclarationScope::ResetAfterPreparsing(AstValueFactory* ast_value_factory,
has_rest_ = false;
DCHECK_NE(zone_, ast_value_factory->zone());
zone_->Reset();
zone_->ReleaseMemory();
if (aborted) {
// Prepare scope for use in the outer zone.

View File

@ -73,16 +73,10 @@ void* Zone::AsanNew(size_t size) {
return reinterpret_cast<void*>(result);
}
void Zone::Reset() {
if (!segment_head_) return;
void Zone::ReleaseMemory() {
allocator_->ZoneDestruction(this);
Segment* keep = segment_head_;
segment_head_ = segment_head_->next();
keep->set_next(nullptr);
DeleteAll();
allocator_->ZoneCreation(this);
keep->ZapContents();
segment_head_ = keep;
}
void Zone::DeleteAll() {

View File

@ -69,10 +69,9 @@ class V8_EXPORT_PRIVATE Zone final {
// Seals the zone to prevent any further allocation.
void Seal() { sealed_ = true; }
// Allows the zone to be safely reused. Releases the memory except for the
// last page, and fires zone destruction and creation events for the
// accounting allocator.
void Reset();
// Allows the zone to be safely reused. Releases the memory and fires zone
// destruction and creation events for the accounting allocator.
void ReleaseMemory();
// Returns true if more memory has been allocated in zones than
// the limit allows.