Avoid unnecessary calls to vm_region_recurse

Summary: This should significantly improve darwin lsan performance in cases where root regions are not used.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D32966

llvm-svn: 302530
This commit is contained in:
Francis Ricci 2017-05-09 14:10:30 +00:00
parent 31b37297de
commit 0f3d30960e

View File

@ -144,6 +144,11 @@ void ProcessPlatformSpecificAllocations(Frontier *frontier) {
if (info.user_tag == VM_MEMORY_OS_ALLOC_ONCE) {
ScanRangeForPointers(address, end_address, frontier, "GLOBAL",
kReachable);
// Recursing over the full memory map is very slow, break out
// early if we don't need the full iteration.
if (!flags()->use_root_regions || !root_regions->size())
break;
}
// This additional root region scan is required on Darwin in order to