Disable TLS-based TLCs
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Jan 2018 18:42:52 +0000 (18:42 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Jan 2018 18:42:52 +0000 (18:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182175

Reviewed by Saam Barati.

Source/JavaScriptCore:

Check for the new USE(FAST_TLS_FOR_TLC) flag instead of just ENABLE(FAST_TLS_JIT).

* heap/BlockDirectory.cpp:
(JSC::BlockDirectory::~BlockDirectory):
* heap/BlockDirectory.h:
* heap/ThreadLocalCache.cpp:
(JSC::ThreadLocalCache::installSlow):
(JSC::ThreadLocalCache::installData):
* heap/ThreadLocalCache.h:
* heap/ThreadLocalCacheInlines.h:
(JSC::ThreadLocalCache::getImpl):
* jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator):
* runtime/VM.cpp:
(JSC::VM::~VM):
* runtime/VM.h:

Source/WTF:

Add a flag for TLS-based TLCs and set it to 0. We can re-enable this feature when we need to use TLCs for
actual thread-local allocation and when we fix the fact that WebCore context switches JSC VMs without telling
us.

* wtf/Platform.h:

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/BlockDirectory.cpp
Source/JavaScriptCore/heap/BlockDirectory.h
Source/JavaScriptCore/heap/ThreadLocalCache.cpp
Source/JavaScriptCore/heap/ThreadLocalCache.h
Source/JavaScriptCore/heap/ThreadLocalCacheInlines.h
Source/JavaScriptCore/jit/AssemblyHelpers.cpp
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h

index 693ef73..566b4e4 100644 (file)
@@ -1,3 +1,27 @@
+2018-01-26  Filip Pizlo  <fpizlo@apple.com>
+
+        Disable TLS-based TLCs
+        https://bugs.webkit.org/show_bug.cgi?id=182175
+
+        Reviewed by Saam Barati.
+
+        Check for the new USE(FAST_TLS_FOR_TLC) flag instead of just ENABLE(FAST_TLS_JIT).
+
+        * heap/BlockDirectory.cpp:
+        (JSC::BlockDirectory::~BlockDirectory):
+        * heap/BlockDirectory.h:
+        * heap/ThreadLocalCache.cpp:
+        (JSC::ThreadLocalCache::installSlow):
+        (JSC::ThreadLocalCache::installData):
+        * heap/ThreadLocalCache.h:
+        * heap/ThreadLocalCacheInlines.h:
+        (JSC::ThreadLocalCache::getImpl):
+        * jit/AssemblyHelpers.cpp:
+        (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator):
+        * runtime/VM.cpp:
+        (JSC::VM::~VM):
+        * runtime/VM.h:
+
 2018-01-25  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/module/errorhandling.html crashes
index 6cdbc01..e9a3f07 100644 (file)
@@ -45,6 +45,10 @@ BlockDirectory::BlockDirectory(Heap* heap, size_t cellSize)
     heap->threadLocalCacheLayout().allocateOffset(this);
 }
 
