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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 ssize_t ThreadCache::unclaimed_cache_space_ = kDefaultOverallThreadCacheSize; | 60 ssize_t ThreadCache::unclaimed_cache_space_ = kDefaultOverallThreadCacheSize; |
61 PageHeapAllocator<ThreadCache> threadcache_allocator; | 61 PageHeapAllocator<ThreadCache> threadcache_allocator; |
62 ThreadCache* ThreadCache::thread_heaps_ = NULL; | 62 ThreadCache* ThreadCache::thread_heaps_ = NULL; |
63 int ThreadCache::thread_heap_count_ = 0; | 63 int ThreadCache::thread_heap_count_ = 0; |
64 ThreadCache* ThreadCache::next_memory_steal_ = NULL; | 64 ThreadCache* ThreadCache::next_memory_steal_ = NULL; |
65 #ifdef HAVE_TLS | 65 #ifdef HAVE_TLS |
66 __thread ThreadCache* ThreadCache::threadlocal_heap_ | 66 __thread ThreadCache* ThreadCache::threadlocal_heap_ |
67 // See comments in thread_cache.h about this. Bug here: | 67 // See comments in thread_cache.h about this. Bug here: |
68 // http://code.google.com/p/chromium/issues/detail?id=124489 | 68 // http://code.google.com/p/chromium/issues/detail?id=124489 |
69 #if defined(HAVE___ATTRIBUTE__) && !defined(PGO_GENERATE) | 69 #if defined(HAVE___ATTRIBUTE__) && !defined(PGO_GENERATE) |
| 70 // If we are not using component build, we can further optimize it. |
| 71 #if !defined(COMPONENT_BUILD) |
| 72 __attribute__ ((tls_model ("local-exec"))) |
| 73 #else |
70 __attribute__ ((tls_model ("initial-exec"))) | 74 __attribute__ ((tls_model ("initial-exec"))) |
| 75 #endif |
71 # endif | 76 # endif |
72 ; | 77 ; |
73 #endif | 78 #endif |
74 bool ThreadCache::tsd_inited_ = false; | 79 bool ThreadCache::tsd_inited_ = false; |
75 pthread_key_t ThreadCache::heap_key_; | 80 pthread_key_t ThreadCache::heap_key_; |
76 | 81 |
77 #if defined(HAVE_TLS) | 82 #if defined(HAVE_TLS) |
78 bool kernel_supports_tls = false; // be conservative | 83 bool kernel_supports_tls = false; // be conservative |
79 # if defined(_WIN32) // windows has supported TLS since winnt, I think. | 84 # if defined(_WIN32) // windows has supported TLS since winnt, I think. |
80 void CheckIfKernelSupportsTLS() { | 85 void CheckIfKernelSupportsTLS() { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 void ThreadCache::set_overall_thread_cache_size(size_t new_size) { | 510 void ThreadCache::set_overall_thread_cache_size(size_t new_size) { |
506 // Clip the value to a reasonable range | 511 // Clip the value to a reasonable range |
507 if (new_size < kMinThreadCacheSize) new_size = kMinThreadCacheSize; | 512 if (new_size < kMinThreadCacheSize) new_size = kMinThreadCacheSize; |
508 if (new_size > (1<<30)) new_size = (1<<30); // Limit to 1GB | 513 if (new_size > (1<<30)) new_size = (1<<30); // Limit to 1GB |
509 overall_thread_cache_size_ = new_size; | 514 overall_thread_cache_size_ = new_size; |
510 | 515 |
511 RecomputePerThreadCacheSize(); | 516 RecomputePerThreadCacheSize(); |
512 } | 517 } |
513 | 518 |
514 } // namespace tcmalloc | 519 } // namespace tcmalloc |
OLD | NEW |