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

Unified Diff: third_party/tcmalloc/chromium/src/page_heap_allocator.h

Issue 9320005: [NOT TO COMMIT!] Replace third_party/tcmalloc/chromium with tcmalloc r136 (the latest). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tcmalloc/chromium/src/page_heap.cc ('k') | third_party/tcmalloc/chromium/src/pagemap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/page_heap_allocator.h
diff --git a/third_party/tcmalloc/chromium/src/page_heap_allocator.h b/third_party/tcmalloc/chromium/src/page_heap_allocator.h
index eee1590323511ec0ae312c6ad256f60fe16a493e..d83528203f1a0ff935d72547753fe3f5f344102e 100644
--- a/third_party/tcmalloc/chromium/src/page_heap_allocator.h
+++ b/third_party/tcmalloc/chromium/src/page_heap_allocator.h
@@ -36,9 +36,7 @@
#include <stddef.h> // for NULL, size_t
#include "common.h" // for MetaDataAlloc
-#include "free_list.h" // for FL_Push/FL_Pop
-#include "internal_logging.h" // for ASSERT, CRASH
-#include "system-alloc.h" // for TCMalloc_SystemAddGuard
+#include "internal_logging.h" // for ASSERT
namespace tcmalloc {
@@ -64,31 +62,20 @@ class PageHeapAllocator {
// Consult free list
void* result;
if (free_list_ != NULL) {
- result = FL_Pop(&free_list_);
+ result = free_list_;
+ free_list_ = *(reinterpret_cast<void**>(result));
} else {
if (free_avail_ < sizeof(T)) {
// Need more room. We assume that MetaDataAlloc returns
// suitably aligned memory.
free_area_ = reinterpret_cast<char*>(MetaDataAlloc(kAllocIncrement));
if (free_area_ == NULL) {
- CRASH("FATAL ERROR: Out of memory trying to allocate internal "
- "tcmalloc data (%d bytes, object-size %d)\n",
- kAllocIncrement, static_cast<int>(sizeof(T)));
- }
-
- // This guard page protects the metadata from being corrupted by a
- // buffer overrun. We currently have no mechanism for freeing it, since
- // we never release the metadata buffer. If that changes we'll need to
- // add something like TCMalloc_SystemRemoveGuard.
- size_t guard_size = TCMalloc_SystemAddGuard(free_area_,
- kAllocIncrement);
- free_area_ += guard_size;
- free_avail_ = kAllocIncrement - guard_size;
- if (free_avail_ < sizeof(T)) {
- CRASH("FATAL ERROR: Insufficient memory to guard internal tcmalloc "
- "data (%d bytes, object-size %d, guard-size %d)\n",
- kAllocIncrement, static_cast<int>(sizeof(T)), guard_size);
+ Log(kCrash, __FILE__, __LINE__,
+ "FATAL ERROR: Out of memory trying to allocate internal "
+ "tcmalloc data (bytes, object-size)",
+ kAllocIncrement, sizeof(T));
}
+ free_avail_ = kAllocIncrement;
}
result = free_area_;
free_area_ += sizeof(T);
@@ -99,7 +86,8 @@ class PageHeapAllocator {
}
void Delete(T* p) {
- FL_Push(&free_list_, p);
+ *(reinterpret_cast<void**>(p)) = free_list_;
+ free_list_ = p;
inuse_--;
}
« no previous file with comments | « third_party/tcmalloc/chromium/src/page_heap.cc ('k') | third_party/tcmalloc/chromium/src/pagemap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698