Lines Matching refs:region

196   // Make sure we don't overflow the memory in region stacks:
340 RegionSet::iterator region = regions_->lower_bound(sample);
341 if (region != regions_->end()) {
342 RAW_CHECK(addr <= region->end_addr, "");
343 if (region->start_addr <= addr && addr < region->end_addr) {
344 return &(*region);
353 const Region* region = DoFindRegionLocked(addr);
354 if (region != NULL) *result = *region; // create it as an independent copy
356 return region != NULL;
362 const Region* region = DoFindRegionLocked(stack_top);
363 if (region != NULL) {
364 RAW_VLOG(10, "Stack at %p is inside region %p..%p",
366 reinterpret_cast<void*>(region->start_addr),
367 reinterpret_cast<void*>(region->end_addr));
368 const_cast<Region*>(region)->set_is_stack(); // now we know
370 *result = *region; // create *result as an independent copy
373 return region != NULL;
444 inline void MemoryRegionMap::DoInsertRegionLocked(const Region& region) {
445 RAW_VLOG(12, "Inserting region %p..%p from %p",
446 reinterpret_cast<void*>(region.start_addr),
447 reinterpret_cast<void*>(region.end_addr),
448 reinterpret_cast<void*>(region.caller()));
449 RegionSet::const_iterator i = regions_->lower_bound(region);
450 if (i != regions_->end() && i->start_addr <= region.start_addr) {
451 RAW_DCHECK(region.end_addr <= i->end_addr, ""); // lower_bound ensures this
452 return; // 'region' is a subset of an already recorded region; do nothing
457 RAW_CHECK(i == regions_->end() || !region.Overlaps(*i),
460 sample.SetRegionSetKey(region.start_addr);
462 RAW_CHECK(i == regions_->end() || !region.Overlaps(*i),
465 region.AssertIsConsistent(); // just making sure
466 // This inserts and allocates permanent storage for region
468 regions_->insert(region);
469 RAW_VLOG(12, "Inserted region %p..%p :",
470 reinterpret_cast<void*>(region.start_addr),
471 reinterpret_cast<void*>(region.end_addr));
479 // Number of unprocessed region inserts.
489 void (*insert_func)(const Region& region)) {
491 // Making a local-var copy of the region argument to insert_func
539 RAW_VLOG(12, "Initializing region set");
547 inline void MemoryRegionMap::InsertRegionLocked(const Region& region) {
552 // region insertion information is recorded in saved_regions[],
556 RAW_VLOG(12, "Saving recursive insert of region %p..%p from %p",
557 reinterpret_cast<void*>(region.start_addr),
558 reinterpret_cast<void*>(region.end_addr),
559 reinterpret_cast<void*>(region.caller()));
561 // Copy 'region' to saved_regions[saved_regions_count]
564 saved_regions[saved_regions_count++] = region;
570 DoInsertRegionLocked(region);
585 // Record start/end info about this memory acquisition call in a new region:
586 Region region;
587 region.Create(start, size);
588 // First get the call stack info into the local varible 'region':
591 ? MallocHook::GetCallerStackTrace(const_cast<void**>(region.call_stack),
594 region.set_call_stack_depth(depth); // record stack info fully
595 RAW_VLOG(10, "New global region %p..%p from %p",
596 reinterpret_cast<void*>(region.start_addr),
597 reinterpret_cast<void*>(region.end_addr),
598 reinterpret_cast<void*>(region.caller()));
602 InsertRegionLocked(region);
604 // from region.call_stack_data_ that is pointed by region.call_stack().
606 HeapProfileBucket* b = GetBucket(depth, region.call_stack);
621 // First remove the removed region from saved_regions, if it's
636 RAW_VLOG(10, ("Insta-Removing saved region %p..%p; "
660 RAW_VLOG(10, "Removing global region %p..%p; have %" PRIuS " regions",
667 for (RegionSet::iterator region = regions_->lower_bound(sample);
668 region != regions_->end() && region->start_addr < end_addr;
670 RAW_VLOG(13, "Looking at region %p..%p",
671 reinterpret_cast<void*>(region->start_addr),
672 reinterpret_cast<void*>(region->end_addr));
673 if (start_addr <= region->start_addr &&
674 region->end_addr <= end_addr) { // full deletion
675 RAW_VLOG(12, "Deleting region %p..%p",
676 reinterpret_cast<void*>(region->start_addr),
677 reinterpret_cast<void*>(region->end_addr));
678 RecordRegionRemovalInBucket(region->call_stack_depth, region->call_stack,
679 region->end_addr - region->start_addr);
680 RegionSet::iterator d = region;
681 ++region;
684 } else if (region->start_addr < start_addr &&
685 end_addr < region->end_addr) { // cutting-out split
686 RAW_VLOG(12, "Splitting region %p..%p in two",
687 reinterpret_cast<void*>(region->start_addr),
688 reinterpret_cast<void*>(region->end_addr));
689 RecordRegionRemovalInBucket(region->call_stack_depth, region->call_stack,
691 // Make another region for the start portion:
692 // The new region has to be the start portion because we can't
693 // just modify region->end_addr as it's the sorting key.
694 Region r = *region;
697 // cut *region from start:
698 const_cast<Region&>(*region).set_start_addr(end_addr);
699 } else if (end_addr > region->start_addr &&
700 start_addr <= region->start_addr) { // cut from start
701 RAW_VLOG(12, "Start-chopping region %p..%p",
702 reinterpret_cast<void*>(region->start_addr),
703 reinterpret_cast<void*>(region->end_addr));
704 RecordRegionRemovalInBucket(region->call_stack_depth, region->call_stack,
705 end_addr - region->start_addr);
706 const_cast<Region&>(*region).set_start_addr(end_addr);
707 } else if (start_addr > region->start_addr &&
708 start_addr < region->end_addr) { // cut from end
709 RAW_VLOG(12, "End-chopping region %p..%p",
710 reinterpret_cast<void*>(region->start_addr),
711 reinterpret_cast<void*>(region->end_addr));
712 RecordRegionRemovalInBucket(region->call_stack_depth, region->call_stack,
713 region->end_addr - start_addr);
714 // Can't just modify region->end_addr (it's the sorting key):
715 Region r = *region;
717 RegionSet::iterator d = region;
718 ++region;
725 ++region;
727 RAW_VLOG(12, "Removed region %p..%p; have %" PRIuS " regions",
808 RAW_LOG(INFO, "Memory region 0x%" PRIxPTR "..0x%" PRIxPTR " "