Lines Matching refs:before

120     auto before = avail_regions_by_base_.upper_bound(region.base);
121 auto after = before--;
125 if (before.IsValid()) {
126 before_end = before->base + before->size; // exclusive end
127 if ((region.base >= before->base) && (region_end <= before_end)) {
132 if ((region.base == before->base) && (region_end == before_end)) {
133 Region* removed = avail_regions_by_base_.erase(before);
142 // Case 2: before completely contains region. The before region needs
145 if ((region.base != before->base) && (region_end != before_end)) {
154 Region* first = avail_regions_by_size_.erase(*before);
165 // Case 3: region trims the front of before. Update before's base and
169 if (region.base == before->base) {
172 Region* bptr = avail_regions_by_size_.erase(*before);
180 // Case 4: region trims the end of before. Update before's size and
182 ZX_DEBUG_ASSERT(region.base != before->base);
185 Region* bptr = avail_regions_by_size_.erase(*before);
201 // of the region which comes before us, and then consume some of the regions
205 // considering the before region.
206 if (before.IsValid()) {
207 ZX_DEBUG_ASSERT(region.base >= before->base);
210 // No matter what, 'before' needs to be removed from the size index.
211 Region* bptr = avail_regions_by_size_.erase(*before);
213 // If before's base is the same as the region's base, then we are
214 // subtracting out all of before. Otherwise, we are trimming the back
215 // before and need to recompute its size and position in the size index.
226 // Either way, the region we are subtracting now starts where before
468 // If we only have to split before, then this region is not aligned
526 // Find the region which comes before us and the region which comes after us
528 auto before = avail_regions_by_base_.upper_bound(region->base);
529 auto after = before--;
531 // Merge with the region which comes before us if we can.
533 if (before.IsValid()) {
534 ZX_DEBUG_ASSERT(before->base <= region->base);
536 uint64_t before_end = (before->base + before->size); // exclusive end
539 region->base = before->base;
541 auto removed = avail_regions_by_base_.erase(before);
586 // Check the element before us in the tree. If it exists, we know that it's