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

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: code style fixes 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..48afd9fa444db857efe1a3613bed3d11cfc01f32 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,15 +31,18 @@
// Author: Sanjay Ghemawat <opensource@google.com>
//
// Common definitions for tcmalloc code.
-
+
jar (doing other things) 2011/08/20 02:40:30 nit: remove trailing whitespace.
bxx 2011/08/24 00:19:24 Done.
#ifndef TCMALLOC_COMMON_H_
#define TCMALLOC_COMMON_H_
#include "config.h"
+
jar (doing other things) 2011/08/20 02:40:30 nit: remove extra newline.
bxx 2011/08/24 00:19:24 Done.
#include <stddef.h> // for size_t
#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 +178,8 @@ 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;
+ return (size_class < MIN_SIZE_CLASS) ? MIN_SIZE_CLASS : size_class;
jar (doing other things) 2011/08/20 02:40:30 I assume this was added to preclude 8 byte allocat
bxx 2011/08/24 00:19:24 Done.
}
int NumMoveSize(size_t size);

Powered by Google App Engine
This is Rietveld 408576698