[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

slewis at apple.com slewis at apple.com
Wed Dec 22 13:15:30 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b2725f7a0edc63bf8614e11f3d06cac54988cd75
Author: slewis at apple.com <slewis at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 10 00:21:43 2010 +0000

    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.
    
    * JavaScriptCore.exp:
    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.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67130 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index e30a30e..133ba86 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,54 @@
+2010-09-09  John Therrell  <jtherrell at apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Added statistics sampling and reporting for JavaScriptCore's RegisterFile and ExecutableAllocator classes
+        https://bugs.webkit.org/show_bug.cgi?id=45134
+
+        Added thread-safe committed byte counting and reporting functionality to RegisterFile and 
+        ExecutableAllocator.
+
+        * JavaScriptCore.exp:
+        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.
+
 2010-09-09  Mark Rowe  <mrowe at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index b8fbb08..58959ff 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -131,6 +131,7 @@ __ZN3JSC12JSGlobalData14resetDateCacheEv
 __ZN3JSC12JSGlobalData14sharedInstanceEv
 __ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeE
 __ZN3JSC12JSGlobalDataD1Ev
+__ZN3JSC12RegisterFile18committedByteCountEv
 __ZN3JSC12SamplingTool5setupEv
 __ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE
 __ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh
@@ -191,6 +192,7 @@ __ZN3JSC18PropertyDescriptor17defaultAttributesE
 __ZN3JSC18PropertyDescriptor21setAccessorDescriptorENS_7JSValueES1_j
 __ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE
 __ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE
+__ZN3JSC19ExecutableAllocator18committedByteCountEv
 __ZN3JSC19initializeThreadingEv
 __ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
 __ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE
diff --git a/JavaScriptCore/interpreter/RegisterFile.cpp b/JavaScriptCore/interpreter/RegisterFile.cpp
index 4f5d1d5..4c37676 100644
--- a/JavaScriptCore/interpreter/RegisterFile.cpp
+++ b/JavaScriptCore/interpreter/RegisterFile.cpp
@@ -33,16 +33,26 @@
 
 namespace JSC {
 
+static size_t committedBytesCount = 0;
+
+static Mutex& registerFileStatisticsMutex()
+{
+    DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
+    return staticMutex;
+}    
+    
 RegisterFile::~RegisterFile()
 {
     void* base = m_reservation.base();
     m_reservation.decommit(base, reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(base));
+    addToCommittedByteCount(-(reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(base)));
     m_reservation.deallocate();
 }
 
 void RegisterFile::releaseExcessCapacity()
 {
     m_reservation.decommit(m_start, reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(m_start));
+    addToCommittedByteCount(-(reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(m_start)));
     m_commitEnd = m_start;
     m_maxUsed = m_start;
 }
@@ -62,4 +72,22 @@ JSGlobalObject* RegisterFile::globalObject()
     return m_globalObject.get();
 }
 
+void RegisterFile::initializeThreading()
+{
+    registerFileStatisticsMutex();
+}
+
+size_t RegisterFile::committedByteCount()
+{
+    MutexLocker locker(registerFileStatisticsMutex());
+    return committedBytesCount;
+}
+
+void RegisterFile::addToCommittedByteCount(long byteCount)
+{
+    MutexLocker locker(registerFileStatisticsMutex());
+    ASSERT(static_cast<long>(committedBytesCount) + byteCount > -1);
+    committedBytesCount += byteCount;
+}
+
 } // namespace JSC
diff --git a/JavaScriptCore/interpreter/RegisterFile.h b/JavaScriptCore/interpreter/RegisterFile.h
index f3284ff..d9f6a2b 100644
--- a/JavaScriptCore/interpreter/RegisterFile.h
+++ b/JavaScriptCore/interpreter/RegisterFile.h
@@ -134,10 +134,13 @@ namespace JSC {
         void markGlobals(MarkStack& markStack, Heap* heap) { heap->markConservatively(markStack, lastGlobal(), m_start); }
         void markCallFrames(MarkStack& markStack, Heap* heap) { heap->markConservatively(markStack, m_start, m_end); }
 
+        static size_t committedByteCount();
+        static void initializeThreading();
+
     private:
         void checkAllocatedOkay(bool okay);
-
         void releaseExcessCapacity();
+        void addToCommittedByteCount(long);
         size_t m_numGlobals;
         const size_t m_maxGlobals;
         Register* m_start;
@@ -166,6 +169,7 @@ namespace JSC {
         checkAllocatedOkay(base);
         size_t committedSize = roundUpAllocationSize(maxGlobals * sizeof(Register), commitSize);
         checkAllocatedOkay(m_reservation.commit(base, committedSize));
+        addToCommittedByteCount(static_cast<long>(committedSize));
         m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(base) + committedSize);
         m_start = static_cast<Register*>(base) + maxGlobals;
         m_end = m_start;
@@ -193,6 +197,7 @@ namespace JSC {
         if (newEnd > m_commitEnd) {
             size_t size = roundUpAllocationSize(reinterpret_cast<char*>(newEnd) - reinterpret_cast<char*>(m_commitEnd), commitSize);
             checkAllocatedOkay(m_reservation.commit(m_commitEnd, size));
+            addToCommittedByteCount(static_cast<long>(size));
             m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) + size);
         }
 
