diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/cssjit/SelectorCompiler.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/cssjit/SelectorCompiler.h')
-rw-r--r-- | Source/WebCore/cssjit/SelectorCompiler.h | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/Source/WebCore/cssjit/SelectorCompiler.h b/Source/WebCore/cssjit/SelectorCompiler.h index 71878b7a4..8d3805f7d 100644 --- a/Source/WebCore/cssjit/SelectorCompiler.h +++ b/Source/WebCore/cssjit/SelectorCompiler.h @@ -23,14 +23,15 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SelectorCompiler_h -#define SelectorCompiler_h +#pragma once #if ENABLE(CSS_SELECTOR_JIT) #include "SelectorChecker.h" #include <JavaScriptCore/MacroAssemblerCodeRef.h> +#define CSS_SELECTOR_JIT_PROFILING 0 + namespace JSC { class MacroAssemblerCodeRef; class VM; @@ -67,31 +68,47 @@ private: namespace SelectorCompiler { -struct CheckingContext { - SelectorChecker::Mode resolvingMode; - RenderStyle* elementStyle; +enum class SelectorContext { + // Rule Collector needs a resolvingMode and can modify the tree as it matches. + RuleCollector, + + // Query Selector does not modify the tree and never match :visited. + QuerySelector }; -typedef unsigned (*SimpleSelectorChecker)(Element*); -typedef unsigned (*SelectorCheckerWithCheckingContext)(Element*, const CheckingContext*); -SelectorCompilationStatus compileSelector(const CSSSelector*, JSC::VM*, JSC::MacroAssemblerCodeRef& outputCodeRef); +typedef unsigned (*RuleCollectorSimpleSelectorChecker)(const Element*, unsigned*); +typedef unsigned (*QuerySelectorSimpleSelectorChecker)(const Element*); + +typedef unsigned (*RuleCollectorSelectorCheckerWithCheckingContext)(const Element*, SelectorChecker::CheckingContext*, unsigned*); +typedef unsigned (*QuerySelectorSelectorCheckerWithCheckingContext)(const Element*, const SelectorChecker::CheckingContext*); + +SelectorCompilationStatus compileSelector(const CSSSelector*, JSC::VM*, SelectorContext, JSC::MacroAssemblerCodeRef& outputCodeRef); + +inline RuleCollectorSimpleSelectorChecker ruleCollectorSimpleSelectorCheckerFunction(void* executableAddress, SelectorCompilationStatus compilationStatus) +{ + ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SimpleSelectorChecker); + return reinterpret_cast<RuleCollectorSimpleSelectorChecker>(executableAddress); +} -inline SimpleSelectorChecker simpleSelectorCheckerFunction(void* executableAddress, SelectorCompilationStatus compilationStatus) +inline QuerySelectorSimpleSelectorChecker querySelectorSimpleSelectorCheckerFunction(void* executableAddress, SelectorCompilationStatus compilationStatus) { ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SimpleSelectorChecker); - return reinterpret_cast<SimpleSelectorChecker>(executableAddress); + return reinterpret_cast<QuerySelectorSimpleSelectorChecker>(executableAddress); } -inline SelectorCheckerWithCheckingContext selectorCheckerFunctionWithCheckingContext(void* executableAddress, SelectorCompilationStatus compilationStatus) +inline RuleCollectorSelectorCheckerWithCheckingContext ruleCollectorSelectorCheckerFunctionWithCheckingContext(void* executableAddress, SelectorCompilationStatus compilationStatus) { ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext); - return reinterpret_cast<SelectorCheckerWithCheckingContext>(executableAddress); + return reinterpret_cast<RuleCollectorSelectorCheckerWithCheckingContext>(executableAddress); } +inline QuerySelectorSelectorCheckerWithCheckingContext querySelectorSelectorCheckerFunctionWithCheckingContext(void* executableAddress, SelectorCompilationStatus compilationStatus) +{ + ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext); + return reinterpret_cast<QuerySelectorSelectorCheckerWithCheckingContext>(executableAddress); +} } // namespace SelectorCompiler } // namespace WebCore #endif // ENABLE(CSS_SELECTOR_JIT) - -#endif // SelectorCompiler_h |