Changeset 26760 in webkit
- Timestamp:
- Oct 18, 2007, 7:14:09 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r26720 r26760 1 2007-10-18 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Adam. 4 5 - use __declspec(thread) for fast thread-local storage on Windows 6 7 - 2.2% speedup on sunspider (on Windows) 8 - 7% speedup on the string section 9 - 6% speedup on JS iBench 10 11 - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422 12 - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10 13 14 15 * wtf/FastMalloc.cpp: 16 (WTF::getThreadHeap): 17 (WTF::setThreadHeap): 18 (WTF::TCMalloc_ThreadCache::GetCache): 19 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent): 20 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): 21 1 22 2007-10-17 Darin Adler <darin@apple.com> 2 23 -
trunk/JavaScriptCore/wtf/FastMalloc.cpp
r25637 r26760 1185 1185 static TCMalloc_ThreadCache* GetCache(); 1186 1186 static TCMalloc_ThreadCache* GetCacheIfPresent(); 1187 static void*CreateCacheIfNecessary();1187 static TCMalloc_ThreadCache* CreateCacheIfNecessary(); 1188 1188 static void DeleteCache(void* ptr); 1189 1189 static void RecomputeThreadCacheSize(); … … 1293 1293 static bool tsd_inited = false; 1294 1294 static pthread_key_t heap_key; 1295 #if COMPILER(MSVC) 1296 __declspec(thread) TCMalloc_ThreadCache* threadHeap; 1297 #endif 1298 1299 static ALWAYS_INLINE TCMalloc_ThreadCache* getThreadHeap() 1300 { 1301 #if COMPILER(MSVC) 1302 return threadHeap; 1303 #else 1304 return static_cast<TCMalloc_ThreadCache*>(pthread_getspecific(heap_key)); 1305 #endif 1306 } 1307 1308 static ALWAYS_INLINE void setThreadHeap(TCMalloc_ThreadCache* heap) 1309 { 1310 // still do pthread_setspecific when using MSVC fast TLS to 1311 // benefit from the delete callback. 1312 pthread_setspecific(heap_key, heap); 1313 #if COMPILER(MSVC) 1314 threadHeap = heap; 1315 #endif 1316 } 1295 1317 1296 1318 // Allocator for thread heaps … … 1558 1580 1559 1581 ALWAYS_INLINE TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetCache() { 1560 void* ptr = NULL;1582 TCMalloc_ThreadCache* ptr = NULL; 1561 1583 if (!tsd_inited) { 1562 1584 InitModule(); 1563 1585 } else { 1564 ptr = pthread_getspecific(heap_key);1586 ptr = getThreadHeap(); 1565 1587 } 1566 1588 if (ptr == NULL) ptr = CreateCacheIfNecessary(); 1567 return static_cast<TCMalloc_ThreadCache*>(ptr);1589 return ptr; 1568 1590 } 1569 1591 … … 1573 1595 inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetCacheIfPresent() { 1574 1596 if (!tsd_inited) return NULL; 1575 return static_cast<TCMalloc_ThreadCache*>(pthread_getspecific(heap_key));1597 return getThreadHeap(); 1576 1598 } 1577 1599 … … 1638 1660 } 1639 1661 1640 void* TCMalloc_ThreadCache::CreateCacheIfNecessary() {1662 TCMalloc_ThreadCache* TCMalloc_ThreadCache::CreateCacheIfNecessary() { 1641 1663 // Initialize per-thread data if necessary 1642 1664 TCMalloc_ThreadCache* heap = NULL; … … 1681 1703 if (!heap->setspecific_ && tsd_inited) { 1682 1704 heap->setspecific_ = true; 1683 pthread_setspecific(heap_key,heap);1705 setThreadHeap(heap); 1684 1706 } 1685 1707 return heap;
Note:
See TracChangeset
for help on using the changeset viewer.