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

Side by Side Diff: third_party/tcmalloc/chromium/src/thread_cache.h

Issue 10035012: Added compile-time define to add "initial-exec" attribute. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made the comments better. Created 8 years, 7 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
« no previous file with comments | « no previous file | third_party/tcmalloc/chromium/src/thread_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // a thread is destroyed. 252 // a thread is destroyed.
253 // We also give a hint to the compiler to use the "initial exec" TLS 253 // We also give a hint to the compiler to use the "initial exec" TLS
254 // model. This is faster than the default TLS model, at the cost that 254 // model. This is faster than the default TLS model, at the cost that
255 // you cannot dlopen this library. (To see the difference, look at 255 // you cannot dlopen this library. (To see the difference, look at
256 // the CPU use of __tls_get_addr with and without this attribute.) 256 // the CPU use of __tls_get_addr with and without this attribute.)
257 // Since we don't really use dlopen in google code -- and using dlopen 257 // Since we don't really use dlopen in google code -- and using dlopen
258 // on a malloc replacement is asking for trouble in any case -- that's 258 // on a malloc replacement is asking for trouble in any case -- that's
259 // a good tradeoff for us. 259 // a good tradeoff for us.
260 #ifdef HAVE_TLS 260 #ifdef HAVE_TLS
261 static __thread ThreadCache* threadlocal_heap_ 261 static __thread ThreadCache* threadlocal_heap_
262 # ifdef HAVE___ATTRIBUTE__ 262 // See comments in the header file about this #define. Bug here:
gpike 2012/04/24 20:49:29 s/the header file/thread_cache.cc/ s/ #define//
asharif1 2012/04/24 21:02:34 Good catch. This is the header file. I will switch
263 // http://code.google.com/p/chromium/issues/detail?id=124489
264 #if defined(HAVE___ATTRIBUTE__) && !defined(PGO_GENERATE)
263 __attribute__ ((tls_model ("initial-exec"))) 265 __attribute__ ((tls_model ("initial-exec")))
264 # endif 266 # endif
265 ; 267 ;
266 #endif 268 #endif
267 269
268 // Thread-specific key. Initialization here is somewhat tricky 270 // Thread-specific key. Initialization here is somewhat tricky
269 // because some Linux startup code invokes malloc() before it 271 // because some Linux startup code invokes malloc() before it
270 // is in a good enough state to handle pthread_keycreate(). 272 // is in a good enough state to handle pthread_keycreate().
271 // Therefore, we use TSD keys only after tsd_inited is set to true. 273 // Therefore, we use TSD keys only after tsd_inited is set to true.
272 // Until then, we use a slow path to get the heap object. 274 // Until then, we use a slow path to get the heap object.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // because we may be in the thread destruction code and may have 414 // because we may be in the thread destruction code and may have
413 // already cleaned up the cache for this thread. 415 // already cleaned up the cache for this thread.
414 inline ThreadCache* ThreadCache::GetCacheIfPresent() { 416 inline ThreadCache* ThreadCache::GetCacheIfPresent() {
415 if (!tsd_inited_) return NULL; 417 if (!tsd_inited_) return NULL;
416 return GetThreadHeap(); 418 return GetThreadHeap();
417 } 419 }
418 420
419 } // namespace tcmalloc 421 } // namespace tcmalloc
420 422
421 #endif // TCMALLOC_THREAD_CACHE_H_ 423 #endif // TCMALLOC_THREAD_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | third_party/tcmalloc/chromium/src/thread_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698