Home | History | Annotate | Download | only in src

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_;
94 // Find a segment with a suitable size to keep around.
95 Segment* keep = NULL;
97 // and freeing every segment except the one we wish to keep.
98 for (Segment* current = segment_head_; current != NULL; ) {
99 Segment* next = current->next();
101 // Unlink the segment we wish to keep from the list.
107 // Zap the entire current segment (including the header).
115 // If we have found a segment we want to keep, we must recompute the
118 // force a new segment to be allocated on demand.
124 // Zap the contents of the kept segment (but not the header).
131 // Update the head segment to be the kept segment (if any).
146 // Zap the entire kept segment (including the header).
157 // Creates a new segment, sets it size, and pushes it to the front
158 // of the segment chain. Returns the new segment.
159 Segment* Zone::NewSegment(int size) {
160 Segment* result = reinterpret_cast<Segment*>(Malloced::New(size));
170 // Deletes the given segment. Does not touch the segment chain.
171 void Zone::DeleteSegment(Segment* segment, int size) {
173 Malloced::Delete(segment);
183 // Compute the new segment size. We use a 'high water mark'
184 // strategy, where we increase the segment size every time we expand
185 // except that we employ a maximum segment size when we delete. This
187 Segment* head = segment_head_;
189 static const size_t kSegmentOverhead = sizeof(Segment) + kAlignment;
202 // Limit the size of new segments to avoid growing the segment size
204 // All the while making sure to allocate a segment large enough to hold the
212 Segment* segment = NewSegment(static_cast<int>(new_size));
213 if (segment == NULL) {
218 // Recompute 'top' and 'limit' based on the new segment.
219 Address result = RoundUp(segment->start(), kAlignment);
222 // (Should not happen since the segment is guaranteed to accomodate
229 limit_ = segment->end();