Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (270966 => 270967)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2020-12-18 10:09:30 UTC (rev 270966)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2020-12-18 10:27:00 UTC (rev 270967)
@@ -1624,7 +1624,7 @@
jmp a2, HostFunctionPtrTag
# unsigned vmEntryToCSSJIT(uintptr_t, uintptr_t, uintptr_t, const void* codePtr);
-if ARM64 or ARM64E
+if ARM64E
emit ".globl _vmEntryToCSSJIT"
emit "_vmEntryToCSSJIT:"
functionPrologue()
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (270966 => 270967)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2020-12-18 10:09:30 UTC (rev 270966)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2020-12-18 10:27:00 UTC (rev 270967)
@@ -1447,6 +1447,8 @@
generateSelectorChecker();
break;
case FunctionType::CannotMatchAnything:
+ if (!JSC::Options::useJITCage())
+ m_assembler.tagReturnAddress();
m_assembler.move(Assembler::TrustedImm32(0), returnRegister);
generateReturn();
break;
@@ -1949,11 +1951,13 @@
inline void SelectorCodeGenerator::generateReturn()
{
-#if CPU(ARM64)
- m_assembler.farJump(Assembler::TrustedImmPtr(retagCodePtr<void*, CFunctionPtrTag, JSC::OperationPtrTag>(&vmEntryToCSSJITAfter)), JSC::OperationPtrTag);
-#else
+#if CPU(ARM64E)
+ if (JSC::Options::useJITCage()) {
+ m_assembler.farJump(Assembler::TrustedImmPtr(retagCodePtr<void*, CFunctionPtrTag, JSC::OperationPtrTag>(&vmEntryToCSSJITAfter)), JSC::OperationPtrTag);
+ return;
+ }
+#endif
m_assembler.ret();
-#endif
}
static bool isAdjacentRelation(FragmentRelation relation)
@@ -1968,6 +1972,8 @@
void SelectorCodeGenerator::generateSelectorChecker()
{
+ if (!JSC::Options::useJITCage())
+ m_assembler.tagReturnAddress();
pushMacroAssemblerRegisters();
StackAllocator earlyFailureStack = m_stackAllocator;
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.h (270966 => 270967)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.h 2020-12-18 10:09:30 UTC (rev 270966)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.h 2020-12-18 10:27:00 UTC (rev 270967)
@@ -29,6 +29,7 @@
#include "CompiledSelector.h"
#include "SelectorChecker.h"
+#include <_javascript_Core/VM.h>
namespace WebCore {
@@ -47,51 +48,53 @@
void compileSelector(CompiledSelector&, const CSSSelector*, SelectorContext);
+#if CPU(ARM64E)
extern "C" unsigned vmEntryToCSSJIT(uintptr_t, uintptr_t, uintptr_t, const void* codePtr);
extern "C" void vmEntryToCSSJITAfter(void);
+#endif
inline unsigned ruleCollectorSimpleSelectorChecker(CompiledSelector& compiledSelector, const Element* element, unsigned* value)
{
ASSERT(compiledSelector.status == SelectorCompilationStatus::SimpleSelectorChecker);
-#if CPU(ARM64)
- return vmEntryToCSSJIT(bitwise_cast<uintptr_t>(element), bitwise_cast<uintptr_t>(value), 0, compiledSelector.codeRef.code().executableAddress());
-#else
- typedef unsigned (*RuleCollectorSimpleSelectorChecker)(const Element*, unsigned*);
+#if CPU(ARM64E)
+ if (JSC::Options::useJITCage())
+ return vmEntryToCSSJIT(bitwise_cast<uintptr_t>(element), bitwise_cast<uintptr_t>(value), 0, compiledSelector.codeRef.code().executableAddress());
+#endif
+ using RuleCollectorSimpleSelectorChecker = unsigned(*)(const Element*, unsigned*);
return WTF::untagCFunctionPtr<RuleCollectorSimpleSelectorChecker, JSC::CSSSelectorPtrTag>(compiledSelector.codeRef.code().executableAddress())(element, value);
-#endif
}
inline unsigned querySelectorSimpleSelectorChecker(CompiledSelector& compiledSelector, const Element* element)
{
ASSERT(compiledSelector.status == SelectorCompilationStatus::SimpleSelectorChecker);
-#if CPU(ARM64)
- return vmEntryToCSSJIT(bitwise_cast<uintptr_t>(element), 0, 0, compiledSelector.codeRef.code().executableAddress());
-#else
- typedef unsigned (*QuerySelectorSimpleSelectorChecker)(const Element*);
+#if CPU(ARM64E)
+ if (JSC::Options::useJITCage())
+ return vmEntryToCSSJIT(bitwise_cast<uintptr_t>(element), 0, 0, compiledSelector.codeRef.code().executableAddress());
+#endif
+ using QuerySelectorSimpleSelectorChecker = unsigned(*)(const Element*);
return WTF::untagCFunctionPtr<QuerySelectorSimpleSelectorChecker, JSC::CSSSelectorPtrTag>(compiledSelector.codeRef.code().executableAddress())(element);
-#endif
}
inline unsigned ruleCollectorSelectorCheckerWithCheckingContext(CompiledSelector& compiledSelector, const Element* element, SelectorChecker::CheckingContext* context, unsigned* value)
{
ASSERT(compiledSelector.status == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
-#if CPU(ARM64)
- return vmEntryToCSSJIT(bitwise_cast<uintptr_t>(element), bitwise_cast<uintptr_t>(context), bitwise_cast<uintptr_t>(value), compiledSelector.codeRef.code().executableAddress());
-#else
- typedef unsigned (*RuleCollectorSelectorCheckerWithCheckingContext)(const Element*, SelectorChecker::CheckingContext*, unsigned*);
+#if CPU(ARM64E)
+ if (JSC::Options::useJITCage())
+ return vmEntryToCSSJIT(bitwise_cast<uintptr_t>(element), bitwise_cast<uintptr_t>(context), bitwise_cast<uintptr_t>(value), compiledSelector.codeRef.code().executableAddress());
+#endif
+ using RuleCollectorSelectorCheckerWithCheckingContext = unsigned(*)(const Element*, SelectorChecker::CheckingContext*, unsigned*);
return WTF::untagCFunctionPtr<RuleCollectorSelectorCheckerWithCheckingContext, JSC::CSSSelectorPtrTag>(compiledSelector.codeRef.code().executableAddress())(element, context, value);
-#endif
}
inline unsigned querySelectorSelectorCheckerWithCheckingContext(CompiledSelector& compiledSelector, const Element* element, const SelectorChecker::CheckingContext* context)
{
ASSERT(compiledSelector.status == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
-#if CPU(ARM64)
- return vmEntryToCSSJIT(bitwise_cast<uintptr_t>(element), bitwise_cast<uintptr_t>(context), 0, compiledSelector.codeRef.code().executableAddress());
-#else
- typedef unsigned (*QuerySelectorSelectorCheckerWithCheckingContext)(const Element*, const SelectorChecker::CheckingContext*);
+#if CPU(ARM64E)
+ if (JSC::Options::useJITCage())
+ return vmEntryToCSSJIT(bitwise_cast<uintptr_t>(element), bitwise_cast<uintptr_t>(context), 0, compiledSelector.codeRef.code().executableAddress());
+#endif
+ using QuerySelectorSelectorCheckerWithCheckingContext = unsigned(*)(const Element*, const SelectorChecker::CheckingContext*);
return WTF::untagCFunctionPtr<QuerySelectorSelectorCheckerWithCheckingContext, JSC::CSSSelectorPtrTag>(compiledSelector.codeRef.code().executableAddress())(element, context);
-#endif
}
} // namespace SelectorCompiler