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

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

Issue 7671034: doubly-linked free-lists for thread caches and page heaps (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix macros and size class checks Created 9 years, 4 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
Index: third_party/tcmalloc/chromium/src/common.h
diff --git a/third_party/tcmalloc/chromium/src/common.h b/third_party/tcmalloc/chromium/src/common.h
index a3df8de02fd0056b750e096d0d74eb5477cde6bb..5ba3883057cab48310691616d3c45e045a2b430d 100644
--- a/third_party/tcmalloc/chromium/src/common.h
+++ b/third_party/tcmalloc/chromium/src/common.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2008, Google Inc.
+// Copyright (c) 2011, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,6 @@
// Author: Sanjay Ghemawat <opensource@google.com>
//
// Common definitions for tcmalloc code.
-
#ifndef TCMALLOC_COMMON_H_
#define TCMALLOC_COMMON_H_
@@ -40,6 +39,7 @@
#ifdef HAVE_STDINT_H
#include <stdint.h> // for uintptr_t, uint64_t
#endif
+#include "free_list.h" // for SIZE_CLASS macros
#include "internal_logging.h" // for ASSERT, etc
// Type that can hold a page number
@@ -175,7 +175,11 @@ class SizeMap {
const bool big = (s > kMaxSmallSize);
const int add_amount = big ? (127 + (120<<7)) : 7;
const int shift_amount = big ? 7 : 3;
- return (s + add_amount) >> shift_amount;
+ const int size_class = (s + add_amount) >> shift_amount;
+ if (HAS_64_BIT_POINTERS && s > 0 &&
+ size_class < FIRST_NON_0_SIZE_CLASS)
+ return FIRST_NON_0_SIZE_CLASS;
jar (doing other things) 2011/08/26 18:56:29 I haven't measured it... but I've been told that c
bxx 2011/08/26 21:45:10 Done.
+ return size_class;
}
int NumMoveSize(size_t size);

Powered by Google App Engine
This is Rietveld 408576698