Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: third_party/tcmalloc/chromium/src/memory_region_map.cc

Issue 9323026: [NOT TO COMMIT!] r109: Diff of the current tcmalloc from the original google-perftools r109. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2006, Google Inc. 1 /* Copyright (c) 2006, Google Inc.
2 * All rights reserved. 2 * All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 "to %"PRIuS" flags %d new_addr=0x%"PRIxPTR, 607 "to %"PRIuS" flags %d new_addr=0x%"PRIxPTR,
608 (uintptr_t)result, (uintptr_t)old_addr, 608 (uintptr_t)result, (uintptr_t)old_addr,
609 old_size, new_size, flags, 609 old_size, new_size, flags,
610 flags & MREMAP_FIXED ? (uintptr_t)new_addr : 0); 610 flags & MREMAP_FIXED ? (uintptr_t)new_addr : 0);
611 if (result != reinterpret_cast<void*>(-1)) { 611 if (result != reinterpret_cast<void*>(-1)) {
612 RecordRegionRemoval(old_addr, old_size); 612 RecordRegionRemoval(old_addr, old_size);
613 RecordRegionAddition(result, new_size); 613 RecordRegionAddition(result, new_size);
614 } 614 }
615 } 615 }
616 616
617 extern "C" void* __sbrk(ptrdiff_t increment); // defined in libc 617 extern "C" void* __sbrk(std::ptrdiff_t increment); // defined in libc
618 618
619 void MemoryRegionMap::SbrkHook(const void* result, ptrdiff_t increment) { 619 void MemoryRegionMap::SbrkHook(const void* result, std::ptrdiff_t increment) {
620 RAW_VLOG(10, "Sbrk = 0x%"PRIxPTR" of %"PRIdS"", (uintptr_t)result, increment); 620 RAW_VLOG(10, "Sbrk = 0x%"PRIxPTR" of %"PRIdS"", (uintptr_t)result, increment);
621 if (result != reinterpret_cast<void*>(-1)) { 621 if (result != reinterpret_cast<void*>(-1)) {
622 if (increment > 0) { 622 if (increment > 0) {
623 void* new_end = sbrk(0); 623 void* new_end = sbrk(0);
624 RecordRegionAddition(result, reinterpret_cast<uintptr_t>(new_end) - 624 RecordRegionAddition(result, reinterpret_cast<uintptr_t>(new_end) -
625 reinterpret_cast<uintptr_t>(result)); 625 reinterpret_cast<uintptr_t>(result));
626 } else if (increment < 0) { 626 } else if (increment < 0) {
627 void* new_end = sbrk(0); 627 void* new_end = sbrk(0);
628 RecordRegionRemoval(new_end, reinterpret_cast<uintptr_t>(result) - 628 RecordRegionRemoval(new_end, reinterpret_cast<uintptr_t>(result) -
629 reinterpret_cast<uintptr_t>(new_end)); 629 reinterpret_cast<uintptr_t>(new_end));
630 } 630 }
631 } 631 }
632 } 632 }
633 633
634 void MemoryRegionMap::LogAllLocked() { 634 void MemoryRegionMap::LogAllLocked() {
635 RAW_CHECK(LockIsHeld(), "should be held (by this thread)"); 635 RAW_CHECK(LockIsHeld(), "should be held (by this thread)");
636 RAW_LOG(INFO, "List of regions:"); 636 RAW_LOG(INFO, "List of regions:");
637 uintptr_t previous = 0; 637 uintptr_t previous = 0;
638 for (RegionSet::const_iterator r = regions_->begin(); 638 for (RegionSet::const_iterator r = regions_->begin();
639 r != regions_->end(); ++r) { 639 r != regions_->end(); ++r) {
640 RAW_LOG(INFO, "Memory region 0x%"PRIxPTR"..0x%"PRIxPTR" " 640 RAW_LOG(INFO, "Memory region 0x%"PRIxPTR"..0x%"PRIxPTR" "
641 "from 0x%"PRIxPTR" stack=%d", 641 "from 0x%"PRIxPTR" stack=%d",
642 r->start_addr, r->end_addr, r->caller(), r->is_stack); 642 r->start_addr, r->end_addr, r->caller(), r->is_stack);
643 RAW_CHECK(previous < r->end_addr, "wow, we messed up the set order"); 643 RAW_CHECK(previous < r->end_addr, "wow, we messed up the set order");
644 // this must be caused by uncontrolled recursive operations on regions_ 644 // this must be caused by uncontrolled recursive operations on regions_
645 previous = r->end_addr; 645 previous = r->end_addr;
646 } 646 }
647 RAW_LOG(INFO, "End of regions list"); 647 RAW_LOG(INFO, "End of regions list");
648 } 648 }
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/memory_region_map.h ('k') | third_party/tcmalloc/chromium/src/packed-cache-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698