Lines Matching defs:segment
39 // chained together forming a LIFO structure with the newest segment
43 class Segment {
45 void Initialize(Segment* next, int size) {
50 Segment* next() const { return next_; }
54 int capacity() const { return size_ - sizeof(Segment); }
56 Address start() const { return address(sizeof(Segment)); }
60 // Computes the address of the nth byte in this segment.
65 Segment* next_;
87 // Creates a new segment, sets it size, and pushes it to the front
88 // of the segment chain. Returns the new segment.
89 Segment* Zone::NewSegment(int size) {
90 Segment* result = reinterpret_cast<Segment*>(Malloced::New(size));
100 // Deletes the given segment. Does not touch the segment chain.
101 void Zone::DeleteSegment(Segment* segment, int size) {
103 Malloced::Delete(segment);
113 // Find a segment with a suitable size to keep around.
114 Segment* keep = segment_head_;
120 // and freeing every segment except the one we wish to keep.
121 Segment* current = segment_head_;
123 Segment* next = current->next();
125 // Unlink the segment we wish to keep from the list.
130 // Zap the entire current segment (including the header).
138 // If we have found a segment we want to keep, we must recompute the
141 // force a new segment to be allocated on demand.
147 // Zap the contents of the kept segment (but not the header).
154 // Update the head segment to be the kept segment (if any).
173 // Compute the new segment size. We use a 'high water mark'
174 // strategy, where we increase the segment size every time we expand
175 // except that we employ a maximum segment size when we delete. This
177 Segment* head = segment_head_;
179 static const int kSegmentOverhead = sizeof(Segment) + kAlignment;
190 // Limit the size of new segments to avoid growing the segment size
192 // All the while making sure to allocate a segment large enough to hold the
196 Segment* segment = NewSegment(new_size);
197 if (segment == NULL) {
202 // Recompute 'top' and 'limit' based on the new segment.
203 Address result = RoundUp(segment->start(), kAlignment);
210 limit_ = segment->end();