<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170921] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170921">170921</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2014-07-09 10:49:59 -0700 (Wed, 09 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssElementRuleCollectorcpp">trunk/Source/WebCore/css/ElementRuleCollector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssRuleSetcpp">trunk/Source/WebCore/css/RuleSet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssRuleSeth">trunk/Source/WebCore/css/RuleSet.h</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilerh">trunk/Source/WebCore/cssjit/SelectorCompiler.h</a></li>
<li><a href="#trunkSourceWebCoredomSelectorQuerycpp">trunk/Source/WebCore/dom/SelectorQuery.cpp</a></li>
<li><a href="#trunkSourceWebCoredomSelectorQueryh">trunk/Source/WebCore/dom/SelectorQuery.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170920 => 170921)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-07-09 Alex Christensen <achristensen@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.
+
</ins><span class="cx"> 2014-07-09 Eric Carlson <eric.carlson@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] caption size is sometimes incorrect in fullscreen
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (170920 => 170921)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -303,6 +303,9 @@
</span><span class="cx">
</span><span class="cx"> if (ruleData.compilationStatus() == SelectorCompilationStatus::SimpleSelectorChecker) {
</span><span class="cx"> SelectorCompiler::SimpleSelectorChecker selectorChecker = SelectorCompiler::simpleSelectorCheckerFunction(compiledSelectorChecker, ruleData.compilationStatus());
</span><ins>+#if CSS_SELECTOR_JIT_PROFILING
+ ruleData.compiledSelectorUsed();
+#endif
</ins><span class="cx"> return selectorChecker(&m_element);
</span><span class="cx"> }
</span><span class="cx"> ASSERT(ruleData.compilationStatus() == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
</span><span class="lines">@@ -311,6 +314,9 @@
</span><span class="cx"> SelectorCompiler::CheckingContext context;
</span><span class="cx"> context.elementStyle = m_style;
</span><span class="cx"> context.resolvingMode = m_mode;
</span><ins>+#if CSS_SELECTOR_JIT_PROFILING
+ ruleData.compiledSelectorUsed();
+#endif
</ins><span class="cx"> return selectorChecker(&m_element, &context);
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span></span></pre></div>
<a id="trunkSourceWebCorecssRuleSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleSet.cpp (170920 => 170921)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -140,6 +140,9 @@
</span><span class="cx"> , m_linkMatchType(SelectorChecker::determineLinkMatchType(selector()))
</span><span class="cx"> , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin)
</span><span class="cx"> , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selector()))
</span><ins>+#if ENABLE(CSS_SELECTOR_JIT) && CSS_SELECTOR_JIT_PROFILING
+ , m_compiledSelectorUseCount(0)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_position == position);
</span><span class="cx"> ASSERT(m_selectorIndex == selectorIndex);
</span></span></pre></div>
<a id="trunkSourceWebCorecssRuleSeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleSet.h (170920 => 170921)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/text/AtomicString.h>
</span><ins>+#include <wtf/text/CString.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -85,6 +86,14 @@
</span><span class="cx"> m_compilationStatus = status;
</span><span class="cx"> m_compiledSelectorCodeRef = codeRef;
</span><span class="cx"> }
</span><ins>+#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
</ins><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -106,6 +115,9 @@
</span><span class="cx"> #if ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx"> mutable SelectorCompilationStatus m_compilationStatus;
</span><span class="cx"> mutable JSC::MacroAssemblerCodeRef m_compiledSelectorCodeRef;
</span><ins>+#if CSS_SELECTOR_JIT_PROFILING
+ mutable unsigned m_compiledSelectorUseCount;
+#endif
</ins><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -114,6 +126,9 @@
</span><span class="cx"> unsigned compilationStatus;
</span><span class="cx"> void* compiledSelectorPointer;
</span><span class="cx"> void* codeRefPtr;
</span><ins>+#if CSS_SELECTOR_JIT_PROFILING
+ unsigned compiledSelectorUseCount;
+#endif
</ins><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx">
</span><span class="cx"> void* a;
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.h (170920 => 170921)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> #include "SelectorChecker.h"
</span><span class="cx"> #include <JavaScriptCore/MacroAssemblerCodeRef.h>
</span><span class="cx">
</span><ins>+#define CSS_SELECTOR_JIT_PROFILING 0
+
</ins><span class="cx"> namespace JSC {
</span><span class="cx"> class MacroAssemblerCodeRef;
</span><span class="cx"> class VM;
</span></span></pre></div>
<a id="trunkSourceWebCoredomSelectorQuerycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (170920 => 170921)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -361,9 +361,14 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx"> template <typename SelectorQueryTrait>
</span><del>-ALWAYS_INLINE void SelectorDataList::executeCompiledSimpleSelectorChecker(const ContainerNode& rootNode, SelectorCompiler::SimpleSelectorChecker selectorChecker, typename SelectorQueryTrait::OutputType& output) const
</del><ins>+ALWAYS_INLINE void SelectorDataList::executeCompiledSimpleSelectorChecker(const ContainerNode& rootNode, SelectorCompiler::SimpleSelectorChecker selectorChecker, typename SelectorQueryTrait::OutputType& output, const SelectorData& selectorData) const
</ins><span class="cx"> {
</span><span class="cx"> for (auto& element : elementDescendants(const_cast<ContainerNode&>(rootNode))) {
</span><ins>+#if CSS_SELECTOR_JIT_PROFILING
+ selectorData.compiledSelectorUsed();
+#else
+ UNUSED_PARAM(selectorData);
+#endif
</ins><span class="cx"> if (selectorChecker(&element)) {
</span><span class="cx"> SelectorQueryTrait::appendOutputForElement(output, &element);
</span><span class="cx"> if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
</span><span class="lines">@@ -435,7 +440,7 @@
</span><span class="cx"> const SelectorData& selectorData = m_selectors.first();
</span><span class="cx"> void* compiledSelectorChecker = selectorData.compiledSelectorCodeRef.code().executableAddress();
</span><span class="cx"> SelectorCompiler::SimpleSelectorChecker selectorChecker = SelectorCompiler::simpleSelectorCheckerFunction(compiledSelectorChecker, selectorData.compilationStatus);
</span><del>- executeCompiledSimpleSelectorChecker<SelectorQueryTrait>(*searchRootNode, selectorChecker, output);
</del><ins>+ executeCompiledSimpleSelectorChecker<SelectorQueryTrait>(*searchRootNode, selectorChecker, output, selectorData);
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceWebCoredomSelectorQueryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/SelectorQuery.h (170920 => 170921)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx"> #include <wtf/text/AtomicStringHash.h>
</span><ins>+#include <wtf/text/CString.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -55,6 +56,9 @@
</span><span class="cx"> struct SelectorData {
</span><span class="cx"> SelectorData(const CSSSelector* selector, bool isFastCheckable)
</span><span class="cx"> : selector(selector)
</span><ins>+#if ENABLE(CSS_SELECTOR_JIT) && CSS_SELECTOR_JIT_PROFILING
+ , m_compiledSelectorUseCount(0)
+#endif
</ins><span class="cx"> , isFastCheckable(isFastCheckable)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -63,6 +67,15 @@
</span><span class="cx"> #if ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx"> mutable JSC::MacroAssemblerCodeRef compiledSelectorCodeRef;
</span><span class="cx"> mutable SelectorCompilationStatus compilationStatus;
</span><ins>+#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
</ins><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx"> bool isFastCheckable;
</span><span class="cx"> };
</span><span class="lines">@@ -76,7 +89,7 @@
</span><span class="cx"> template <typename SelectorQueryTrait> void executeSingleSelectorData(const ContainerNode& rootNode, const SelectorData&, typename SelectorQueryTrait::OutputType&) const;
</span><span class="cx"> template <typename SelectorQueryTrait> void executeSingleMultiSelectorData(const ContainerNode& rootNode, typename SelectorQueryTrait::OutputType&) const;
</span><span class="cx"> #if ENABLE(CSS_SELECTOR_JIT)
</span><del>- template <typename SelectorQueryTrait> void executeCompiledSimpleSelectorChecker(const ContainerNode& rootNode, SelectorCompiler::SimpleSelectorChecker, typename SelectorQueryTrait::OutputType&) const;
</del><ins>+ template <typename SelectorQueryTrait> void executeCompiledSimpleSelectorChecker(const ContainerNode& rootNode, SelectorCompiler::SimpleSelectorChecker, typename SelectorQueryTrait::OutputType&, const SelectorData&) const;
</ins><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx">
</span><span class="cx"> Vector<SelectorData> m_selectors;
</span></span></pre>
</div>
</div>
</body>
</html>