Title: [121196] trunk/Source
Revision
121196
Author
[email protected]
Date
2012-06-25 17:08:19 -0700 (Mon, 25 Jun 2012)

Log Message

[BlackBerry] Add JSC statistics into about:memory
https://bugs.webkit.org/show_bug.cgi?id=89779

Patch by Yong Li <[email protected]> on 2012-06-25
Reviewed by Rob Buis.

Source/_javascript_Core:

Add MemoryStatistics.cpp into build, and fill JITBytes for BlackBerry port.

* PlatformBlackBerry.cmake:
* runtime/MemoryStatistics.cpp:
(JSC::globalMemoryStatistics):

Source/WebKit/blackberry:

Add detailed JS memory statistics to about:memory page.

* WebCoreSupport/AboutData.cpp:
(WebCore::dumpJSCTypeCountSetToTableHTML):
(WebCore):
(WebCore::memoryPage):

Source/WTF:

Turn on WTF_USE_EXPORT_MACROS for BlackBerry port.
This will make macros like JS_EXPORT_PRIVATE work without
extra porting.

* wtf/Platform.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (121195 => 121196)


--- trunk/Source/_javascript_Core/ChangeLog	2012-06-25 23:59:55 UTC (rev 121195)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-06-26 00:08:19 UTC (rev 121196)
@@ -1,3 +1,16 @@
+2012-06-25  Yong Li  <[email protected]>
+
+        [BlackBerry] Add JSC statistics into about:memory
+        https://bugs.webkit.org/show_bug.cgi?id=89779
+
+        Reviewed by Rob Buis.
+
+        Add MemoryStatistics.cpp into build, and fill JITBytes for BlackBerry port.
+
+        * PlatformBlackBerry.cmake:
+        * runtime/MemoryStatistics.cpp:
+        (JSC::globalMemoryStatistics):
+
 2012-06-23  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r121058.

Modified: trunk/Source/_javascript_Core/PlatformBlackBerry.cmake (121195 => 121196)


--- trunk/Source/_javascript_Core/PlatformBlackBerry.cmake	2012-06-25 23:59:55 UTC (rev 121195)
+++ trunk/Source/_javascript_Core/PlatformBlackBerry.cmake	2012-06-26 00:08:19 UTC (rev 121196)
@@ -8,6 +8,7 @@
 
 LIST(APPEND _javascript_Core_SOURCES
     runtime/GCActivityCallbackBlackBerry.cpp
+    runtime/MemoryStatistics.cpp
 )
 
 INSTALL(FILES "wtf/Forward.h" DESTINATION usr/include/browser/webkit/wtf)

Modified: trunk/Source/_javascript_Core/runtime/MemoryStatistics.cpp (121195 => 121196)


--- trunk/Source/_javascript_Core/runtime/MemoryStatistics.cpp	2012-06-25 23:59:55 UTC (rev 121195)
+++ trunk/Source/_javascript_Core/runtime/MemoryStatistics.cpp	2012-06-26 00:08:19 UTC (rev 121196)
@@ -37,7 +37,7 @@
     GlobalMemoryStatistics stats;
 
     stats.stackBytes = RegisterFile::committedByteCount();
-#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
+#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED) || PLATFORM(BLACKBERRY)
     stats.JITBytes = ExecutableAllocator::committedByteCount();
 #else
     stats.JITBytes = 0;

Modified: trunk/Source/WTF/ChangeLog (121195 => 121196)


--- trunk/Source/WTF/ChangeLog	2012-06-25 23:59:55 UTC (rev 121195)
+++ trunk/Source/WTF/ChangeLog	2012-06-26 00:08:19 UTC (rev 121196)
@@ -1,3 +1,16 @@
+2012-06-25  Yong Li  <[email protected]>
+
+        [BlackBerry] Add JSC statistics into about:memory
+        https://bugs.webkit.org/show_bug.cgi?id=89779
+
+        Reviewed by Rob Buis.
+
+        Turn on WTF_USE_EXPORT_MACROS for BlackBerry port.
+        This will make macros like JS_EXPORT_PRIVATE work without
+        extra porting.
+
+        * wtf/Platform.h:
+
 2012-06-25  Adam Barth  <[email protected]>
 
         Use InterpolationLow on chromium-android

Modified: trunk/Source/WTF/wtf/Platform.h (121195 => 121196)


--- trunk/Source/WTF/wtf/Platform.h	2012-06-25 23:59:55 UTC (rev 121195)
+++ trunk/Source/WTF/wtf/Platform.h	2012-06-26 00:08:19 UTC (rev 121196)
@@ -1066,7 +1066,7 @@
    since most ports try to support sub-project independence, adding new headers
    to WTF causes many ports to break, and so this way we can address the build
    breakages one port at a time. */
-#if !defined(WTF_USE_EXPORT_MACROS) && (PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(WX))
+#if !defined(WTF_USE_EXPORT_MACROS) && (PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(WX) || PLATFORM(BLACKBERRY))
 #define WTF_USE_EXPORT_MACROS 1
 #endif
 

