Ignore:
Timestamp:
Apr 19, 2010, 1:05:53 PM (15 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=37745
Move string uniquing tables to (new) WTFThreadData class.

Reviewed by Sam Weinig.

Remove AtomicString's dependency on ThreadGlobalData so that we can move
WebCore's string classes up to WTF.

JavaScriptCore:

WTFThreadData.cpp/.h are based on ThreadGlobalData from WebCore.
Moved JSC & WebCore's string uniquing tables to this class.

This patch introduces a temporary layering violation in providing forward
declarations of classes from JSC and WTF; this will be resolved as we move
more string code up to WTF.

  • API/APIShims.h:

(JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
(JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
(JSC::APICallbackShim::APICallbackShim):
(JSC::APICallbackShim::~APICallbackShim):

(JSC::checkSyntax):
(JSC::evaluate):

  • runtime/Identifier.cpp:

(JSC::Identifier::remove):
(JSC::Identifier::checkCurrentIdentifierTable):

  • runtime/Identifier.h:
  • runtime/InitializeThreading.cpp:

(JSC::initializeThreadingOnce):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::create):

  • wtf/WTFThreadData.cpp: Copied from WebCore/platform/ThreadGlobalData.cpp.

(WTF::WTFThreadData::WTFThreadData):
(WTF::WTFThreadData::~WTFThreadData):

  • wtf/WTFThreadData.h: Copied from WebCore/platform/ThreadGlobalData.h.

(WTF::WTFThreadData::atomicStringTable):
(WTF::WTFThreadData::initializeIdentifierTable):
(WTF::WTFThreadData::currentIdentifierTable):
(WTF::WTFThreadData::setCurrentIdentifierTable):
(WTF::WTFThreadData::resetCurrentIdentifierTable):
(WTF::wtfThreadData):

JavaScriptGlue:

  • ForwardingHeaders/wtf/WTFThreadData.h: Added.
  • JSUtils.cpp: Update

(JSGlueAPIEntry::JSGlueAPIEntry):
(JSGlueAPIEntry::~JSGlueAPIEntry):
(JSGlueAPICallback::JSGlueAPICallback):
(JSGlueAPICallback::~JSGlueAPICallback):

WebCore:

  • ForwardingHeaders/wtf/WTFThreadData.h: Added.
  • platform/ThreadGlobalData.cpp: Remove m_atomicStringTable, all wtfThreadData() to ensure threadsafely initialized.

(WebCore::ThreadGlobalData::ThreadGlobalData):
(WebCore::ThreadGlobalData::~ThreadGlobalData):

  • platform/ThreadGlobalData.h: Remove m_atomicStringTable.

(WebCore::ThreadGlobalData::eventNames):

  • platform/text/AtomicString.cpp:

(WebCore::AtomicStringTable::create):
(WebCore::AtomicStringTable::table):
(WebCore::AtomicStringTable::destroy):
(WebCore::stringTable): Access the AtomicStringTable on wtfThreadData() rather then threadGlobalData().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Identifier.cpp

    r55943 r57829  
    2929#include <wtf/FastMalloc.h>
    3030#include <wtf/HashSet.h>
     31#include <wtf/WTFThreadData.h>
    3132
    3233using WTF::ThreadSpecific;
     
    229230void Identifier::remove(UString::Rep* r)
    230231{
    231     currentIdentifierTable()->remove(r);
     232    wtfThreadData().currentIdentifierTable()->remove(r);
    232233}
    233234   
     
    253254    // Check the identifier table accessible through the threadspecific matches the
    254255    // globalData's identifier table.
    255     ASSERT_UNUSED(globalData, globalData->identifierTable == currentIdentifierTable());
     256    ASSERT_UNUSED(globalData, globalData->identifierTable == wtfThreadData().currentIdentifierTable());
    256257}
    257258
     
    270271#endif
    271272
    272 ThreadSpecific<ThreadIdentifierTableData>* g_identifierTableSpecific = 0;
    273 
    274 #if ENABLE(JSC_MULTIPLE_THREADS)
    275 
    276 pthread_once_t createIdentifierTableSpecificOnce = PTHREAD_ONCE_INIT;
    277 static void createIdentifierTableSpecificCallback()
    278 {
    279     ASSERT(!g_identifierTableSpecific);
    280     g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();
    281 }
    282 void createIdentifierTableSpecific()
    283 {
    284     pthread_once(&createIdentifierTableSpecificOnce, createIdentifierTableSpecificCallback);
    285     ASSERT(g_identifierTableSpecific);
    286 }
    287 
    288 #else
    289 
    290 void createIdentifierTableSpecific()
    291 {
    292     ASSERT(!g_identifierTableSpecific);
    293     g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();
    294 }
    295 
    296 #endif
    297 
    298273} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.