diff --git a/JavaScriptCore/jit/ExecutableAllocator.h b/JavaScriptCore/jit/ExecutableAllocator.h
index 576f889..f145404 100644
--- a/JavaScriptCore/jit/ExecutableAllocator.h
+++ b/JavaScriptCore/jit/ExecutableAllocator.h
@@ -297,6 +297,7 @@ public:
 #else
     #error "The cacheFlush support is missing on this platform."
 #endif
+    static size_t committedByteCount();
 
 private:
 
diff --git a/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp b/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
index b34204f..15247c2 100644
--- a/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
+++ b/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
@@ -54,6 +54,9 @@
 using namespace WTF;
 
 namespace JSC {
+    
+static size_t committedBytesCount = 0;  
+static SpinLock spinlock = SPINLOCK_INITIALIZER;
 
 // FreeListEntry describes a free chunk of memory, stored in the freeList.
 struct FreeListEntry {
@@ -128,12 +131,14 @@ class FixedVMPoolAllocator
     void release(void* position, size_t size)
     {
         m_allocation.decommit(position, size);
+        addToCommittedByteCount(-static_cast<long>(size));
     }
 
     void reuse(void* position, size_t size)
     {
         bool okay = m_allocation.commit(position, size);
         ASSERT_UNUSED(okay, okay);
+        addToCommittedByteCount(static_cast<long>(size));
     }
 
     // All addition to the free list should go through this method, rather than
@@ -415,6 +420,13 @@ private:
     }
 #endif
 
+    void addToCommittedByteCount(long byteCount)
+    {
+        ASSERT(spinlock.IsHeld());
+        ASSERT(static_cast<long>(committedBytesCount) + byteCount > -1);
+        committedBytesCount += byteCount;
+    }
+
     // Freed space from the most common sized allocations will be held in this list, ...
     const size_t m_commonSize;
     Vector<void*> m_commonSizedAllocations;
@@ -428,14 +440,19 @@ private:
     PageReservation m_allocation;
 };
 
+size_t ExecutableAllocator::committedByteCount()
+{
+    SpinLockHolder lockHolder(&spinlock);
+    return committedBytesCount;
+}   
+
 void ExecutableAllocator::intializePageSize()
 {
     ExecutableAllocator::pageSize = getpagesize();
 }
 
 static FixedVMPoolAllocator* allocator = 0;
-static SpinLock spinlock = SPINLOCK_INITIALIZER;
-
+    
 bool ExecutableAllocator::isValid() const
 {
     SpinLockHolder lock_holder(&spinlock);
diff --git a/JavaScriptCore/runtime/InitializeThreading.cpp b/JavaScriptCore/runtime/InitializeThreading.cpp
index 33e8e68..08dddc1 100644
--- a/JavaScriptCore/runtime/InitializeThreading.cpp
+++ b/JavaScriptCore/runtime/InitializeThreading.cpp
@@ -58,6 +58,7 @@ static void initializeThreadingOnce()
 #if ENABLE(JSC_MULTIPLE_THREADS)
     s_dtoaP5Mutex = new Mutex;
     initializeDates();
+    RegisterFile::initializeThreading();
 #endif
 }
 
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 6d8d20c..df5ca46 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-09  John Therrell  <jtherrell at apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Added statistics sampling and reporting for JavaScriptCore's RegisterFile and ExecutableAllocator classes
+        https://bugs.webkit.org/show_bug.cgi?id=45134
+
+        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.
+
 2010-09-09  Jer Noble  <jer.noble at apple.com>
 
         Reviewed by Mark Rowe.
diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm
index a5d5ae1..cc68cef 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.mm
+++ b/WebKit/mac/Misc/WebCoreStatistics.mm
@@ -29,6 +29,8 @@
 #import "WebCoreStatistics.h"
 
 #import "DOMElementInternal.h"
+#import <JavaScriptCore/RegisterFile.h>
+#import <JavaScriptCore/ExecutableAllocator.h>
 #import "WebCache.h"
 #import "WebFrameInternal.h"
 #import <runtime/JSLock.h>
@@ -196,12 +198,16 @@ using namespace WebCore;
     WTF::FastMallocStatistics fastMallocStatistics = WTF::fastMallocStatistics();
     JSLock lock(SilenceAssertionsOnly);
     Heap::Statistics jsHeapStatistics = JSDOMWindow::commonJSGlobalData()->heap.statistics();
+    size_t jscStackBytes = RegisterFile::committedByteCount();
+    size_t jscJITBytes = ExecutableAllocator::committedByteCount();
     return [NSDictionary dictionaryWithObjectsAndKeys:
                 [NSNumber numberWithInt:fastMallocStatistics.reservedVMBytes], @"FastMallocReservedVMBytes",
                 [NSNumber numberWithInt:fastMallocStatistics.committedVMBytes], @"FastMallocCommittedVMBytes",
                 [NSNumber numberWithInt:fastMallocStatistics.freeListBytes], @"FastMallocFreeListBytes",
                 [NSNumber numberWithInt:jsHeapStatistics.size], @"JavaScriptHeapSize",
                 [NSNumber numberWithInt:jsHeapStatistics.free], @"JavaScriptFreeSize",
+                [NSNumber numberWithUnsignedInt:(unsigned int)jscStackBytes], @"JavaScriptStackSize",
+                [NSNumber numberWithUnsignedInt:(unsigned int)jscJITBytes], @"JavaScriptJITSize",
             nil];
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list