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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 volatile size_t ThreadCache::per_thread_cache_size_ = kMaxThreadCacheSize; | 58 volatile size_t ThreadCache::per_thread_cache_size_ = kMaxThreadCacheSize; |
59 size_t ThreadCache::overall_thread_cache_size_ = kDefaultOverallThreadCacheSize; | 59 size_t ThreadCache::overall_thread_cache_size_ = kDefaultOverallThreadCacheSize; |
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 # ifdef HAVE___ATTRIBUTE__ | 67 // See comments in thread_cache.h about this. Bug here: |
| 68 // http://code.google.com/p/chromium/issues/detail?id=124489 |
| 69 #if defined(HAVE___ATTRIBUTE__) && !defined(PGO_GENERATE) |
68 __attribute__ ((tls_model ("initial-exec"))) | 70 __attribute__ ((tls_model ("initial-exec"))) |
69 # endif | 71 # endif |
70 ; | 72 ; |
71 #endif | 73 #endif |
72 bool ThreadCache::tsd_inited_ = false; | 74 bool ThreadCache::tsd_inited_ = false; |
73 pthread_key_t ThreadCache::heap_key_; | 75 pthread_key_t ThreadCache::heap_key_; |
74 | 76 |
75 #if defined(HAVE_TLS) | 77 #if defined(HAVE_TLS) |
76 bool kernel_supports_tls = false; // be conservative | 78 bool kernel_supports_tls = false; // be conservative |
77 # if defined(_WIN32) // windows has supported TLS since winnt, I think. | 79 # if defined(_WIN32) // windows has supported TLS since winnt, I think. |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 void ThreadCache::set_overall_thread_cache_size(size_t new_size) { | 505 void ThreadCache::set_overall_thread_cache_size(size_t new_size) { |
504 // Clip the value to a reasonable range | 506 // Clip the value to a reasonable range |
505 if (new_size < kMinThreadCacheSize) new_size = kMinThreadCacheSize; | 507 if (new_size < kMinThreadCacheSize) new_size = kMinThreadCacheSize; |
506 if (new_size > (1<<30)) new_size = (1<<30); // Limit to 1GB | 508 if (new_size > (1<<30)) new_size = (1<<30); // Limit to 1GB |
507 overall_thread_cache_size_ = new_size; | 509 overall_thread_cache_size_ = new_size; |
508 | 510 |
509 RecomputePerThreadCacheSize(); | 511 RecomputePerThreadCacheSize(); |
510 } | 512 } |
511 | 513 |
512 } // namespace tcmalloc | 514 } // namespace tcmalloc |
OLD | NEW |