+BlockDirectory::~BlockDirectory()
+{
+}
+
 void BlockDirectory::setSubspace(Subspace* subspace)
 {
     m_attributes = subspace->attributes();
index 636164f..2dd63ba 100644 (file)
@@ -80,6 +80,7 @@ class BlockDirectory {
 
 public:
     BlockDirectory(Heap*, size_t cellSize);
+    ~BlockDirectory();
     void setSubspace(Subspace*);
     void lastChanceToFinalize();
     void prepareForAllocation();
index d2ebbb7..6eb1d81 100644 (file)
@@ -72,7 +72,7 @@ void ThreadLocalCache::destroyData(Data* data)
 
 void ThreadLocalCache::installSlow(VM& vm)
 {
-#if ENABLE(FAST_TLS_JIT)
+#if USE(FAST_TLS_FOR_TLC)
     static std::once_flag onceFlag;
     std::call_once(
         onceFlag,
@@ -91,7 +91,7 @@ void ThreadLocalCache::installSlow(VM& vm)
 
 void ThreadLocalCache::installData(VM& vm, Data* data)
 {
-#if ENABLE(FAST_TLS_JIT)
+#if USE(FAST_TLS_FOR_TLC)
     UNUSED_PARAM(vm);
     _pthread_setspecific_direct(tlsKey, data);
 #else
index f79e942..76403ca 100644 (file)
@@ -92,7 +92,7 @@ private:
     Heap& m_heap;
     Data* m_data { nullptr };
 
-#if ENABLE(FAST_TLS_JIT)
+#if USE(FAST_TLS_FOR_TLC)
     static const pthread_key_t tlsKey = WTF_GC_TLC_KEY;
 #endif
 };
index 9fa5244..2234f44 100644 (file)
@@ -31,7 +31,7 @@ namespace JSC {
 
 inline ThreadLocalCache::Data* ThreadLocalCache::getImpl(VM& vm)
 {
-#if ENABLE(FAST_TLS_JIT)
+#if USE(FAST_TLS_FOR_TLC)
     UNUSED_PARAM(vm);
     return static_cast<Data*>(_pthread_getspecific_direct(tlsKey));
 #else
index 07d4670..cea5a72 100644 (file)
@@ -595,7 +595,7 @@ void AssemblyHelpers::emitAllocateWithNonNullAllocator(GPRReg resultGPR, const J
     Jump popPath;
     Jump done;
     
-#if ENABLE(FAST_TLS_JIT)
+#if USE(FAST_TLS_FOR_TLC)
     loadFromTLSPtr(fastTLSOffsetForKey(WTF_GC_TLC_KEY), scratchGPR);
 #else
     loadPtr(&vm().threadLocalCacheData, scratchGPR);
index 18afa2f..8c4cad9 100644 (file)
@@ -499,7 +499,7 @@ VM::~VM()
     m_apiLock->willDestroyVM(this);
     heap.lastChanceToFinalize();
     
-#if !ENABLE(FAST_TLS_JIT)
+#if !USE(FAST_TLS_FOR_TLC)
     ThreadLocalCache::destructor(threadLocalCacheData);
 #endif
 
index 55da9ac..b6a4501 100644 (file)
@@ -658,7 +658,7 @@ public:
     JSObject* stringRecursionCheckFirstObject { nullptr };
     HashSet<JSObject*> stringRecursionCheckVisitedObjects;
     
-#if !ENABLE(FAST_TLS_JIT)
+#if !USE(FAST_TLS_FOR_TLC)
     ThreadLocalCache::Data* threadLocalCacheData { nullptr };
 #endif
     RefPtr<ThreadLocalCache> defaultThreadLocalCache;
index 5fa1f52..73b8588 100644 (file)
@@ -1,3 +1,16 @@
+2018-01-26  Filip Pizlo  <fpizlo@apple.com>
+
+        Disable TLS-based TLCs
+        https://bugs.webkit.org/show_bug.cgi?id=182175
+
+        Reviewed by Saam Barati.
+
+        Add a flag for TLS-based TLCs and set it to 0. We can re-enable this feature when we need to use TLCs for
+        actual thread-local allocation and when we fix the fact that WebCore context switches JSC VMs without telling
+        us.
+
+        * wtf/Platform.h:
+
 2018-01-25  Filip Pizlo  <fpizlo@apple.com>
 
         Unreviewed, fix windows build.
index 3fab89c..d534bdf 100644 (file)
 #define ENABLE_FAST_TLS_JIT 1
 #endif
 
+// This feature is currently disabled because WebCore will context switch VMs without telling JSC.
+// FIXME: Re-enable this feature.
+// https://bugs.webkit.org/show_bug.cgi?id=182173
+#define USE_FAST_TLS_FOR_TLC 0
+
 #if CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2) || CPU(ARM64) || CPU(ARM_TRADITIONAL) || CPU(MIPS)
 #define ENABLE_MASM_PROBE 1
 #else