Ignore:
Timestamp:
Jul 31, 2017, 4:23:41 AM (8 years ago)
Author:
Yusuke Suzuki
Message:

Merge WTFThreadData to Thread::current
https://bugs.webkit.org/show_bug.cgi?id=174716

Reviewed by Sam Weinig.

Source/JavaScriptCore:

Use Thread::current() instead.

  • API/JSContext.mm:

(+[JSContext currentContext]):
(+[JSContext currentThis]):
(+[JSContext currentCallee]):
(+[JSContext currentArguments]):
(-[JSContext beginCallbackWithData:calleeValue:thisValue:argumentCount:arguments:]):
(-[JSContext endCallbackWithData:]):

  • heap/Heap.cpp:

(JSC::Heap::requestCollection):

  • runtime/Completion.cpp:

(JSC::checkSyntax):
(JSC::checkModuleSyntax):
(JSC::evaluate):
(JSC::loadAndEvaluateModule):
(JSC::loadModule):
(JSC::linkAndEvaluateModule):
(JSC::importModule):

  • runtime/Identifier.cpp:

(JSC::Identifier::checkCurrentAtomicStringTable):

  • runtime/InitializeThreading.cpp:

(JSC::initializeThreading):

  • runtime/JSLock.cpp:

(JSC::JSLock::didAcquireLock):
(JSC::JSLock::willReleaseLock):
(JSC::JSLock::dropAllLocks):
(JSC::JSLock::grabAllLocks):

  • runtime/JSLock.h:
  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::VM::updateStackLimits):
(JSC::VM::committedStackByteCount):

  • runtime/VM.h:

(JSC::VM::isSafeToRecurse const):

  • runtime/VMEntryScope.cpp:

(JSC::VMEntryScope::VMEntryScope):

  • runtime/VMInlines.h:

(JSC::VM::ensureStackCapacityFor):

  • yarr/YarrPattern.cpp:

(JSC::Yarr::YarrPatternConstructor::isSafeToRecurse const):

Source/WebCore:

Use Thread::current() instead.

  • fileapi/AsyncFileStream.cpp:
  • platform/ThreadGlobalData.cpp:

(WebCore::ThreadGlobalData::ThreadGlobalData):

  • platform/graphics/cocoa/WebCoreDecompressionSession.h:
  • platform/ios/wak/WebCoreThread.mm:

(StartWebThread):

  • workers/WorkerThread.cpp:

(WebCore::WorkerThread::workerThread):

Source/WTF:

We placed thread specific data in WTFThreadData previously. But now, we have a new good place
to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
before calling WTF::initializeThreading.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/CMakeLists.txt:
  • wtf/LockAlgorithm.h:
  • wtf/LockAlgorithmInlines.h:
  • wtf/MainThread.h:
  • wtf/ParkingLot.cpp:
  • wtf/StackStats.cpp:

(WTF::StackStats::PerThreadStats::PerThreadStats):
(WTF::StackStats::CheckPoint::CheckPoint):
(WTF::StackStats::CheckPoint::~CheckPoint):
(WTF::StackStats::probe):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):

  • wtf/ThreadHolder.cpp:

(WTF::ThreadHolder::initializeCurrent):

  • wtf/ThreadHolder.h:

(WTF::ThreadHolder::ThreadHolder):
(WTF::ThreadHolder::currentMayBeNull):
(WTF::ThreadHolder::current):

  • wtf/ThreadHolderPthreads.cpp:

(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::destruct):
(WTF::ThreadHolder::current): Deleted.

  • wtf/ThreadHolderWin.cpp:

(WTF::ThreadHolder::currentDying):
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::current): Deleted.

  • wtf/Threading.cpp:

(WTF::Thread::initializeInThread):
(WTF::Thread::entryPoint):
(WTF::Thread::didExit):
(WTF::initializeThreading):
(WTF::Thread::currentMayBeNull): Deleted.

  • wtf/Threading.h:

(WTF::Thread::atomicStringTable):
(WTF::Thread::setCurrentAtomicStringTable):
(WTF::Thread::stackStats):
(WTF::Thread::savedStackPointerAtVMEntry):
(WTF::Thread::setSavedStackPointerAtVMEntry):
(WTF::Thread::savedLastStackTop):
(WTF::Thread::setSavedLastStackTop):
(WTF::Thread::current):

  • wtf/ThreadingPrimitives.h:
  • wtf/ThreadingPthreads.cpp:

(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.

  • wtf/ThreadingWin.cpp:

(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.

  • wtf/WTFThreadData.cpp: Removed.
  • wtf/WTFThreadData.h: Removed.
  • wtf/text/AtomicString.cpp:
  • wtf/text/AtomicStringImpl.cpp:

(WTF::stringTable):

  • wtf/text/AtomicStringTable.cpp:

(WTF::AtomicStringTable::create):

  • wtf/text/AtomicStringTable.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSLock.cpp

    r219763 r220060  
    128128        return;
    129129   
    130     WTFThreadData& threadData = wtfThreadData();
     130    Thread& thread = Thread::current();
    131131    ASSERT(!m_entryAtomicStringTable);
    132     m_entryAtomicStringTable = threadData.setCurrentAtomicStringTable(m_vm->atomicStringTable());
     132    m_entryAtomicStringTable = thread.setCurrentAtomicStringTable(m_vm->atomicStringTable());
    133133    ASSERT(m_entryAtomicStringTable);
    134134
     
    144144    m_vm->setStackPointerAtVMEntry(p);
    145145
    146     m_vm->setLastStackTop(threadData.savedLastStackTop());
     146    m_vm->setLastStackTop(thread.savedLastStackTop());
    147147
    148148    m_vm->heap.machineThreads().addCurrentThread();
     
    201201
    202202    if (m_entryAtomicStringTable) {
    203         wtfThreadData().setCurrentAtomicStringTable(m_entryAtomicStringTable);
     203        Thread::current().setCurrentAtomicStringTable(m_entryAtomicStringTable);
    204204        m_entryAtomicStringTable = nullptr;
    205205    }
     
    226226    dropper->setDropDepth(m_lockDropDepth);
    227227
    228     WTFThreadData& threadData = wtfThreadData();
    229     threadData.setSavedStackPointerAtVMEntry(m_vm->stackPointerAtVMEntry());
    230     threadData.setSavedLastStackTop(m_vm->lastStackTop());
     228    Thread& thread = Thread::current();
     229    thread.setSavedStackPointerAtVMEntry(m_vm->stackPointerAtVMEntry());
     230    thread.setSavedLastStackTop(m_vm->lastStackTop());
    231231
    232232    unsigned droppedLockCount = m_lockCount;
     
    253253    --m_lockDropDepth;
    254254
    255     WTFThreadData& threadData = wtfThreadData();
    256     m_vm->setStackPointerAtVMEntry(threadData.savedStackPointerAtVMEntry());
    257     m_vm->setLastStackTop(threadData.savedLastStackTop());
     255    Thread& thread = Thread::current();
     256    m_vm->setStackPointerAtVMEntry(thread.savedStackPointerAtVMEntry());
     257    m_vm->setLastStackTop(thread.savedLastStackTop());
    258258}
    259259
Note: See TracChangeset for help on using the changeset viewer.