Modified: trunk/Source/WebKit/blackberry/ChangeLog (121195 => 121196)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-06-25 23:59:55 UTC (rev 121195)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-06-26 00:08:19 UTC (rev 121196)
@@ -1,3 +1,17 @@
+2012-06-25  Yong Li  <[email protected]>
+
+        [BlackBerry] Add JSC statistics into about:memory
+        https://bugs.webkit.org/show_bug.cgi?id=89779
+
+        Reviewed by Rob Buis.
+
+        Add detailed JS memory statistics to about:memory page.
+
+        * WebCoreSupport/AboutData.cpp:
+        (WebCore::dumpJSCTypeCountSetToTableHTML):
+        (WebCore):
+        (WebCore::memoryPage):
+
 2012-06-25  Crystal Zhang  <[email protected]>
 
         [BlackBerry] Use AIR controls if client doesn't support HTML control

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp (121195 => 121196)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp	2012-06-25 23:59:55 UTC (rev 121195)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp	2012-06-26 00:08:19 UTC (rev 121196)
@@ -20,12 +20,16 @@
 #include "AboutData.h"
 
 #include "CString.h"
+#include "JSDOMWindow.h"
 #include "MemoryCache.h"
+#include "MemoryStatistics.h"
 #include "SurfacePool.h"
 #include "WebKitVersion.h"
 
 #include <process.h>
 #include <BlackBerryPlatformSettings.h>
+#include <heap/Heap.h>
+#include <runtime/JSGlobalData.h>
 #include <sys/stat.h>
 #include <sys/utsname.h>
 
@@ -188,19 +192,28 @@
         + "</tr>";
 }
 
+static void dumpJSCTypeCountSetToTableHTML(String& tableHTML, JSC::TypeCountSet* typeCountSet)
+{
+    if (!typeCountSet)
+        return;
+
+    for (JSC::TypeCountSet::const_iterator iter = typeCountSet->begin(); iter != typeCountSet->end(); ++iter)
+        tableHTML += numberToHTMLTr(iter->first, iter->second);
+}
+
 String memoryPage()
 {
     String page;
 
     // generate memory information
-    page = String("<html><head><title>BlackBerry Browser Memory Information</title></head><body><h2>BlackBerry Browser Memory Information</h2>");
+    page = "<html><head><title>BlackBerry Browser Memory Information</title></head><body><h2>BlackBerry Browser Memory Information</h2>";
 
     // generate cache information
     MemoryCache* cacheInc = memoryCache();
     MemoryCache::Statistics cacheStat = cacheInc->getStatistics();
 
-    page += String("<h2>Cache Information</h2>")
-            + "<table align=\"center\" rules=\"all\"><tr> <th>Item</th> <th>Count</th> <th>Size<br>KB</th> <th>Living<br>KB</th> <th>Decoded<br>KB</th></tr>";
+    page += "<h2>Cache Information</h2>"
+            "<table align=\"center\" rules=\"all\"><tr> <th>Item</th> <th>Count</th> <th>Size<br>KB</th> <th>Living<br>KB</th> <th>Decoded<br>KB</th></tr>";
 
     MemoryCache::TypeStatistic total;
     total.count = cacheStat.images.count + cacheStat.cssStyleSheets.count
@@ -224,9 +237,38 @@
     page += "</table>";
 
 #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD
+
+    // JS engine memory usage.
+    JSC::GlobalMemoryStatistics jscMemoryStat = JSC::globalMemoryStatistics();
+    JSC::Heap& mainHeap = JSDOMWindow::commonJSGlobalData()->heap;
+    OwnPtr<JSC::TypeCountSet> objectTypeCounts = mainHeap.objectTypeCounts();
+    OwnPtr<JSC::TypeCountSet> protectedObjectTypeCounts = mainHeap.protectedObjectTypeCounts();
+
+    page += "<h2>JS engine memory usage</h2><table align=\"center\" rules=\"all\">";
+
+    page += numberToHTMLTr("Stack size", jscMemoryStat.stackBytes);
+    page += numberToHTMLTr("JIT memory usage", jscMemoryStat.JITBytes);
+    page += numberToHTMLTr("Main heap capacity", mainHeap.capacity());
+    page += numberToHTMLTr("Main heap size", mainHeap.size());
+    page += numberToHTMLTr("Object count", mainHeap.objectCount());
+    page += numberToHTMLTr("Global object count", mainHeap.globalObjectCount());
+    page += numberToHTMLTr("Protected object count", mainHeap.protectedObjectCount());
+    page += numberToHTMLTr("Protected global object count", mainHeap.protectedGlobalObjectCount());
+
+    page += "</table>";
+
+    page += "<h3>Object type counts</h3><table align=\"center\" rules=\"all\">";
+    dumpJSCTypeCountSetToTableHTML(page, objectTypeCounts.get());
+    page += "</table>";
+
+    page += "<h3>Protected object type counts</h3><table align=\"center\" rules=\"all\">";
+    dumpJSCTypeCountSetToTableHTML(page, protectedObjectTypeCounts.get());
+    page += "</table>";
+
+    // Malloc info.
     struct mallinfo mallocInfo = mallinfo();
 
-    page += String("<h2>Malloc Information</h2>") + "<table align=\"center\" rules=\"all\">";
+    page += "<h2>Malloc Information</h2><table align=\"center\" rules=\"all\">";
 
     page += numberToHTMLTr("Total space in use", mallocInfo.usmblks + mallocInfo.uordblks);
     page += numberToHTMLTr("Total space in free blocks", mallocInfo.fsmblks + mallocInfo.fordblks);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to