summaryrefslogtreecommitdiff
path: root/Source/WebCore/cssjit/SelectorCompiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/cssjit/SelectorCompiler.h')
-rw-r--r--Source/WebCore/cssjit/SelectorCompiler.h45
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