Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: src/zone/zone.cc

Issue 2401163002: Revert of Replaced different means of zone pooling/reusing by one zone segment pool (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/zone/zone.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/zone/zone.h" 5 #include "src/zone/zone.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // Un-poison the segment content so we can re-use or zap it later. 99 // Un-poison the segment content so we can re-use or zap it later.
100 ASAN_UNPOISON_MEMORY_REGION(current->start(), current->capacity()); 100 ASAN_UNPOISON_MEMORY_REGION(current->start(), current->capacity());
101 101
102 segment_bytes_allocated_ -= size; 102 segment_bytes_allocated_ -= size;
103 allocator_->ReturnSegment(current); 103 allocator_->ReturnSegment(current);
104 current = next; 104 current = next;
105 } 105 }
106 106
107 position_ = limit_ = 0; 107 position_ = limit_ = 0;
108
108 allocation_size_ = 0; 109 allocation_size_ = 0;
110 // Update the head segment to be the kept segment (if any).
109 segment_head_ = nullptr; 111 segment_head_ = nullptr;
110 } 112 }
111 113
112 // Creates a new segment, sets it size, and pushes it to the front 114 // Creates a new segment, sets it size, and pushes it to the front
113 // of the segment chain. Returns the new segment. 115 // of the segment chain. Returns the new segment.
114 Segment* Zone::NewSegment(size_t requested_size) { 116 Segment* Zone::NewSegment(size_t requested_size) {
115 Segment* result = allocator_->GetSegment(requested_size); 117 Segment* result = allocator_->GetSegment(requested_size);
116 DCHECK_GE(result->size(), requested_size); 118 DCHECK_GE(result->size(), requested_size);
117 segment_bytes_allocated_ += result->size(); 119 segment_bytes_allocated_ += result->size();
118 if (result != nullptr) { 120 if (result != nullptr) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // size bytes + header and alignment padding) 176 // size bytes + header and alignment padding)
175 DCHECK(reinterpret_cast<uintptr_t>(position_) >= 177 DCHECK(reinterpret_cast<uintptr_t>(position_) >=
176 reinterpret_cast<uintptr_t>(result)); 178 reinterpret_cast<uintptr_t>(result));
177 limit_ = segment->end(); 179 limit_ = segment->end();
178 DCHECK(position_ <= limit_); 180 DCHECK(position_ <= limit_);
179 return result; 181 return result;
180 } 182 }
181 183
182 } // namespace internal 184 } // namespace internal
183 } // namespace v8 185 } // namespace v8
OLDNEW
« no previous file with comments | « src/zone/zone.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698