From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/cssjit/SelectorCompiler.h | 45 ++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'Source/WebCore/cssjit/SelectorCompiler.h') 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 +#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(executableAddress); +} -inline SimpleSelectorChecker simpleSelectorCheckerFunction(void* executableAddress, SelectorCompilationStatus compilationStatus) +inline QuerySelectorSimpleSelectorChecker querySelectorSimpleSelectorCheckerFunction(void* executableAddress, SelectorCompilationStatus compilationStatus) { ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SimpleSelectorChecker); - return reinterpret_cast(executableAddress); + return reinterpret_cast(executableAddress); } -inline SelectorCheckerWithCheckingContext selectorCheckerFunctionWithCheckingContext(void* executableAddress, SelectorCompilationStatus compilationStatus) +inline RuleCollectorSelectorCheckerWithCheckingContext ruleCollectorSelectorCheckerFunctionWithCheckingContext(void* executableAddress, SelectorCompilationStatus compilationStatus) { ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext); - return reinterpret_cast(executableAddress); + return reinterpret_cast(executableAddress); } +inline QuerySelectorSelectorCheckerWithCheckingContext querySelectorSelectorCheckerFunctionWithCheckingContext(void* executableAddress, SelectorCompilationStatus compilationStatus) +{ + ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext); + return reinterpret_cast(executableAddress); +} } // namespace SelectorCompiler } // namespace WebCore #endif // ENABLE(CSS_SELECTOR_JIT) - -#endif // SelectorCompiler_h -- cgit v1.2.1