Title: [282569] branches/safari-612-branch/Source
Revision
282569
Author
[email protected]
Date
2021-09-16 11:48:10 -0700 (Thu, 16 Sep 2021)

Log Message

Cherry-pick r281544. rdar://problem/83183832

    Refactor ENABLE(JIT_OPERATION_VALIDATION) code to emit no code when disabled.
    https://bugs.webkit.org/show_bug.cgi?id=229482
    rdar://82318317

    Reviewed by Yusuke Suzuki.

    Source/_javascript_Core:

    * assembler/JITOperationList.cpp:
    (JSC::addPointers):
    (JSC::JITOperationList::populatePointersInJavaScriptCore):
    (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
    (JSC::JITOperationList::populatePointersInEmbedder):
    * assembler/JITOperationList.h:
    (JSC::JITOperationList::map const):
    (JSC::JITOperationList::assertIsJITOperation):
    (JSC::JITOperationList::initialize):
    (JSC::JITOperationList::populatePointersInJavaScriptCore):
    (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
    * runtime/JSCPtrTag.h:
    (JSC::tagJSCCodePtrImpl):
    (JSC::untagJSCCodePtrImpl):

    Source/WebCore:

    * bindings/js/WebCoreJITOperations.cpp:
    (WebCore::populateJITOperations):
    * bindings/js/WebCoreJITOperations.h:
    (WebCore::populateJITOperations):
    * testing/js/WebCoreTestSupport.cpp:
    (WebCoreTestSupport::populateJITOperations):
    * testing/js/WebCoreTestSupport.h:
    (WebCoreTestSupport::populateJITOperations):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281544 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/_javascript_Core/ChangeLog (282568 => 282569)


--- branches/safari-612-branch/Source/_javascript_Core/ChangeLog	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/_javascript_Core/ChangeLog	2021-09-16 18:48:10 UTC (rev 282569)
@@ -1,5 +1,70 @@
 2021-09-16  Russell Epstein  <[email protected]>
 
+        Cherry-pick r281544. rdar://problem/83183832
+
+    Refactor ENABLE(JIT_OPERATION_VALIDATION) code to emit no code when disabled.
+    https://bugs.webkit.org/show_bug.cgi?id=229482
+    rdar://82318317
+    
+    Reviewed by Yusuke Suzuki.
+    
+    Source/_javascript_Core:
+    
+    * assembler/JITOperationList.cpp:
+    (JSC::addPointers):
+    (JSC::JITOperationList::populatePointersInJavaScriptCore):
+    (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
+    (JSC::JITOperationList::populatePointersInEmbedder):
+    * assembler/JITOperationList.h:
+    (JSC::JITOperationList::map const):
+    (JSC::JITOperationList::assertIsJITOperation):
+    (JSC::JITOperationList::initialize):
+    (JSC::JITOperationList::populatePointersInJavaScriptCore):
+    (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
+    * runtime/JSCPtrTag.h:
+    (JSC::tagJSCCodePtrImpl):
+    (JSC::untagJSCCodePtrImpl):
+    
+    Source/WebCore:
+    
+    * bindings/js/WebCoreJITOperations.cpp:
+    (WebCore::populateJITOperations):
+    * bindings/js/WebCoreJITOperations.h:
+    (WebCore::populateJITOperations):
+    * testing/js/WebCoreTestSupport.cpp:
+    (WebCoreTestSupport::populateJITOperations):
+    * testing/js/WebCoreTestSupport.h:
+    (WebCoreTestSupport::populateJITOperations):
+    
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-08-24  Mark Lam  <[email protected]>
+
+            Refactor ENABLE(JIT_OPERATION_VALIDATION) code to emit no code when disabled.
+            https://bugs.webkit.org/show_bug.cgi?id=229482
+            rdar://82318317
+
+            Reviewed by Yusuke Suzuki.
+
+            * assembler/JITOperationList.cpp:
+            (JSC::addPointers):
+            (JSC::JITOperationList::populatePointersInJavaScriptCore):
+            (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
+            (JSC::JITOperationList::populatePointersInEmbedder):
+            * assembler/JITOperationList.h:
+            (JSC::JITOperationList::map const):
+            (JSC::JITOperationList::assertIsJITOperation):
+            (JSC::JITOperationList::initialize):
+            (JSC::JITOperationList::populatePointersInJavaScriptCore):
+            (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
+            * runtime/JSCPtrTag.h:
+            (JSC::tagJSCCodePtrImpl):
+            (JSC::untagJSCCodePtrImpl):
+
+2021-09-16  Russell Epstein  <[email protected]>
+
         Cherry-pick r281541. rdar://problem/83183498
 
     [Re-landing] Add some offlineasm enhancements.

Modified: branches/safari-612-branch/Source/_javascript_Core/assembler/JITOperationList.cpp (282568 => 282569)


--- branches/safari-612-branch/Source/_javascript_Core/assembler/JITOperationList.cpp	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/_javascript_Core/assembler/JITOperationList.cpp	2021-09-16 18:48:10 UTC (rev 282569)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,12 +36,12 @@
 
 namespace JSC {
 
+#if ENABLE(JIT_OPERATION_VALIDATION)
+
 LazyNeverDestroyed<JITOperationList> jitOperationList;
 
-#if ENABLE(JIT_OPERATION_VALIDATION)
 extern const uintptr_t startOfJITOperationsInJSC __asm("section$start$__DATA_CONST$__jsc_ops");
 extern const uintptr_t endOfJITOperationsInJSC __asm("section$end$__DATA_CONST$__jsc_ops");
-#endif
 
 void JITOperationList::initialize()
 {
@@ -48,7 +48,6 @@
     jitOperationList.construct();
 }
 
-#if ENABLE(JIT_OPERATION_VALIDATION)
 static SUPPRESS_ASAN ALWAYS_INLINE void addPointers(HashMap<void*, void*>& map, const uintptr_t* beginOperations, const uintptr_t* endOperations)
 {
 #if ENABLE(JIT_CAGE)
@@ -65,22 +64,18 @@
         }
     }
 }
-#endif
 
 void JITOperationList::populatePointersInJavaScriptCore()
 {
-#if ENABLE(JIT_OPERATION_VALIDATION)
     static std::once_flag onceKey;
     std::call_once(onceKey, [] {
         if (Options::useJIT())
             addPointers(jitOperationList->m_validatedOperations, &startOfJITOperationsInJSC, &endOfJITOperationsInJSC);
     });
-#endif
 }
 
 void JITOperationList::populatePointersInJavaScriptCoreForLLInt()
 {
-#if ENABLE(JIT_OPERATION_VALIDATION)
     static std::once_flag onceKey;
     std::call_once(onceKey, [] {
 
@@ -124,7 +119,6 @@
             addPointers(jitOperationList->m_validatedOperations, operations, operations + WTF_ARRAY_LENGTH(operations));
 #undef LLINT_RETURN_LOCATION
     });
-#endif
 }
 
 
@@ -132,10 +126,10 @@
 {
     UNUSED_PARAM(beginOperations);
     UNUSED_PARAM(endOperations);
-#if ENABLE(JIT_OPERATION_VALIDATION)
     if (Options::useJIT())
         addPointers(jitOperationList->m_validatedOperations, beginOperations, endOperations);
-#endif
 }
 
+#endif // ENABLE(JIT_OPERATION_VALIDATION)
+
 } // namespace JSC

Modified: branches/safari-612-branch/Source/_javascript_Core/assembler/JITOperationList.h (282568 => 282569)


--- branches/safari-612-branch/Source/_javascript_Core/assembler/JITOperationList.h	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/_javascript_Core/assembler/JITOperationList.h	2021-09-16 18:48:10 UTC (rev 282569)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,6 +32,8 @@
 
 namespace JSC {
 
+#if ENABLE(JIT_OPERATION_VALIDATION)
+
 class JITOperationList {
 public:
     static JITOperationList& instance();
@@ -39,11 +41,7 @@
 
     void* map(void* pointer) const
     {
-#if ENABLE(JIT_OPERATION_VALIDATION)
         return m_validatedOperations.get(removeCodePtrTag(pointer));
-#else
-        return pointer;
-#endif
     }
 
     static void populatePointersInJavaScriptCore();
@@ -54,9 +52,7 @@
     template<typename T> static void assertIsJITOperation(T function)
     {
         UNUSED_PARAM(function);
-#if ENABLE(JIT_OPERATION_VALIDATION)
         ASSERT(!Options::useJIT() || JITOperationList::instance().map(bitwise_cast<void*>(function)));
-#endif
     }
 
 private:
@@ -70,4 +66,18 @@
     return jitOperationList.get();
 }
 
+#else // not ENABLE(JIT_OPERATION_VALIDATION)
+
+class JITOperationList {
+public:
+    static void initialize() { }
+
+    static void populatePointersInJavaScriptCore() { }
+    static void populatePointersInJavaScriptCoreForLLInt() { }
+
+    template<typename T> static void assertIsJITOperation(T) { }
+};
+
+#endif // ENABLE(JIT_OPERATION_VALIDATION)
+
 } // namespace JSC

Modified: branches/safari-612-branch/Source/_javascript_Core/runtime/JSCPtrTag.h (282568 => 282569)


--- branches/safari-612-branch/Source/_javascript_Core/runtime/JSCPtrTag.h	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/_javascript_Core/runtime/JSCPtrTag.h	2021-09-16 18:48:10 UTC (rev 282569)
@@ -127,7 +127,7 @@
     static_assert(callerType == PtrTagCallerType::JIT);
     if constexpr (calleeType == PtrTagCalleeType::Native) {
         static_assert(tag == OperationPtrTag);
-        JITOperationList::instance().assertIsJITOperation(ptr);
+        JITOperationList::assertIsJITOperation(ptr);
 #if ENABLE(JIT_CAGE)
         if (Options::useJITCage())
             return bitwise_cast<PtrType>(JITOperationList::instance().map(bitwise_cast<void*>(ptr)));
@@ -145,7 +145,7 @@
     static_assert(callerType == PtrTagCallerType::JIT);
     if constexpr (calleeType == PtrTagCalleeType::Native) {
         static_assert(tag == OperationPtrTag);
-        JITOperationList::instance().assertIsJITOperation(ptr);
+        JITOperationList::assertIsJITOperation(ptr);
 #if ENABLE(JIT_CAGE)
         if (Options::useJITCage()) {
             RELEASE_ASSERT(bitwise_cast<PtrType>(JITOperationList::instance().map(bitwise_cast<void*>(ptr))) == ptr);

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (282568 => 282569)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-16 18:48:10 UTC (rev 282569)
@@ -1,3 +1,62 @@
+2021-09-16  Russell Epstein  <[email protected]>
+
+        Cherry-pick r281544. rdar://problem/83183832
+
+    Refactor ENABLE(JIT_OPERATION_VALIDATION) code to emit no code when disabled.
+    https://bugs.webkit.org/show_bug.cgi?id=229482
+    rdar://82318317
+    
+    Reviewed by Yusuke Suzuki.
+    
+    Source/_javascript_Core:
+    
+    * assembler/JITOperationList.cpp:
+    (JSC::addPointers):
+    (JSC::JITOperationList::populatePointersInJavaScriptCore):
+    (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
+    (JSC::JITOperationList::populatePointersInEmbedder):
+    * assembler/JITOperationList.h:
+    (JSC::JITOperationList::map const):
+    (JSC::JITOperationList::assertIsJITOperation):
+    (JSC::JITOperationList::initialize):
+    (JSC::JITOperationList::populatePointersInJavaScriptCore):
+    (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
+    * runtime/JSCPtrTag.h:
+    (JSC::tagJSCCodePtrImpl):
+    (JSC::untagJSCCodePtrImpl):
+    
+    Source/WebCore:
+    
+    * bindings/js/WebCoreJITOperations.cpp:
+    (WebCore::populateJITOperations):
+    * bindings/js/WebCoreJITOperations.h:
+    (WebCore::populateJITOperations):
+    * testing/js/WebCoreTestSupport.cpp:
+    (WebCoreTestSupport::populateJITOperations):
+    * testing/js/WebCoreTestSupport.h:
+    (WebCoreTestSupport::populateJITOperations):
+    
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-08-24  Mark Lam  <[email protected]>
+
+            Refactor ENABLE(JIT_OPERATION_VALIDATION) code to emit no code when disabled.
+            https://bugs.webkit.org/show_bug.cgi?id=229482
+            rdar://82318317
+
+            Reviewed by Yusuke Suzuki.
+
+            * bindings/js/WebCoreJITOperations.cpp:
+            (WebCore::populateJITOperations):
+            * bindings/js/WebCoreJITOperations.h:
+            (WebCore::populateJITOperations):
+            * testing/js/WebCoreTestSupport.cpp:
+            (WebCoreTestSupport::populateJITOperations):
+            * testing/js/WebCoreTestSupport.h:
+            (WebCoreTestSupport::populateJITOperations):
+
 2021-09-09  Russell Epstein  <[email protected]>
 
         Cherry-pick r281648. rdar://problem/82944435

Modified: branches/safari-612-branch/Source/WebCore/bindings/js/WebCoreJITOperations.cpp (282568 => 282569)


--- branches/safari-612-branch/Source/WebCore/bindings/js/WebCoreJITOperations.cpp	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/WebCore/bindings/js/WebCoreJITOperations.cpp	2021-09-16 18:48:10 UTC (rev 282569)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -33,16 +33,14 @@
 #if ENABLE(JIT_OPERATION_VALIDATION)
 extern const uintptr_t startOfJITOperationsInWebCore __asm("section$start$__DATA_CONST$__jsc_ops");
 extern const uintptr_t endOfJITOperationsInWebCore __asm("section$end$__DATA_CONST$__jsc_ops");
-#endif
 
 void populateJITOperations()
 {
-#if ENABLE(JIT_OPERATION_VALIDATION)
     static std::once_flag onceKey;
     std::call_once(onceKey, [] {
         JSC::JITOperationList::populatePointersInEmbedder(&startOfJITOperationsInWebCore, &endOfJITOperationsInWebCore);
     });
-#endif
 }
+#endif // ENABLE(JIT_OPERATION_VALIDATION)
 
 }

Modified: branches/safari-612-branch/Source/WebCore/bindings/js/WebCoreJITOperations.h (282568 => 282569)


--- branches/safari-612-branch/Source/WebCore/bindings/js/WebCoreJITOperations.h	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/WebCore/bindings/js/WebCoreJITOperations.h	2021-09-16 18:48:10 UTC (rev 282569)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,6 +27,10 @@
 
 namespace WebCore {
 
+#if ENABLE(JIT_OPERATION_VALIDATION)
 WEBCORE_EXPORT void populateJITOperations();
+#else
+inline void populateJITOperations() { }
+#endif
 
 }

Modified: branches/safari-612-branch/Source/WebCore/testing/js/WebCoreTestSupport.cpp (282568 => 282569)


--- branches/safari-612-branch/Source/WebCore/testing/js/WebCoreTestSupport.cpp	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/WebCore/testing/js/WebCoreTestSupport.cpp	2021-09-16 18:48:10 UTC (rev 282569)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2011, 2015 Google Inc. All rights reserved.
- * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -245,16 +245,14 @@
 #if ENABLE(JIT_OPERATION_VALIDATION)
 extern const uintptr_t startOfJITOperationsInWebCoreTestSupport __asm("section$start$__DATA_CONST$__jsc_ops");
 extern const uintptr_t endOfJITOperationsInWebCoreTestSupport __asm("section$end$__DATA_CONST$__jsc_ops");
-#endif
 
 void populateJITOperations()
 {
-#if ENABLE(JIT_OPERATION_VALIDATION)
     static std::once_flag onceKey;
     std::call_once(onceKey, [] {
         JSC::JITOperationList::populatePointersInEmbedder(&startOfJITOperationsInWebCoreTestSupport, &endOfJITOperationsInWebCoreTestSupport);
     });
-#endif
 }
+#endif // ENABLE(JIT_OPERATION_VALIDATION)
 
 }

Modified: branches/safari-612-branch/Source/WebCore/testing/js/WebCoreTestSupport.h (282568 => 282569)


--- branches/safari-612-branch/Source/WebCore/testing/js/WebCoreTestSupport.h	2021-09-16 18:48:05 UTC (rev 282568)
+++ branches/safari-612-branch/Source/WebCore/testing/js/WebCoreTestSupport.h	2021-09-16 18:48:10 UTC (rev 282569)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2011, 2015 Google Inc. All rights reserved.
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -67,6 +67,10 @@
     
 void setAdditionalSupportedImageTypesForTesting(const WTF::String&) TEST_SUPPORT_EXPORT;
 
+#if ENABLE(JIT_OPERATION_VALIDATION)
 void populateJITOperations() TEST_SUPPORT_EXPORT;
+#else
+inline void populateJITOperations() { }
+#endif
 
 } // namespace WebCoreTestSupport
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to