OLD | NEW |
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 static __thread ThreadCache* threadlocal_heap_ | 261 static __thread ThreadCache* threadlocal_heap_ |
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 // |
| 272 // gcc has a problem with this tls model on arm. |
| 273 // See https://bugs.chromium.org/p/chromium/issues/detail?id=650137 |
| 274 #if defined(HAVE___ATTRIBUTE__) && !defined(PGO_GENERATE) && \ |
| 275 !(!defined(__clang__) && defined(OS_CHROMEOS) && defined(__arm__)) |
272 __attribute__ ((tls_model ("initial-exec"))) | 276 __attribute__ ((tls_model ("initial-exec"))) |
273 # endif | 277 # endif |
274 ; | 278 ; |
275 #endif | 279 #endif |
276 | 280 |
277 // Thread-specific key. Initialization here is somewhat tricky | 281 // Thread-specific key. Initialization here is somewhat tricky |
278 // because some Linux startup code invokes malloc() before it | 282 // because some Linux startup code invokes malloc() before it |
279 // is in a good enough state to handle pthread_keycreate(). | 283 // is in a good enough state to handle pthread_keycreate(). |
280 // Therefore, we use TSD keys only after tsd_inited is set to true. | 284 // 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. | 285 // Until then, we use a slow path to get the heap object. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // because we may be in the thread destruction code and may have | 425 // because we may be in the thread destruction code and may have |
422 // already cleaned up the cache for this thread. | 426 // already cleaned up the cache for this thread. |
423 inline ThreadCache* ThreadCache::GetCacheIfPresent() { | 427 inline ThreadCache* ThreadCache::GetCacheIfPresent() { |
424 if (!tsd_inited_) return NULL; | 428 if (!tsd_inited_) return NULL; |
425 return GetThreadHeap(); | 429 return GetThreadHeap(); |
426 } | 430 } |
427 | 431 |
428 } // namespace tcmalloc | 432 } // namespace tcmalloc |
429 | 433 |
430 #endif // TCMALLOC_THREAD_CACHE_H_ | 434 #endif // TCMALLOC_THREAD_CACHE_H_ |
OLD | NEW |