- Revision
- 170921
- Author
- achristen...@apple.com
- Date
- 2014-07-09 10:49:59 -0700 (Wed, 09 Jul 2014)
Log Message
Added css jit profiler, disabled by default.
https://bugs.webkit.org/show_bug.cgi?id=134695
Reviewed by Benjamin Poulain.
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::ruleMatches):
Tell the RuleData when its compiled selector is used.
* css/RuleSet.cpp:
(WebCore::RuleData::RuleData):
Initialize the compiled selector use count to 0.
* css/RuleSet.h:
(WebCore::RuleData::~RuleData):
(WebCore::RuleData::compiledSelectorUsed):
Count and log the number of times a compiled selector is used.
* cssjit/SelectorCompiler.h:
Added option for CSS_SELECTOR_JIT_PROFILING set to 0 by default.
* dom/SelectorQuery.cpp:
(WebCore::SelectorDataList::executeCompiledSimpleSelectorChecker):
(WebCore::SelectorDataList::execute):
Tell the SelectorData when its compiled selector is used.
* dom/SelectorQuery.h:
(WebCore::SelectorDataList::SelectorData::SelectorData):
(WebCore::SelectorDataList::SelectorData::~SelectorData):
(WebCore::SelectorDataList::SelectorData::compiledSelectorUsed):
Count and log the number of times a compiled selector is used.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170920 => 170921)
--- trunk/Source/WebCore/ChangeLog 2014-07-09 17:17:16 UTC (rev 170920)
+++ trunk/Source/WebCore/ChangeLog 2014-07-09 17:49:59 UTC (rev 170921)
@@ -1,3 +1,32 @@
+2014-07-09 Alex Christensen <achristen...@webkit.org>
+
+ Added css jit profiler, disabled by default.
+ https://bugs.webkit.org/show_bug.cgi?id=134695
+
+ Reviewed by Benjamin Poulain.
+
+ * css/ElementRuleCollector.cpp:
+ (WebCore::ElementRuleCollector::ruleMatches):
+ Tell the RuleData when its compiled selector is used.
+ * css/RuleSet.cpp:
+ (WebCore::RuleData::RuleData):
+ Initialize the compiled selector use count to 0.
+ * css/RuleSet.h:
+ (WebCore::RuleData::~RuleData):
+ (WebCore::RuleData::compiledSelectorUsed):
+ Count and log the number of times a compiled selector is used.
+ * cssjit/SelectorCompiler.h:
+ Added option for CSS_SELECTOR_JIT_PROFILING set to 0 by default.
+ * dom/SelectorQuery.cpp:
+ (WebCore::SelectorDataList::executeCompiledSimpleSelectorChecker):
+ (WebCore::SelectorDataList::execute):
+ Tell the SelectorData when its compiled selector is used.
+ * dom/SelectorQuery.h:
+ (WebCore::SelectorDataList::SelectorData::SelectorData):
+ (WebCore::SelectorDataList::SelectorData::~SelectorData):
+ (WebCore::SelectorDataList::SelectorData::compiledSelectorUsed):
+ Count and log the number of times a compiled selector is used.
+
2014-07-09 Eric Carlson <eric.carl...@apple.com>
[iOS] caption size is sometimes incorrect in fullscreen
Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (170920 => 170921)
--- trunk/Source/WebCore/css/ElementRuleCollector.cpp 2014-07-09 17:17:16 UTC (rev 170920)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp 2014-07-09 17:49:59 UTC (rev 170921)
@@ -303,6 +303,9 @@
if (ruleData.compilationStatus() == SelectorCompilationStatus::SimpleSelectorChecker) {
SelectorCompiler::SimpleSelectorChecker selectorChecker = SelectorCompiler::simpleSelectorCheckerFunction(compiledSelectorChecker, ruleData.compilationStatus());
+#if CSS_SELECTOR_JIT_PROFILING
+ ruleData.compiledSelectorUsed();
+#endif
return selectorChecker(&m_element);
}
ASSERT(ruleData.compilationStatus() == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
@@ -311,6 +314,9 @@
SelectorCompiler::CheckingContext context;
context.elementStyle = m_style;
context.resolvingMode = m_mode;
+#if CSS_SELECTOR_JIT_PROFILING
+ ruleData.compiledSelectorUsed();
+#endif
return selectorChecker(&m_element, &context);
}
#endif // ENABLE(CSS_SELECTOR_JIT)
Modified: trunk/Source/WebCore/css/RuleSet.cpp (170920 => 170921)
--- trunk/Source/WebCore/css/RuleSet.cpp 2014-07-09 17:17:16 UTC (rev 170920)
+++ trunk/Source/WebCore/css/RuleSet.cpp 2014-07-09 17:49:59 UTC (rev 170921)
@@ -140,6 +140,9 @@
, m_linkMatchType(SelectorChecker::determineLinkMatchType(selector()))
, m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin)
, m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selector()))
+#if ENABLE(CSS_SELECTOR_JIT) && CSS_SELECTOR_JIT_PROFILING
+ , m_compiledSelectorUseCount(0)
+#endif
{
ASSERT(m_position == position);
ASSERT(m_selectorIndex == selectorIndex);
Modified: trunk/Source/WebCore/css/RuleSet.h (170920 => 170921)
--- trunk/Source/WebCore/css/RuleSet.h 2014-07-09 17:17:16 UTC (rev 170920)
+++ trunk/Source/WebCore/css/RuleSet.h 2014-07-09 17:49:59 UTC (rev 170921)
@@ -29,6 +29,7 @@
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/text/AtomicString.h>
+#include <wtf/text/CString.h>
namespace WebCore {
@@ -85,6 +86,14 @@
m_compilationStatus = status;
m_compiledSelectorCodeRef = codeRef;
}
+#if CSS_SELECTOR_JIT_PROFILING
+ ~RuleData()
+ {
+ if (m_compiledSelectorCodeRef.code().executableAddress())
+ dataLogF("RuleData compiled selector %d \"%s\"\n", m_compiledSelectorUseCount, selector()->selectorText().utf8().data());
+ }
+ void compiledSelectorUsed() const { m_compiledSelectorUseCount++; }
+#endif
#endif // ENABLE(CSS_SELECTOR_JIT)
private:
@@ -106,6 +115,9 @@
#if ENABLE(CSS_SELECTOR_JIT)
mutable SelectorCompilationStatus m_compilationStatus;
mutable JSC::MacroAssemblerCodeRef m_compiledSelectorCodeRef;
+#if CSS_SELECTOR_JIT_PROFILING
+ mutable unsigned m_compiledSelectorUseCount;
+#endif
#endif // ENABLE(CSS_SELECTOR_JIT)
};
@@ -114,6 +126,9 @@
unsigned compilationStatus;
void* compiledSelectorPointer;
void* codeRefPtr;
+#if CSS_SELECTOR_JIT_PROFILING
+ unsigned compiledSelectorUseCount;
+#endif
#endif // ENABLE(CSS_SELECTOR_JIT)
void* a;
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.h (170920 => 170921)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.h 2014-07-09 17:17:16 UTC (rev 170920)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.h 2014-07-09 17:49:59 UTC (rev 170921)
@@ -31,6 +31,8 @@
#include "SelectorChecker.h"
#include <_javascript_Core/MacroAssemblerCodeRef.h>
+#define CSS_SELECTOR_JIT_PROFILING 0
+
namespace JSC {
class MacroAssemblerCodeRef;
class VM;
Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (170920 => 170921)
--- trunk/Source/WebCore/dom/SelectorQuery.cpp 2014-07-09 17:17:16 UTC (rev 170920)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp 2014-07-09 17:49:59 UTC (rev 170921)
@@ -361,9 +361,14 @@
#if ENABLE(CSS_SELECTOR_JIT)
template <typename SelectorQueryTrait>
-ALWAYS_INLINE void SelectorDataList::executeCompiledSimpleSelectorChecker(const ContainerNode& rootNode, SelectorCompiler::SimpleSelectorChecker selectorChecker, typename SelectorQueryTrait::OutputType& output) const
+ALWAYS_INLINE void SelectorDataList::executeCompiledSimpleSelectorChecker(const ContainerNode& rootNode, SelectorCompiler::SimpleSelectorChecker selectorChecker, typename SelectorQueryTrait::OutputType& output, const SelectorData& selectorData) const
{
for (auto& element : elementDescendants(const_cast<ContainerNode&>(rootNode))) {
+#if CSS_SELECTOR_JIT_PROFILING
+ selectorData.compiledSelectorUsed();
+#else
+ UNUSED_PARAM(selectorData);
+#endif
if (selectorChecker(&element)) {
SelectorQueryTrait::appendOutputForElement(output, &element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
@@ -435,7 +440,7 @@
const SelectorData& selectorData = m_selectors.first();
void* compiledSelectorChecker = selectorData.compiledSelectorCodeRef.code().executableAddress();
SelectorCompiler::SimpleSelectorChecker selectorChecker = SelectorCompiler::simpleSelectorCheckerFunction(compiledSelectorChecker, selectorData.compilationStatus);
- executeCompiledSimpleSelectorChecker<SelectorQueryTrait>(*searchRootNode, selectorChecker, output);
+ executeCompiledSimpleSelectorChecker<SelectorQueryTrait>(*searchRootNode, selectorChecker, output, selectorData);
break;
}
#else
Modified: trunk/Source/WebCore/dom/SelectorQuery.h (170920 => 170921)
--- trunk/Source/WebCore/dom/SelectorQuery.h 2014-07-09 17:17:16 UTC (rev 170920)
+++ trunk/Source/WebCore/dom/SelectorQuery.h 2014-07-09 17:49:59 UTC (rev 170921)
@@ -32,6 +32,7 @@
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
#include <wtf/text/AtomicStringHash.h>
+#include <wtf/text/CString.h>
namespace WebCore {
@@ -55,6 +56,9 @@
struct SelectorData {
SelectorData(const CSSSelector* selector, bool isFastCheckable)
: selector(selector)
+#if ENABLE(CSS_SELECTOR_JIT) && CSS_SELECTOR_JIT_PROFILING
+ , m_compiledSelectorUseCount(0)
+#endif
, isFastCheckable(isFastCheckable)
{
}
@@ -63,6 +67,15 @@
#if ENABLE(CSS_SELECTOR_JIT)
mutable JSC::MacroAssemblerCodeRef compiledSelectorCodeRef;
mutable SelectorCompilationStatus compilationStatus;
+#if CSS_SELECTOR_JIT_PROFILING
+ ~SelectorData()
+ {
+ if (compiledSelectorCodeRef.code().executableAddress())
+ dataLogF("SelectorData compiled selector %d \"%s\"\n", m_compiledSelectorUseCount, selector->selectorText().utf8().data());
+ }
+ mutable unsigned m_compiledSelectorUseCount;
+ void compiledSelectorUsed() const { m_compiledSelectorUseCount++; }
+#endif
#endif // ENABLE(CSS_SELECTOR_JIT)
bool isFastCheckable;
};
@@ -76,7 +89,7 @@
template <typename SelectorQueryTrait> void executeSingleSelectorData(const ContainerNode& rootNode, const SelectorData&, typename SelectorQueryTrait::OutputType&) const;
template <typename SelectorQueryTrait> void executeSingleMultiSelectorData(const ContainerNode& rootNode, typename SelectorQueryTrait::OutputType&) const;
#if ENABLE(CSS_SELECTOR_JIT)
- template <typename SelectorQueryTrait> void executeCompiledSimpleSelectorChecker(const ContainerNode& rootNode, SelectorCompiler::SimpleSelectorChecker, typename SelectorQueryTrait::OutputType&) const;
+ template <typename SelectorQueryTrait> void executeCompiledSimpleSelectorChecker(const ContainerNode& rootNode, SelectorCompiler::SimpleSelectorChecker, typename SelectorQueryTrait::OutputType&, const SelectorData&) const;
#endif // ENABLE(CSS_SELECTOR_JIT)
Vector<SelectorData> m_selectors;