Title: [234171] trunk/Source/_javascript_Core
Revision
234171
Author
[email protected]
Date
2018-07-24 14:42:20 -0700 (Tue, 24 Jul 2018)

Log Message

Make VM::canUseJIT an inlined function
https://bugs.webkit.org/show_bug.cgi?id=187583

Reviewed by Mark Lam.

We know the answer to this query in initializeThreading after initializing
the executable allocator. This patch makes it so that we just hold this value
in a static variable and have an inlined function that just returns the value
of that static variable.

* runtime/InitializeThreading.cpp:
(JSC::initializeThreading):
* runtime/VM.cpp:
(JSC::VM::computeCanUseJIT):
(JSC::VM::canUseJIT): Deleted.
* runtime/VM.h:
(JSC::VM::canUseJIT):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (234170 => 234171)


--- trunk/Source/_javascript_Core/ChangeLog	2018-07-24 20:29:58 UTC (rev 234170)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-07-24 21:42:20 UTC (rev 234171)
@@ -1,3 +1,23 @@
+2018-07-24  Saam Barati  <[email protected]>
+
+        Make VM::canUseJIT an inlined function
+        https://bugs.webkit.org/show_bug.cgi?id=187583
+
+        Reviewed by Mark Lam.
+
+        We know the answer to this query in initializeThreading after initializing
+        the executable allocator. This patch makes it so that we just hold this value
+        in a static variable and have an inlined function that just returns the value
+        of that static variable.
+
+        * runtime/InitializeThreading.cpp:
+        (JSC::initializeThreading):
+        * runtime/VM.cpp:
+        (JSC::VM::computeCanUseJIT):
+        (JSC::VM::canUseJIT): Deleted.
+        * runtime/VM.h:
+        (JSC::VM::canUseJIT):
+
 2018-07-24  Mark Lam  <[email protected]>
 
         Placate exception check verification after recent changes.

Modified: trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp (234170 => 234171)


--- trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp	2018-07-24 20:29:58 UTC (rev 234170)
+++ trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp	2018-07-24 21:42:20 UTC (rev 234171)
@@ -63,12 +63,16 @@
         WTF::initializeThreading();
         Options::initialize();
         initializePoison();
+
 #if ENABLE(WRITE_BARRIER_PROFILING)
         WriteBarrierCounters::initialize();
 #endif
+
 #if ENABLE(ASSEMBLER)
         ExecutableAllocator::initializeAllocator();
 #endif
+        VM::computeCanUseJIT();
+
         LLInt::initialize();
 #ifndef NDEBUG
         DisallowGC::initialize();

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (234170 => 234171)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2018-07-24 20:29:58 UTC (rev 234170)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2018-07-24 21:42:20 UTC (rev 234171)
@@ -175,6 +175,13 @@
 
 namespace JSC {
 
+#if ENABLE(JIT)
+#if !ASSERT_DISABLED
+bool VM::s_canUseJITIsSet = false;
+#endif
+bool VM::s_canUseJIT = false;
+#endif
+
 // Note: Platform.h will enforce that ENABLE(ASSEMBLER) is true if either
 // ENABLE(JIT) or ENABLE(YARR_JIT) or both are enabled. The code below
 // just checks for ENABLE(JIT) or ENABLE(YARR_JIT) with this premise in mind.
@@ -210,18 +217,15 @@
 #endif
 }
 
-bool VM::canUseJIT()
+void VM::computeCanUseJIT()
 {
 #if ENABLE(JIT)
-    static std::once_flag onceKey;
-    static bool enabled = false;
-    std::call_once(onceKey, [] {
-        enabled = VM::canUseAssembler() && Options::useJIT();
-    });
-    return enabled;
-#else
-    return false; // interpreter only
+#if !ASSERT_DISABLED
+    RELEASE_ASSERT(!s_canUseJITIsSet);
+    s_canUseJITIsSet = true;
 #endif
+    s_canUseJIT = VM::canUseAssembler() && Options::useJIT();
+#endif
 }
 
 bool VM::canUseRegExpJIT()

Modified: trunk/Source/_javascript_Core/runtime/VM.h (234170 => 234171)


--- trunk/Source/_javascript_Core/runtime/VM.h	2018-07-24 20:29:58 UTC (rev 234170)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2018-07-24 21:42:20 UTC (rev 234171)
@@ -610,10 +610,22 @@
     };
 
     static JS_EXPORT_PRIVATE bool canUseAssembler();
-    static JS_EXPORT_PRIVATE bool canUseJIT();
     static JS_EXPORT_PRIVATE bool canUseRegExpJIT();
     static JS_EXPORT_PRIVATE bool isInMiniMode();
 
+    static void computeCanUseJIT();
+    ALWAYS_INLINE static bool canUseJIT()
+    {
+#if ENABLE(JIT)
+#if !ASSERT_DISABLED
+        RELEASE_ASSERT(s_canUseJITIsSet);
+#endif
+        return s_canUseJIT;
+#else
+        return false;
+#endif
+    }
+
     SourceProviderCache* addSourceProviderCache(SourceProvider*);
     void clearSourceProviderCaches();
 
@@ -974,6 +986,13 @@
     std::unique_ptr<ShadowChicken> m_shadowChicken;
     std::unique_ptr<BytecodeIntrinsicRegistry> m_bytecodeIntrinsicRegistry;
 
+#if ENABLE(JIT)
+#if !ASSERT_DISABLED
+    JS_EXPORT_PRIVATE static bool s_canUseJITIsSet;
+#endif
+    JS_EXPORT_PRIVATE static bool s_canUseJIT;
+#endif
+
     VM* m_prev; // Required by DoublyLinkedListNode.
     VM* m_next; // Required by DoublyLinkedListNode.
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to