Changeset 57829 in webkit for trunk/JavaScriptCore/API


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().

Location:
trunk/JavaScriptCore/API
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/APIShims.h

    r54790 r57829  
    2929#include "CallFrame.h"
    3030#include "JSLock.h"
     31#include <wtf/WTFThreadData.h>
    3132
    3233namespace JSC {
     
    3637    APIEntryShimWithoutLock(JSGlobalData* globalData, bool registerThread)
    3738        : m_globalData(globalData)
    38         , m_entryIdentifierTable(setCurrentIdentifierTable(globalData->identifierTable))
     39        , m_entryIdentifierTable(wtfThreadData().setCurrentIdentifierTable(globalData->identifierTable))
    3940    {
    4041        if (registerThread)
     
    4647    {
    4748        m_globalData->timeoutChecker.stop();
    48         setCurrentIdentifierTable(m_entryIdentifierTable);
     49        wtfThreadData().setCurrentIdentifierTable(m_entryIdentifierTable);
    4950    }
    5051
     
    8081        , m_globalData(&exec->globalData())
    8182    {
    82         resetCurrentIdentifierTable();
     83        wtfThreadData().resetCurrentIdentifierTable();
    8384    }
    8485
    8586    ~APICallbackShim()
    8687    {
    87         setCurrentIdentifierTable(m_globalData->identifierTable);
     88        wtfThreadData().setCurrentIdentifierTable(m_globalData->identifierTable);
    8889    }
    8990
  • trunk/JavaScriptCore/API/JSContextRef.cpp

    r56435 r57829  
    124124    JSGlobalData& globalData = exec->globalData();
    125125    JSGlobalObject* dgo = exec->dynamicGlobalObject();
    126     IdentifierTable* savedIdentifierTable = setCurrentIdentifierTable(globalData.identifierTable);
     126    IdentifierTable* savedIdentifierTable = wtfThreadData().setCurrentIdentifierTable(globalData.identifierTable);
    127127
    128128    // One reference is held by JSGlobalObject, another added by JSGlobalContextRetain().
     
    148148    globalData.deref();
    149149
    150     setCurrentIdentifierTable(savedIdentifierTable);
     150    wtfThreadData().setCurrentIdentifierTable(savedIdentifierTable);
    151151}
    152152
Note: See TracChangeset for help on using the changeset viewer.