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

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

Issue 9311003: Update the tcmalloc chromium branch to r144 (gperftools 2.0), and merge chromium-specific changes. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebasec 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) 2011, Google Inc. 1 // Copyright (c) 2011, 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // the former head's |next| pointer. If the list is doubly linked, the 57 // the former head's |next| pointer. If the list is doubly linked, the
58 // new head |previous| pointer gets changed from pointing to the former 58 // new head |previous| pointer gets changed from pointing to the former
59 // head to NULL. 59 // head to NULL.
60 60
61 61
62 #include <stddef.h> 62 #include <stddef.h>
63 #include "free_list.h" 63 #include "free_list.h"
64 64
65 #if defined(TCMALLOC_USE_DOUBLYLINKED_FREELIST) 65 #if defined(TCMALLOC_USE_DOUBLYLINKED_FREELIST)
66 66
67 using tcmalloc::kCrash;
68
67 // TODO(jar): We should use C++ rather than a macro here. 69 // TODO(jar): We should use C++ rather than a macro here.
68 #define MEMORY_CHECK(v1, v2) \ 70 #define MEMORY_CHECK(v1, v2) \
69 if (v1 != v2) CRASH("Memory corruption detected.\n") 71 if (v1 != v2) Log(kCrash, __FILE__, __LINE__, "Memory corruption detected.\n")
70 72
71 namespace { 73 namespace {
72 void EnsureNonLoop(void* node, void* next) { 74 void EnsureNonLoop(void* node, void* next) {
73 // We only have time to do minimal checking. We don't traverse the list, but 75 // We only have time to do minimal checking. We don't traverse the list, but
74 // only look for an immediate loop (cycle back to ourself). 76 // only look for an immediate loop (cycle back to ourself).
75 if (node != next) return; 77 if (node != next) return;
76 CRASH("Circular loop in list detected: %p\n", next); 78 Log(kCrash, __FILE__, __LINE__, "Circular loop in list detected: %p\n", next);
77 } 79 }
78 80
79 // Returns value of the |previous| pointer w/out running a sanity 81 // Returns value of the |previous| pointer w/out running a sanity
80 // check. 82 // check.
81 inline void *FL_Previous_No_Check(void *t) { 83 inline void *FL_Previous_No_Check(void *t) {
82 return reinterpret_cast<void**>(t)[1]; 84 return reinterpret_cast<void**>(t)[1];
83 } 85 }
84 86
85 // Returns value of the |next| pointer w/out running a sanity check. 87 // Returns value of the |next| pointer w/out running a sanity check.
86 inline void *FL_Next_No_Check(void *t) { 88 inline void *FL_Next_No_Check(void *t) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 222
221 namespace { 223 namespace {
222 224
223 inline void FL_SetNext(void *t, void *n) { 225 inline void FL_SetNext(void *t, void *n) {
224 tcmalloc::SLL_SetNext(t,n); 226 tcmalloc::SLL_SetNext(t,n);
225 } 227 }
226 228
227 } 229 }
228 230
229 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST 231 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/free_list.h ('k') | third_party/tcmalloc/chromium/src/google/heap-checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698