Title: [270967] trunk/Source
Revision
270967
Author
[email protected]
Date
2020-12-18 02:27:00 -0800 (Fri, 18 Dec 2020)

Log Message

[CSSJIT] Do not use trampoline if JITCage is disabled
https://bugs.webkit.org/show_bug.cgi?id=220004

Reviewed by Tadeu Zagallo.

Source/_javascript_Core:

* llint/LLIntData.cpp:
* llint/LowLevelInterpreter.asm:

Source/WebCore:

This trampoline is not necessary if JITCage is not enabled.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateReturn):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
* cssjit/SelectorCompiler.h:
(WebCore::SelectorCompiler::ruleCollectorSimpleSelectorChecker):
(WebCore::SelectorCompiler::querySelectorSimpleSelectorChecker):
(WebCore::SelectorCompiler::ruleCollectorSelectorCheckerWithCheckingContext):
(WebCore::SelectorCompiler::querySelectorSelectorCheckerWithCheckingContext):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (270966 => 270967)


--- trunk/Source/_javascript_Core/ChangeLog	2020-12-18 10:09:30 UTC (rev 270966)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-12-18 10:27:00 UTC (rev 270967)
@@ -1,3 +1,13 @@
+2020-12-18  Yusuke Suzuki  <[email protected]>
+
+        [CSSJIT] Do not use trampoline if JITCage is disabled
+        https://bugs.webkit.org/show_bug.cgi?id=220004
+
+        Reviewed by Tadeu Zagallo.
+
+        * llint/LLIntData.cpp:
+        * llint/LowLevelInterpreter.asm:
+
 2020-12-18  Dmitry Bezhetskov  <[email protected]>
 
         [WASM-References] Reuse instance initElementSegment to reduce duplication

Modified: trunk/Source/_javascript_Core/llint/LLIntData.cpp (270966 => 270967)


--- trunk/Source/_javascript_Core/llint/LLIntData.cpp	2020-12-18 10:09:30 UTC (rev 270966)
+++ trunk/Source/_javascript_Core/llint/LLIntData.cpp	2020-12-18 10:27:00 UTC (rev 270967)
@@ -62,7 +62,7 @@
 extern "C" void returnFromLLIntTrampoline(void);
 #endif
 
-#if ENABLE(CSS_SELECTOR_JIT) && CPU(ARM64)
+#if ENABLE(CSS_SELECTOR_JIT) && CPU(ARM64E)
 extern "C" void vmEntryToCSSJITAfter(void);
 JSC_ANNOTATE_JIT_OPERATION(_JITTarget_vmEntryToCSSJITAfter, vmEntryToCSSJITAfter);
 #endif

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/ChangeLog (270966 => 270967)


--- trunk/Source/WebCore/ChangeLog	2020-12-18 10:09:30 UTC (rev 270966)
+++ trunk/Source/WebCore/ChangeLog	2020-12-18 10:27:00 UTC (rev 270967)
@@ -1,3 +1,22 @@
+2020-12-18  Yusuke Suzuki  <[email protected]>
+
+        [CSSJIT] Do not use trampoline if JITCage is disabled
+        https://bugs.webkit.org/show_bug.cgi?id=220004
+
+        Reviewed by Tadeu Zagallo.
+
+        This trampoline is not necessary if JITCage is not enabled.
+
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateReturn):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
+        * cssjit/SelectorCompiler.h:
+        (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorChecker):
+        (WebCore::SelectorCompiler::querySelectorSimpleSelectorChecker):
+        (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerWithCheckingContext):
+        (WebCore::SelectorCompiler::querySelectorSelectorCheckerWithCheckingContext):
+
 2020-12-17  Kimmo Kinnunen  <[email protected]>
 
         REGRESSION (r268386): Snapshots of WebGL content in the tab picker don't work (black map on Google Maps)

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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to