From 5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 Mon Sep 17 00:00:00 2001 From: Iain Merrick Date: Mon, 13 Sep 2010 16:35:48 +0100 Subject: Merge WebKit at r67178 : Initial merge by git. Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18 --- JavaScriptCore/runtime/JSGlobalData.cpp | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'JavaScriptCore/runtime/JSGlobalData.cpp') diff --git a/JavaScriptCore/runtime/JSGlobalData.cpp b/JavaScriptCore/runtime/JSGlobalData.cpp index 97f9be5..5eaa59b 100644 --- a/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/JavaScriptCore/runtime/JSGlobalData.cpp @@ -51,6 +51,10 @@ #include "Parser.h" #include "RegExpCache.h" #include +#if ENABLE(REGEXP_TRACING) +#include "RegExp.h" +#endif + #if ENABLE(JSC_MULTIPLE_THREADS) #include @@ -145,6 +149,9 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread , cachedUTCOffset(NaN) , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth) , m_regExpCache(new RegExpCache(this)) +#if ENABLE(REGEXP_TRACING) + , m_rtTraceList(new RTTraceList()) +#endif #ifndef NDEBUG , exclusiveThread(0) #endif @@ -218,6 +225,9 @@ JSGlobalData::~JSGlobalData() delete clientData; delete m_regExpCache; +#if ENABLE(REGEXP_TRACING) + delete m_rtTraceList; +#endif } PassRefPtr JSGlobalData::createContextGroup(ThreadStackType type) @@ -301,4 +311,38 @@ void JSGlobalData::dumpSampleData(ExecState* exec) interpreter->dumpSampleData(exec); } + +#if ENABLE(REGEXP_TRACING) +void JSGlobalData::addRegExpToTrace(PassRefPtr regExp) +{ + m_rtTraceList->add(regExp); +} + +void JSGlobalData::dumpRegExpTrace() +{ + // The first RegExp object is ignored. It is create by the RegExpPrototype ctor and not used. + RTTraceList::iterator iter = ++m_rtTraceList->begin(); + + if (iter != m_rtTraceList->end()) { + printf("\nRegExp Tracing\n"); + printf(" match() matches\n"); + printf("Regular Expression JIT Address calls found\n"); + printf("----------------------------------------+----------------+----------+----------\n"); + + unsigned reCount = 0; + + for (; iter != m_rtTraceList->end(); ++iter, ++reCount) + (*iter)->printTraceData(); + + printf("%d Regular Expressions\n", reCount); + } + + m_rtTraceList->clear(); +} +#else +void JSGlobalData::dumpRegExpTrace() +{ +} +#endif + } // namespace JSC -- cgit v1.1