Changeset 25422 in webkit for trunk/JavaScriptCore/wtf/FastMalloc.cpp
- Timestamp:
- Sep 7, 2007, 12:42:47 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/FastMalloc.cpp
r25409 r25422 193 193 194 194 #if WTF_CHANGES 195 195 196 #if PLATFORM(DARWIN) 196 197 #include "MallocZoneSupport.h" 198 #endif 199 200 // Calling pthread_getspecific through a global function pointer is faster than a normal 201 // call to the function on Mac OS X, and it's used in performance-critical code. So we 202 // use a function pointer. But that's not necessarily faster on other platforms, and we had 203 // problems with this technique on Windows, so we'll do this only on Mac OS X. 204 #if PLATFORM(DARWIN) 205 static void* (*pthread_getspecific_function_pointer)(pthread_key_t) = pthread_getspecific; 206 #define pthread_getspecific(key) pthread_getspecific_function_pointer(key) 197 207 #endif 198 208 … … 1283 1293 static bool tsd_inited = false; 1284 1294 static pthread_key_t heap_key; 1285 static void* (*FM_pthread_getspecific)(pthread_key_t) = pthread_getspecific;1286 1295 1287 1296 // Allocator for thread heaps … … 1553 1562 InitModule(); 1554 1563 } else { 1555 ptr = FM_pthread_getspecific(heap_key);1564 ptr = pthread_getspecific(heap_key); 1556 1565 } 1557 1566 if (ptr == NULL) ptr = CreateCacheIfNecessary(); 1558 return reinterpret_cast<TCMalloc_ThreadCache*>(ptr);1567 return static_cast<TCMalloc_ThreadCache*>(ptr); 1559 1568 } 1560 1569 … … 1564 1573 inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetCacheIfPresent() { 1565 1574 if (!tsd_inited) return NULL; 1566 return reinterpret_cast<TCMalloc_ThreadCache*> 1567 (FM_pthread_getspecific(heap_key)); 1575 return static_cast<TCMalloc_ThreadCache*>(pthread_getspecific(heap_key)); 1568 1576 } 1569 1577 … … 1681 1689 // Remove all memory from heap 1682 1690 TCMalloc_ThreadCache* heap; 1683 heap = reinterpret_cast<TCMalloc_ThreadCache*>(ptr);1691 heap = static_cast<TCMalloc_ThreadCache*>(ptr); 1684 1692 heap->Cleanup(); 1685 1693
Note:
See TracChangeset
for help on using the changeset viewer.