Home | History | Annotate | Download | only in src

Lines Matching refs:Segment

57 // chained together forming a LIFO structure with the newest segment
61 class Segment {
63 Segment* next() const { return next_; }
67 int capacity() const { return size_ - sizeof(Segment); }
69 Address start() const { return address(sizeof(Segment)); }
73 // Computes the address of the nth byte in this segment.
78 Segment* next_;
85 // Creates a new segment, sets it size, and pushes it to the front
86 // of the segment chain. Returns the new segment.
87 Segment* Zone::NewSegment(int size) {
88 Segment* result = reinterpret_cast<Segment*>(Malloced::New(size));
99 // Deletes the given segment. Does not touch the segment chain.
100 void Zone::DeleteSegment(Segment* segment, int size) {
102 Malloced::Delete(segment);
112 // Find a segment with a suitable size to keep around.
113 Segment* keep = segment_head_;
119 // and freeing every segment except the one we wish to keep.
120 Segment* current = segment_head_;
122 Segment* next = current->next();
124 // Unlink the segment we wish to keep from the list.
129 // Zap the entire current segment (including the header).
137 // If we have found a segment we want to keep, we must recompute the
140 // force a new segment to be allocated on demand.
146 // Zap the contents of the kept segment (but not the header).
153 // Update the head segment to be the kept segment (if any).
164 // Compute the new segment size. We use a 'high water mark'
165 // strategy, where we increase the segment size every time we expand
166 // except that we employ a maximum segment size when we delete. This
168 Segment* head = segment_head_;
170 static const int kSegmentOverhead = sizeof(Segment) + kAlignment;
175 // Limit the size of new segments to avoid growing the segment size
177 // All the while making sure to allocate a segment large enough to hold the
181 Segment* segment = NewSegment(new_size);
182 if (segment == NULL) {
187 // Recompute 'top' and 'limit' based on the new segment.
188 Address result = RoundUp(segment->start(), kAlignment);
190 limit_ = segment->end();