Changeset 67130 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 9, 2010, 5:21:43 PM (15 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r67129 r67130 1 2010-09-09 John Therrell <[email protected]> 2 3 Reviewed by Alexey Proskuryakov. 4 5 Added statistics sampling and reporting for JavaScriptCore's RegisterFile and ExecutableAllocator classes 6 https://bugs.webkit.org/show_bug.cgi?id=45134 7 8 Added thread-safe committed byte counting and reporting functionality to RegisterFile and 9 ExecutableAllocator. 10 11 * JavaScriptCore.exp: 12 Exported new symbols to allow for WebKit to get statistics from JavaScriptCore classes. 13 14 * interpreter/RegisterFile.cpp: 15 (JSC::registerFileStatisticsMutex): 16 Added function which returns a static Mutex used for locking during read/write access to 17 static committed byte count variable. 18 (JSC::RegisterFile::~RegisterFile): 19 Added call to addToStatistics since memory is decommitted here. 20 (JSC::RegisterFile::releaseExcessCapacity): 21 Added call to addToStatistics since memory is decommitted here. 22 (JSC::RegisterFile::initializeThreading): 23 Added function which calls registerFileStatisticsMutex(). 24 (JSC::RegisterFile::committedByteCount): 25 Added function which returns the current committed byte count for RegisterFile. 26 (JSC::RegisterFile::addToCommittedByteCount): 27 Added function which updates committed byte count. 28 29 * interpreter/RegisterFile.h: 30 (JSC::RegisterFile::RegisterFile): 31 Added call to addToStatistics since memory is committed here. 32 (JSC::RegisterFile::grow): 33 Added call to addToStatistics since memory is committed here. 34 35 * jit/ExecutableAllocator.h: 36 Added function prototype for public static function committedByteCount(). 37 38 * jit/ExecutableAllocatorFixedVMPool.cpp: 39 (JSC::FixedVMPoolAllocator::release): 40 Added call to addToStatistics since memory is decommitted here. 41 (JSC::FixedVMPoolAllocator::reuse): 42 Added call to addToStatistics since memory is committed here. 43 (JSC::FixedVMPoolAllocator::addToCommittedByteCount): 44 Added function which updates committed byte count. 45 (JSC::ExecutableAllocator::committedByteCount): 46 Added function which returns the current committed byte count for ExecutableAllocator. 47 48 * runtime/InitializeThreading.cpp: 49 (JSC::initializeThreadingOnce): 50 Added call to RegisterFile::initializeThreading. 51 1 52 2010-09-09 Mark Rowe <[email protected]> 2 53 -
trunk/JavaScriptCore/JavaScriptCore.exp
r66936 r67130 132 132 __ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeE 133 133 __ZN3JSC12JSGlobalDataD1Ev 134 __ZN3JSC12RegisterFile18committedByteCountEv 134 135 __ZN3JSC12SamplingTool5setupEv 135 136 __ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE … … 192 193 __ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE 193 194 __ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE 195 __ZN3JSC19ExecutableAllocator18committedByteCountEv 194 196 __ZN3JSC19initializeThreadingEv 195 197 __ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE -
trunk/JavaScriptCore/interpreter/RegisterFile.cpp
r64782 r67130 34 34 namespace JSC { 35 35 36 static size_t committedBytesCount = 0; 37 38 static Mutex& registerFileStatisticsMutex() 39 { 40 DEFINE_STATIC_LOCAL(Mutex, staticMutex, ()); 41 return staticMutex; 42 } 43 36 44 RegisterFile::~RegisterFile() 37 45 { 38 46 void* base = m_reservation.base(); 39 47 m_reservation.decommit(base, reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(base)); 48 addToCommittedByteCount(-(reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(base))); 40 49 m_reservation.deallocate(); 41 50 } … … 44 53 { 45 54 m_reservation.decommit(m_start, reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(m_start)); 55 addToCommittedByteCount(-(reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(m_start))); 46 56 m_commitEnd = m_start; 47 57 m_maxUsed = m_start; … … 63 73 } 64 74 75 void RegisterFile::initializeThreading() 76 { 77 registerFileStatisticsMutex(); 78 } 79 80 size_t RegisterFile::committedByteCount() 81 { 82 MutexLocker locker(registerFileStatisticsMutex()); 83 return committedBytesCount; 84 } 85 86 void RegisterFile::addToCommittedByteCount(long byteCount) 87 { 88 MutexLocker locker(registerFileStatisticsMutex()); 89 ASSERT(static_cast<long>(committedBytesCount) + byteCount > -1); 90 committedBytesCount += byteCount; 91 } 92 65 93 } // namespace JSC -
trunk/JavaScriptCore/interpreter/RegisterFile.h
r65311 r67130 135 135 void markCallFrames(MarkStack& markStack, Heap* heap) { heap->markConservatively(markStack, m_start, m_end); } 136 136 137 static size_t committedByteCount(); 138 static void initializeThreading(); 139 137 140 private: 138 141 void checkAllocatedOkay(bool okay); 139 140 142 void releaseExcessCapacity(); 143 void addToCommittedByteCount(long); 141 144 size_t m_numGlobals; 142 145 const size_t m_maxGlobals; … … 167 170 size_t committedSize = roundUpAllocationSize(maxGlobals * sizeof(Register), commitSize); 168 171 checkAllocatedOkay(m_reservation.commit(base, committedSize)); 172 addToCommittedByteCount(static_cast<long>(committedSize)); 169 173 m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(base) + committedSize); 170 174 m_start = static_cast<Register*>(base) + maxGlobals; … … 194 198 size_t size = roundUpAllocationSize(reinterpret_cast<char*>(newEnd) - reinterpret_cast<char*>(m_commitEnd), commitSize); 195 199 checkAllocatedOkay(m_reservation.commit(m_commitEnd, size)); 200 addToCommittedByteCount(static_cast<long>(size)); 196 201 m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) + size); 197 202 } -
trunk/JavaScriptCore/jit/ExecutableAllocator.h
r66150 r67130 298 298 #error "The cacheFlush support is missing on this platform." 299 299 #endif 300 static size_t committedByteCount(); 300 301 301 302 private: -
trunk/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
r66150 r67130 55 55 56 56 namespace JSC { 57 58 static size_t committedBytesCount = 0; 59 static SpinLock spinlock = SPINLOCK_INITIALIZER; 57 60 58 61 // FreeListEntry describes a free chunk of memory, stored in the freeList. … … 129 132 { 130 133 m_allocation.decommit(position, size); 134 addToCommittedByteCount(-static_cast<long>(size)); 131 135 } 132 136 … … 135 139 bool okay = m_allocation.commit(position, size); 136 140 ASSERT_UNUSED(okay, okay); 141 addToCommittedByteCount(static_cast<long>(size)); 137 142 } 138 143 … … 416 421 #endif 417 422 423 void addToCommittedByteCount(long byteCount) 424 { 425 ASSERT(spinlock.IsHeld()); 426 ASSERT(static_cast<long>(committedBytesCount) + byteCount > -1); 427 committedBytesCount += byteCount; 428 } 429 418 430 // Freed space from the most common sized allocations will be held in this list, ... 419 431 const size_t m_commonSize; … … 429 441 }; 430 442 443 size_t ExecutableAllocator::committedByteCount() 444 { 445 SpinLockHolder lockHolder(&spinlock); 446 return committedBytesCount; 447 } 448 431 449 void ExecutableAllocator::intializePageSize() 432 450 { … … 435 453 436 454 static FixedVMPoolAllocator* allocator = 0; 437 static SpinLock spinlock = SPINLOCK_INITIALIZER; 438 455 439 456 bool ExecutableAllocator::isValid() const 440 457 { -
trunk/JavaScriptCore/runtime/InitializeThreading.cpp
r65104 r67130 59 59 s_dtoaP5Mutex = new Mutex; 60 60 initializeDates(); 61 RegisterFile::initializeThreading(); 61 62 #endif 62 63 }
Note:
See TracChangeset
for help on using the changeset viewer.