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

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

Issue 2363283002: Use 'local-exec' for threadlocal_heap_ in tcmalloc. (Closed)
Patch Set: Try static_library for cast_graphics Created 3 years, 11 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 | « third_party/tcmalloc/README.chromium ('k') | 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // This code links against pyautolib.so, which causes dlopen() on that shared 262 // This code links against pyautolib.so, which causes dlopen() on that shared
263 // object to fail when -fprofile-generate is used with it. Ideally 263 // object to fail when -fprofile-generate is used with it. Ideally
264 // pyautolib.so should not link against this code. There is a bug filed for 264 // pyautolib.so should not link against this code. There is a bug filed for
265 // that: 265 // that:
266 // http://code.google.com/p/chromium/issues/detail?id=124489 266 // http://code.google.com/p/chromium/issues/detail?id=124489
267 // For now the workaround is to pass in -DPGO_GENERATE when building Chrome 267 // For now the workaround is to pass in -DPGO_GENERATE when building Chrome
268 // for instrumentation (-fprofile-generate). 268 // for instrumentation (-fprofile-generate).
269 // For all non-instrumentation builds, this define will not be set and the 269 // For all non-instrumentation builds, this define will not be set and the
270 // performance benefit of "intial-exec" will be achieved. 270 // performance benefit of "intial-exec" will be achieved.
271 #if defined(HAVE___ATTRIBUTE__) && !defined(PGO_GENERATE) 271 #if defined(HAVE___ATTRIBUTE__) && !defined(PGO_GENERATE)
272 // If we are not using component build, we can further optimize it.
273 #if !defined(COMPONENT_BUILD)
274 __attribute__ ((tls_model ("local-exec")))
275 #else
272 __attribute__ ((tls_model ("initial-exec"))) 276 __attribute__ ((tls_model ("initial-exec")))
277 #endif
273 # endif 278 # endif
274 ; 279 ;
275 #endif 280 #endif
276 281
277 // Thread-specific key. Initialization here is somewhat tricky 282 // Thread-specific key. Initialization here is somewhat tricky
278 // because some Linux startup code invokes malloc() before it 283 // because some Linux startup code invokes malloc() before it
279 // is in a good enough state to handle pthread_keycreate(). 284 // is in a good enough state to handle pthread_keycreate().
280 // Therefore, we use TSD keys only after tsd_inited is set to true. 285 // Therefore, we use TSD keys only after tsd_inited is set to true.
281 // Until then, we use a slow path to get the heap object. 286 // Until then, we use a slow path to get the heap object.
282 static bool tsd_inited_; 287 static bool tsd_inited_;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // because we may be in the thread destruction code and may have 426 // because we may be in the thread destruction code and may have
422 // already cleaned up the cache for this thread. 427 // already cleaned up the cache for this thread.
423 inline ThreadCache* ThreadCache::GetCacheIfPresent() { 428 inline ThreadCache* ThreadCache::GetCacheIfPresent() {
424 if (!tsd_inited_) return NULL; 429 if (!tsd_inited_) return NULL;
425 return GetThreadHeap(); 430 return GetThreadHeap();
426 } 431 }
427 432
428 } // namespace tcmalloc 433 } // namespace tcmalloc
429 434
430 #endif // TCMALLOC_THREAD_CACHE_H_ 435 #endif // TCMALLOC_THREAD_CACHE_H_
OLDNEW
« no previous file with comments | « third_party/tcmalloc/README.chromium ('k') | third_party/tcmalloc/chromium/src/thread_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698