Home | History | Annotate | Download | only in src

Lines Matching defs:segment

16 // chained together forming a LIFO structure with the newest segment
20 class Segment {
22 void Initialize(Segment* next, int size) {
27 Segment* next() const { return next_; }
31 int capacity() const { return size_ - sizeof(Segment); }
33 Address start() const { return address(sizeof(Segment)); }
37 // Computes the address of the nth byte in this segment.
42 Segment* next_;
112 // Find a segment with a suitable size to keep around.
113 Segment* keep = NULL;
115 // and freeing every segment except the one we wish to keep.
116 for (Segment* current = segment_head_; current != NULL; ) {
117 Segment* next = current->next();
119 // Unlink the segment we wish to keep from the list.
127 // Zap the entire current segment (including the header).
135 // If we have found a segment we want to keep, we must recompute the
138 // force a new segment to be allocated on demand.
143 // Un-poison so we can re-use the segment later.
146 // Zap the contents of the kept segment (but not the header).
153 // Update the head segment to be the kept segment (if any).
170 // Zap the entire kept segment (including the header).
181 // Creates a new segment, sets it size, and pushes it to the front
182 // of the segment chain. Returns the new segment.
183 Segment* Zone::NewSegment(int size) {
184 Segment* result = reinterpret_cast<Segment*>(Malloced::New(size));
194 // Deletes the given segment. Does not touch the segment chain.
195 void Zone::DeleteSegment(Segment* segment, int size) {
197 Malloced::Delete(segment);
207 // Compute the new segment size. We use a 'high water mark'
208 // strategy, where we increase the segment size every time we expand
209 // except that we employ a maximum segment size when we delete. This
211 Segment* head = segment_head_;
213 static const size_t kSegmentOverhead = sizeof(Segment) + kAlignment;
226 // Limit the size of new segments to avoid growing the segment size
228 // All the while making sure to allocate a segment large enough to hold the
236 Segment* segment = NewSegment(static_cast<int>(new_size));
237 if (segment == NULL) {
242 // Recompute 'top' and 'limit' based on the new segment.
243 Address result = RoundUp(segment->start(), kAlignment);
246 // (Should not happen since the segment is guaranteed to accomodate
253 limit_ = segment->end();