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

Side by Side Diff: third_party/tcmalloc/vendor/src/central_freelist.cc

Issue 9701040: Revert 126715 - Update the tcmalloc vendor branch to r144 (gperftools 2.0). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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) 2008, Google Inc. 1 // Copyright (c) 2008, 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 lock_.Unlock(); 312 lock_.Unlock();
313 const size_t npages = Static::sizemap()->class_to_pages(size_class_); 313 const size_t npages = Static::sizemap()->class_to_pages(size_class_);
314 314
315 Span* span; 315 Span* span;
316 { 316 {
317 SpinLockHolder h(Static::pageheap_lock()); 317 SpinLockHolder h(Static::pageheap_lock());
318 span = Static::pageheap()->New(npages); 318 span = Static::pageheap()->New(npages);
319 if (span) Static::pageheap()->RegisterSizeClass(span, size_class_); 319 if (span) Static::pageheap()->RegisterSizeClass(span, size_class_);
320 } 320 }
321 if (span == NULL) { 321 if (span == NULL) {
322 Log(kLog, __FILE__, __LINE__, 322 MESSAGE("tcmalloc: allocation failed", npages << kPageShift);
323 "tcmalloc: allocation failed", npages << kPageShift);
324 lock_.Lock(); 323 lock_.Lock();
325 return; 324 return;
326 } 325 }
327 ASSERT(span->length == npages); 326 ASSERT(span->length == npages);
328 // Cache sizeclass info eagerly. Locking is not necessary. 327 // Cache sizeclass info eagerly. Locking is not necessary.
329 // (Instead of being eager, we could just replace any stale info 328 // (Instead of being eager, we could just replace any stale info
330 // about this span, but that seems to be no better in practice.) 329 // about this span, but that seems to be no better in practice.)
331 for (int i = 0; i < npages; i++) { 330 for (int i = 0; i < npages; i++) {
332 Static::pageheap()->CacheSizeClass(span->start + i, size_class_); 331 Static::pageheap()->CacheSizeClass(span->start + i, size_class_);
333 } 332 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 return 0; 366 return 0;
368 } 367 }
369 const size_t pages_per_span = Static::sizemap()->class_to_pages(size_class_); 368 const size_t pages_per_span = Static::sizemap()->class_to_pages(size_class_);
370 const size_t object_size = Static::sizemap()->class_to_size(size_class_); 369 const size_t object_size = Static::sizemap()->class_to_size(size_class_);
371 ASSERT(object_size > 0); 370 ASSERT(object_size > 0);
372 const size_t overhead_per_span = (pages_per_span * kPageSize) % object_size; 371 const size_t overhead_per_span = (pages_per_span * kPageSize) % object_size;
373 return num_spans_ * overhead_per_span; 372 return num_spans_ * overhead_per_span;
374 } 373 }
375 374
376 } // namespace tcmalloc 375 } // namespace tcmalloc
OLDNEW
« no previous file with comments | « third_party/tcmalloc/vendor/src/central_freelist.h ('k') | third_party/tcmalloc/vendor/src/common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698