Changeset 67130 in webkit for trunk/JavaScriptCore/jit


Ignore:
Timestamp:
Sep 9, 2010, 5:21:43 PM (15 years ago)
Author:
Stephanie Lewis
Message:

Added statistics sampling and reporting for JavaScriptCore's RegisterFile and ExecutableAllocator classes
https://bugs.webkit.org/show_bug.cgi?id=45134

Reviewed by Alexey Proskuryakov.

JavaScriptCore:

Added thread-safe committed byte counting and reporting functionality to RegisterFile and
ExecutableAllocator.

Exported new symbols to allow for WebKit to get statistics from JavaScriptCore classes.

  • interpreter/RegisterFile.cpp:

(JSC::registerFileStatisticsMutex):
Added function which returns a static Mutex used for locking during read/write access to
static committed byte count variable.
(JSC::RegisterFile::~RegisterFile):
Added call to addToStatistics since memory is decommitted here.
(JSC::RegisterFile::releaseExcessCapacity):
Added call to addToStatistics since memory is decommitted here.
(JSC::RegisterFile::initializeThreading):
Added function which calls registerFileStatisticsMutex().
(JSC::RegisterFile::committedByteCount):
Added function which returns the current committed byte count for RegisterFile.
(JSC::RegisterFile::addToCommittedByteCount):
Added function which updates committed byte count.

  • interpreter/RegisterFile.h:

(JSC::RegisterFile::RegisterFile):
Added call to addToStatistics since memory is committed here.
(JSC::RegisterFile::grow):
Added call to addToStatistics since memory is committed here.

  • jit/ExecutableAllocator.h:

Added function prototype for public static function committedByteCount().

  • jit/ExecutableAllocatorFixedVMPool.cpp:

(JSC::FixedVMPoolAllocator::release):
Added call to addToStatistics since memory is decommitted here.
(JSC::FixedVMPoolAllocator::reuse):
Added call to addToStatistics since memory is committed here.
(JSC::FixedVMPoolAllocator::addToCommittedByteCount):
Added function which updates committed byte count.
(JSC::ExecutableAllocator::committedByteCount):
Added function which returns the current committed byte count for ExecutableAllocator.

  • runtime/InitializeThreading.cpp:

(JSC::initializeThreadingOnce):
Added call to RegisterFile::initializeThreading.

WebKit/mac:

Added ability to enable new JavaScriptCore statistics sampling and reporting for RegisterFile
and ExecutableAllocator classes. Added reporting of JavaScriptCore's stack committed memory
and JIT code committed memory statistics to WebCoreStatistics memoryStatistics.

  • Misc/WebCoreStatistics.mm:

(+[WebCoreStatistics memoryStatistics]):
Added statistics reporting for JSC RegisterFile and ExecutableAllocator.

Location:
trunk/JavaScriptCore/jit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/ExecutableAllocator.h

    r66150 r67130  
    298298    #error "The cacheFlush support is missing on this platform."
    299299#endif
     300    static size_t committedByteCount();
    300301
    301302private:
  • trunk/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp

    r66150 r67130  
    5555
    5656namespace JSC {
     57   
     58static size_t committedBytesCount = 0; 
     59static SpinLock spinlock = SPINLOCK_INITIALIZER;
    5760
    5861// FreeListEntry describes a free chunk of memory, stored in the freeList.
     
    129132    {
    130133        m_allocation.decommit(position, size);
     134        addToCommittedByteCount(-static_cast<long>(size));
    131135    }
    132136
     
    135139        bool okay = m_allocation.commit(position, size);
    136140        ASSERT_UNUSED(okay, okay);
     141        addToCommittedByteCount(static_cast<long>(size));
    137142    }
    138143
     
    416421#endif
    417422
     423    void addToCommittedByteCount(long byteCount)
     424    {
     425        ASSERT(spinlock.IsHeld());
     426        ASSERT(static_cast<long>(committedBytesCount) + byteCount > -1);
     427        committedBytesCount += byteCount;
     428    }
     429
    418430    // Freed space from the most common sized allocations will be held in this list, ...
    419431    const size_t m_commonSize;
     
    429441};
    430442
     443size_t ExecutableAllocator::committedByteCount()
     444{
     445    SpinLockHolder lockHolder(&spinlock);
     446    return committedBytesCount;
     447}   
     448
    431449void ExecutableAllocator::intializePageSize()
    432450{
     
    435453
    436454static FixedVMPoolAllocator* allocator = 0;
    437 static SpinLock spinlock = SPINLOCK_INITIALIZER;
    438 
     455   
    439456bool ExecutableAllocator::isValid() const
    440457{
Note: See TracChangeset for help on using the changeset viewer.