Diff
Modified: branches/safari-534.52-branch/Source/_javascript_Core/ChangeLog (98127 => 98128)
--- branches/safari-534.52-branch/Source/_javascript_Core/ChangeLog 2011-10-21 19:53:06 UTC (rev 98127)
+++ branches/safari-534.52-branch/Source/_javascript_Core/ChangeLog 2011-10-21 19:54:55 UTC (rev 98128)
@@ -1,3 +1,15 @@
+2011-10-21 Lucas Forschler <[email protected]>
+
+ Merge 94298
+
+ 2011-09-01 Ada Chan <[email protected]>
+
+ Export fastMallocStatistics and Heap::objectTypeCounts for https://bugs.webkit.org/show_bug.cgi?id=67160.
+
+ Reviewed by Darin Adler.
+
+ * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+
2011-09-06 Mark Rowe <[email protected]>
Merge r94251.
Modified: branches/safari-534.52-branch/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (98127 => 98128)
--- branches/safari-534.52-branch/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-10-21 19:53:06 UTC (rev 98127)
+++ branches/safari-534.52-branch/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-10-21 19:54:55 UTC (rev 98128)
@@ -163,6 +163,7 @@
?fastMalloc@WTF@@YAPAXI@Z
?fastMallocMatchFailed@Internal@WTF@@YAXPAX@Z
?fastMallocSize@WTF@@YAIPBX@Z
+ ?fastMallocStatistics@WTF@@YA?AUFastMallocStatistics@1@XZ
?fastRealloc@WTF@@YAPAXPAXI@Z
?fastStrDup@WTF@@YAPADPBD@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
@@ -254,6 +255,7 @@
?numberToString@WTF@@YAINQA_W@Z
?objectCount@Heap@JSC@@QAEIXZ
?objectProtoFuncToString@JSC@@YI_JPAVExecState@1@@Z
+ ?objectTypeCounts@Heap@JSC@@QAE?AV?$PassOwnPtr@V?$HashCountedSet@PBDU?$PtrHash@PBD@WTF@@U?$HashTraits@PBD@2@@WTF@@@WTF@@XZ
?parseDateFromNullTerminatedCharacters@WTF@@YANPBD@Z
?preventExtensions@JSObject@JSC@@UAEXAAVJSGlobalData@2@@Z
?profiler@Profiler@JSC@@SAPAV12@XZ
Modified: branches/safari-534.52-branch/Source/WebKit2/ChangeLog (98127 => 98128)
--- branches/safari-534.52-branch/Source/WebKit2/ChangeLog 2011-10-21 19:53:06 UTC (rev 98127)
+++ branches/safari-534.52-branch/Source/WebKit2/ChangeLog 2011-10-21 19:54:55 UTC (rev 98128)
@@ -1,5 +1,41 @@
2011-10-21 Lucas Forschler <[email protected]>
+ Merge 94298
+
+ 2011-09-01 Ada Chan <[email protected]>
+
+ Gather _javascript_, FastMalloc, icon, font, and glyph page statistics in WebProcess::getWebCoreStatistics().
+ https://bugs.webkit.org/show_bug.cgi?id=67160
+
+ Reviewed by Darin Adler.
+
+ Encode and decode the data members in StatisticsData.
+ * Shared/StatisticsData.cpp:
+ (WebKit::StatisticsData::encode):
+ (WebKit::StatisticsData::decode):
+ (WebKit::StatisticsData::StatisticsData):
+
+ Add three data members to StatisticsData:
+ - statisticsNumbers: Map containing statistics values that are numbers, mapped by their names, such as
+ _javascript_ObjectsCount, CachedFontDataCount, etc.
+ - _javascript_ProtectedObjectTypeCounts
+ - _javascript_ObjectTypeCounts
+ * Shared/StatisticsData.h:
+
+ Create a WK::Dictionary containing statistics values mapped by their names and return that dictionary
+ in WebContext::didGetWebCoreStatistics().
+ * UIProcess/WebContext.cpp:
+ (WebKit::createDictionaryFromHashMap):
+ (WebKit::WebContext::didGetWebCoreStatistics):
+
+ Package _javascript_, FastMalloc, icon, font, and glyph page statistics into a StatisticsData object
+ and send it to the UIProcess.
+ * WebProcess/WebProcess.cpp:
+ (WebKit::fromCountedSetToHashMap):
+ (WebKit::WebProcess::getWebCoreStatistics):
+
+2011-10-21 Lucas Forschler <[email protected]>
+
Merge 94115
2011-08-30 Ada Chan <[email protected]>
Modified: branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.cpp (98127 => 98128)
--- branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.cpp 2011-10-21 19:53:06 UTC (rev 98127)
+++ branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.cpp 2011-10-21 19:54:55 UTC (rev 98128)
@@ -32,18 +32,25 @@
void StatisticsData::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- // FIXME: To be implemented.
+ encoder->encode(statisticsNumbers);
+ encoder->encode(_javascript_ProtectedObjectTypeCounts);
+ encoder->encode(_javascript_ObjectTypeCounts);
}
bool StatisticsData::decode(CoreIPC::ArgumentDecoder* decoder, StatisticsData& statisticsData)
{
- // FIXME: To be implemented.
+ if (!decoder->decode(statisticsData.statisticsNumbers))
+ return false;
+ if (!decoder->decode(statisticsData._javascript_ProtectedObjectTypeCounts))
+ return false;
+ if (!decoder->decode(statisticsData._javascript_ObjectTypeCounts))
+ return false;
+
return true;
}
StatisticsData::StatisticsData()
{
- // FIXME: To be implemented.
}
} // namespace WebKit
Modified: branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.h (98127 => 98128)
--- branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.h 2011-10-21 19:53:06 UTC (rev 98127)
+++ branches/safari-534.52-branch/Source/WebKit2/Shared/StatisticsData.h 2011-10-21 19:54:55 UTC (rev 98128)
@@ -28,6 +28,9 @@
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
+#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
namespace WebKit {
@@ -35,6 +38,10 @@
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, StatisticsData&);
+ HashMap<String, uint64_t> statisticsNumbers;
+ HashMap<String, uint64_t> _javascript_ProtectedObjectTypeCounts;
+ HashMap<String, uint64_t> _javascript_ObjectTypeCounts;
+
StatisticsData();
};
Modified: branches/safari-534.52-branch/Source/WebKit2/UIProcess/WebContext.cpp (98127 => 98128)
--- branches/safari-534.52-branch/Source/WebKit2/UIProcess/WebContext.cpp 2011-10-21 19:53:06 UTC (rev 98127)
+++ branches/safari-534.52-branch/Source/WebKit2/UIProcess/WebContext.cpp 2011-10-21 19:54:55 UTC (rev 98128)
@@ -30,8 +30,10 @@
#include "ImmutableArray.h"
#include "InjectedBundleMessageKinds.h"
#include "Logging.h"
+#include "MutableDictionary.h"
#include "RunLoop.h"
#include "SandboxExtension.h"
+#include "StatisticsData.h"
#include "TextChecker.h"
#include "WKContextPrivate.h"
#include "WebApplicationCacheManagerProxy.h"
@@ -791,6 +793,16 @@
process()->send(Messages::WebProcess::GetWebCoreStatistics(callbackID), 0);
}
+static PassRefPtr<MutableDictionary> createDictionaryFromHashMap(const HashMap<String, uint64_t>& map)
+{
+ RefPtr<MutableDictionary> result = MutableDictionary::create();
+ HashMap<String, uint64_t>::const_iterator end = map.end();
+ for (HashMap<String, uint64_t>::const_iterator it = map.begin(); it != end; ++it)
+ result->set(it->first, RefPtr<WebUInt64>(WebUInt64::create(it->second)).get());
+
+ return result;
+}
+
void WebContext::didGetWebCoreStatistics(const StatisticsData& statisticsData, uint64_t callbackID)
{
RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID);
@@ -798,9 +810,11 @@
// FIXME: Log error or assert.
return;
}
-
- // FIXME: Store statistics data into a dictionary.
- RefPtr<ImmutableDictionary> statistics = ImmutableDictionary::create();
+
+ RefPtr<MutableDictionary> statistics = createDictionaryFromHashMap(statisticsData.statisticsNumbers);
+ statistics->set("_javascript_ProtectedObjectTypeCounts", createDictionaryFromHashMap(statisticsData._javascript_ProtectedObjectTypeCounts).get());
+ statistics->set("_javascript_ObjectTypeCounts", createDictionaryFromHashMap(statisticsData._javascript_ObjectTypeCounts).get());
+
callback->performCallbackWithReturnValue(statistics.get());
}
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/WebProcess.cpp (98127 => 98128)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/WebProcess.cpp 2011-10-21 19:53:06 UTC (rev 98127)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/WebProcess.cpp 2011-10-21 19:54:55 UTC (rev 98128)
@@ -52,10 +52,16 @@
#include "WebProcessMessages.h"
#include "WebProcessProxyMessages.h"
#include "WebResourceCacheManager.h"
+#include <_javascript_Core/JSLock.h>
+#include <_javascript_Core/MemoryStatistics.h>
#include <WebCore/AXObjectCache.h>
#include <WebCore/ApplicationCacheStorage.h>
#include <WebCore/CrossOriginPreflightResultCache.h>
#include <WebCore/Font.h>
+#include <WebCore/FontCache.h>
+#include <WebCore/GlyphPageTreeNode.h>
+#include <WebCore/IconDatabase.h>
+#include <WebCore/JSDOMWindow.h>
#include <WebCore/Language.h>
#include <WebCore/Logging.h>
#include <WebCore/MemoryCache.h>
@@ -68,6 +74,7 @@
#include <WebCore/SecurityOrigin.h>
#include <WebCore/Settings.h>
#include <WebCore/StorageTracker.h>
+#include <wtf/HashCountedSet.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RandomNumber.h>
@@ -83,6 +90,7 @@
#include "NetscapePluginModule.h"
#endif
+using namespace JSC;
using namespace WebCore;
namespace WebKit {
@@ -812,12 +820,56 @@
}
#endif
+static void fromCountedSetToHashMap(TypeCountSet* countedSet, HashMap<String, uint64_t>& map)
+{
+ TypeCountSet::const_iterator end = countedSet->end();
+ for (TypeCountSet::const_iterator it = countedSet->begin(); it != end; ++it)
+ map.set(it->first, it->second);
+}
+
void WebProcess::getWebCoreStatistics(uint64_t callbackID)
{
StatisticsData data;
- // FIXME: Gather performance data.
+ // Gather _javascript_ statistics.
+ {
+ JSLock lock(SilenceAssertionsOnly);
+ data.statisticsNumbers.set("_javascript_ObjectsCount", JSDOMWindow::commonJSGlobalData()->heap.objectCount());
+ data.statisticsNumbers.set("_javascript_GlobalObjectsCount", JSDOMWindow::commonJSGlobalData()->heap.globalObjectCount());
+ data.statisticsNumbers.set("_javascript_ProtectedObjectsCount", JSDOMWindow::commonJSGlobalData()->heap.protectedObjectCount());
+ data.statisticsNumbers.set("_javascript_ProtectedGlobalObjectsCount", JSDOMWindow::commonJSGlobalData()->heap.protectedGlobalObjectCount());
+
+ OwnPtr<TypeCountSet> protectedObjectTypeCounts(JSDOMWindow::commonJSGlobalData()->heap.protectedObjectTypeCounts());
+ fromCountedSetToHashMap(protectedObjectTypeCounts.get(), data._javascript_ProtectedObjectTypeCounts);
+
+ OwnPtr<TypeCountSet> objectTypeCounts(JSDOMWindow::commonJSGlobalData()->heap.objectTypeCounts());
+ fromCountedSetToHashMap(objectTypeCounts.get(), data._javascript_ObjectTypeCounts);
+
+ uint64_t _javascript_HeapSize = JSDOMWindow::commonJSGlobalData()->heap.size();
+ data.statisticsNumbers.set("_javascript_HeapSize", _javascript_HeapSize);
+ data.statisticsNumbers.set("_javascript_FreeSize", JSDOMWindow::commonJSGlobalData()->heap.capacity() - _javascript_HeapSize);
+ }
+
+ WTF::FastMallocStatistics fastMallocStatistics = WTF::fastMallocStatistics();
+ data.statisticsNumbers.set("FastMallocReservedVMBytes", fastMallocStatistics.reservedVMBytes);
+ data.statisticsNumbers.set("FastMallocCommittedVMBytes", fastMallocStatistics.committedVMBytes);
+ data.statisticsNumbers.set("FastMallocFreeListBytes", fastMallocStatistics.freeListBytes);
+ // Gather icon statistics.
+ data.statisticsNumbers.set("IconPageURLMappingCount", iconDatabase().pageURLMappingCount());
+ data.statisticsNumbers.set("IconRetainedPageURLCount", iconDatabase().retainedPageURLCount());
+ data.statisticsNumbers.set("IconRecordCount", iconDatabase().iconRecordCount());
+ data.statisticsNumbers.set("IconsWithDataCount", iconDatabase().iconRecordCountWithData());
+
+ // Gather font statistics.
+ data.statisticsNumbers.set("CachedFontDataCount", fontCache()->fontDataCount());
+ data.statisticsNumbers.set("CachedFontDataInactiveCount", fontCache()->inactiveFontDataCount());
+
+ // Gather glyph page statistics.
+ data.statisticsNumbers.set("GlyphPageCount", GlyphPageTreeNode::treeGlyphPageCount());
+
+ // FIXME: Gather WebCore cache statistics.
+
m_connection->send(Messages::WebContext::DidGetWebCoreStatistics(data, callbackID), 0);
}