Chromium Code Reviews| 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 // This code links against pyautolib.so which causes it to fail when dlopen()'d. |
| 68 // This is a workaround for that. By passing in -DPGO_GENERATE, we can disable | |
| 69 // the "initial-exec" variable attribute. | |
| 70 #if defined(HAVE___ATTRIBUTE__) && ! defined(PGO_GENERATE) | |
|
Alexander Potapenko
2012/04/24 10:38:15
Ditto.
asharif1
2012/04/24 17:50:12
Done.
| |
| 68 __attribute__ ((tls_model ("initial-exec"))) | 71 __attribute__ ((tls_model ("initial-exec"))) |
| 69 # endif | 72 # endif |
| 70 ; | 73 ; |
| 71 #endif | 74 #endif |
| 72 bool ThreadCache::tsd_inited_ = false; | 75 bool ThreadCache::tsd_inited_ = false; |
| 73 pthread_key_t ThreadCache::heap_key_; | 76 pthread_key_t ThreadCache::heap_key_; |
| 74 | 77 |
| 75 #if defined(HAVE_TLS) | 78 #if defined(HAVE_TLS) |
| 76 bool kernel_supports_tls = false; // be conservative | 79 bool kernel_supports_tls = false; // be conservative |
| 77 # if defined(_WIN32) // windows has supported TLS since winnt, I think. | 80 # 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) { | 506 void ThreadCache::set_overall_thread_cache_size(size_t new_size) { |
| 504 // Clip the value to a reasonable range | 507 // Clip the value to a reasonable range |
| 505 if (new_size < kMinThreadCacheSize) new_size = kMinThreadCacheSize; | 508 if (new_size < kMinThreadCacheSize) new_size = kMinThreadCacheSize; |
| 506 if (new_size > (1<<30)) new_size = (1<<30); // Limit to 1GB | 509 if (new_size > (1<<30)) new_size = (1<<30); // Limit to 1GB |
| 507 overall_thread_cache_size_ = new_size; | 510 overall_thread_cache_size_ = new_size; |
| 508 | 511 |
| 509 RecomputePerThreadCacheSize(); | 512 RecomputePerThreadCacheSize(); |
| 510 } | 513 } |
| 511 | 514 |
| 512 } // namespace tcmalloc | 515 } // namespace tcmalloc |
| OLD | NEW |