| Index: third_party/tcmalloc/chromium/src/memory_region_map.cc
|
| diff --git a/third_party/tcmalloc/chromium/src/memory_region_map.cc b/third_party/tcmalloc/chromium/src/memory_region_map.cc
|
| index dcc73c4ac6dc0307c38b1f094f426dfdf7c434a5..a94c964ae90913ea00905dbcae5dcbc56ada8628 100644
|
| --- a/third_party/tcmalloc/chromium/src/memory_region_map.cc
|
| +++ b/third_party/tcmalloc/chromium/src/memory_region_map.cc
|
| @@ -231,6 +231,8 @@ void MemoryRegionMap::Init(int max_stack_depth, bool use_buckets) {
|
| memset(bucket_table_, 0, table_bytes);
|
| num_buckets_ = 0;
|
| }
|
| + if (regions_ == NULL) // init regions_
|
| + InitRegionSetLocked();
|
| Unlock();
|
| RAW_VLOG(10, "MemoryRegionMap Init done");
|
| }
|
| @@ -533,6 +535,15 @@ void MemoryRegionMap::RestoreSavedBucketsLocked() {
|
| }
|
| }
|
|
|
| +inline void MemoryRegionMap::InitRegionSetLocked() {
|
| + RAW_VLOG(12, "Initializing region set");
|
| + regions_ = regions_rep.region_set();
|
| + recursive_insert = true;
|
| + new(regions_) RegionSet();
|
| + HandleSavedRegionsLocked(&DoInsertRegionLocked);
|
| + recursive_insert = false;
|
| +}
|
| +
|
| inline void MemoryRegionMap::InsertRegionLocked(const Region& region) {
|
| RAW_CHECK(LockIsHeld(), "should be held (by this thread)");
|
| // We can be called recursively, because RegionSet constructor
|
| @@ -552,14 +563,8 @@ inline void MemoryRegionMap::InsertRegionLocked(const Region& region) {
|
| // then increment saved_regions_count.
|
| saved_regions[saved_regions_count++] = region;
|
| } else { // not a recusrive call
|
| - if (regions_ == NULL) { // init regions_
|
| - RAW_VLOG(12, "Initializing region set");
|
| - regions_ = regions_rep.region_set();
|
| - recursive_insert = true;
|
| - new(regions_) RegionSet();
|
| - HandleSavedRegionsLocked(&DoInsertRegionLocked);
|
| - recursive_insert = false;
|
| - }
|
| + if (regions_ == NULL) // init regions_
|
| + InitRegionSetLocked();
|
| recursive_insert = true;
|
| // Do the actual insertion work to put new regions into regions_:
|
| DoInsertRegionLocked(region);
|
|
|