This broke windows.
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Apr 2010 23:26:29 +0000 (23:26 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Apr 2010 23:26:29 +0000 (23:26 +0000)
Reviewed by NOBODY (rolling out r57829).

JavaScriptCore:

* API/APIShims.h:
(JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
(JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
(JSC::APICallbackShim::APICallbackShim):
(JSC::APICallbackShim::~APICallbackShim):
* API/JSContextRef.cpp:
* Android.mk:
* Android.v8.wtf.mk:
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.gypi:
* JavaScriptCore.pro:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* runtime/Completion.cpp:
(JSC::checkSyntax):
(JSC::evaluate):
* runtime/Identifier.cpp:
(JSC::Identifier::remove):
(JSC::Identifier::checkCurrentIdentifierTable):
(JSC::createIdentifierTableSpecificCallback):
(JSC::createIdentifierTableSpecific):
* runtime/Identifier.h:
(JSC::ThreadIdentifierTableData::ThreadIdentifierTableData):
(JSC::defaultIdentifierTable):
(JSC::setDefaultIdentifierTable):
(JSC::currentIdentifierTable):
(JSC::setCurrentIdentifierTable):
(JSC::resetCurrentIdentifierTable):
* runtime/InitializeThreading.cpp:
(JSC::initializeThreadingOnce):
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::create):
* wtf/WTFThreadData.cpp: Removed.
* wtf/WTFThreadData.h: Removed.

JavaScriptGlue:

* ForwardingHeaders/wtf/WTFThreadData.h: Removed.
* JSUtils.cpp:
(JSGlueAPIEntry::JSGlueAPIEntry):
(JSGlueAPIEntry::~JSGlueAPIEntry):
(JSGlueAPICallback::JSGlueAPICallback):
(JSGlueAPICallback::~JSGlueAPICallback):

WebCore:

* ForwardingHeaders/wtf/WTFThreadData.h: Removed.
* platform/ThreadGlobalData.cpp:
(WebCore::ThreadGlobalData::ThreadGlobalData):
(WebCore::ThreadGlobalData::~ThreadGlobalData):
* platform/ThreadGlobalData.h:
(WebCore::ThreadGlobalData::atomicStringTable):
* platform/text/AtomicString.cpp:
(WebCore::stringTable):

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

27 files changed:
JavaScriptCore/API/APIShims.h
JavaScriptCore/API/JSContextRef.cpp
JavaScriptCore/Android.mk
JavaScriptCore/Android.v8.wtf.mk
JavaScriptCore/ChangeLog
JavaScriptCore/GNUmakefile.am
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/JavaScriptCore.gypi
JavaScriptCore/JavaScriptCore.pro
JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/runtime/Completion.cpp
JavaScriptCore/runtime/Identifier.cpp
JavaScriptCore/runtime/Identifier.h
JavaScriptCore/runtime/InitializeThreading.cpp
JavaScriptCore/runtime/JSGlobalData.cpp
JavaScriptCore/wtf/WTFThreadData.cpp [deleted file]
JavaScriptCore/wtf/WTFThreadData.h [deleted file]
JavaScriptGlue/ChangeLog
JavaScriptGlue/ForwardingHeaders/wtf/WTFThreadData.h [deleted file]
JavaScriptGlue/JSUtils.cpp
WebCore/ChangeLog
WebCore/ForwardingHeaders/wtf/WTFThreadData.h [deleted file]
WebCore/platform/ThreadGlobalData.cpp
WebCore/platform/ThreadGlobalData.h
WebCore/platform/text/AtomicString.cpp

index 3d42ca2..9a6cacb 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "CallFrame.h"
 #include "JSLock.h"
-#include <wtf/WTFThreadData.h>
 
 namespace JSC {
 
@@ -36,7 +35,7 @@ class APIEntryShimWithoutLock {
 protected:
     APIEntryShimWithoutLock(JSGlobalData* globalData, bool registerThread)
         : m_globalData(globalData)
-        , m_entryIdentifierTable(wtfThreadData().setCurrentIdentifierTable(globalData->identifierTable))
+        , m_entryIdentifierTable(setCurrentIdentifierTable(globalData->identifierTable))
     {
         if (registerThread)
             globalData->heap.registerThread();
@@ -46,7 +45,7 @@ protected:
     ~APIEntryShimWithoutLock()
     {
         m_globalData->timeoutChecker.stop();
-        wtfThreadData().setCurrentIdentifierTable(m_entryIdentifierTable);
+        setCurrentIdentifierTable(m_entryIdentifierTable);
     }
 
 private:
@@ -80,12 +79,12 @@ public:
         : m_dropAllLocks(exec)
         , m_globalData(&exec->globalData())
     {
-        wtfThreadData().resetCurrentIdentifierTable();
+        resetCurrentIdentifierTable();
     }
 
     ~APICallbackShim()
     {
-        wtfThreadData().setCurrentIdentifierTable(m_globalData->identifierTable);
+        setCurrentIdentifierTable(m_globalData->identifierTable);
     }
 
 private:
index 664f7be..9d4f38c 100644 (file)
@@ -123,7 +123,7 @@ void JSGlobalContextRelease(JSGlobalContextRef ctx)
 
     JSGlobalData& globalData = exec->globalData();
     JSGlobalObject* dgo = exec->dynamicGlobalObject();
-    IdentifierTable* savedIdentifierTable = wtfThreadData().setCurrentIdentifierTable(globalData.identifierTable);
+    IdentifierTable* savedIdentifierTable = setCurrentIdentifierTable(globalData.identifierTable);
 
     // One reference is held by JSGlobalObject, another added by JSGlobalContextRetain().
     bool releasingContextGroup = globalData.refCount() == 2;
@@ -147,7 +147,7 @@ void JSGlobalContextRelease(JSGlobalContextRef ctx)
 
     globalData.deref();
 
-    wtfThreadData().setCurrentIdentifierTable(savedIdentifierTable);
+    setCurrentIdentifierTable(savedIdentifierTable);
 }
 
 JSObjectRef JSContextGetGlobalObject(JSContextRef ctx)
index feb1862..56b0828 100644 (file)
@@ -165,7 +165,6 @@ LOCAL_SRC_FILES := \
        wtf/ThreadIdentifierDataPthreads.cpp \
        wtf/Threading.cpp \
        wtf/ThreadingPthreads.cpp \
-       wtf/WTFThreadData.cpp \
        \
        wtf/TypeTraits.cpp \
        wtf/dtoa.cpp \
index 02e5172..69128d6 100644 (file)
@@ -45,7 +45,6 @@ LOCAL_SRC_FILES := \
        wtf/ThreadIdentifierDataPthreads.cpp \
        wtf/Threading.cpp \
        wtf/ThreadingPthreads.cpp \
-       wtf/WTFThreadData.cpp \
        \
        wtf/android/MainThreadAndroid.cpp \
        \
index 4f50a01..f83ae12 100644 (file)
@@ -1,3 +1,45 @@
+2010-04-19  Gavin Barraclough  <barraclough@apple.com>
+
+        Reviewed by NOBODY (rolling out r57829).
+        This broke windows.
+
+        * API/APIShims.h:
+        (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
+        (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
+        (JSC::APICallbackShim::APICallbackShim):
+        (JSC::APICallbackShim::~APICallbackShim):
+        * API/JSContextRef.cpp:
+        * Android.mk:
+        * Android.v8.wtf.mk:
+        * GNUmakefile.am:
+        * JavaScriptCore.exp:
+        * JavaScriptCore.gypi:
+        * JavaScriptCore.pro:
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * runtime/Completion.cpp:
+        (JSC::checkSyntax):
+        (JSC::evaluate):
+        * runtime/Identifier.cpp:
+        (JSC::Identifier::remove):
+        (JSC::Identifier::checkCurrentIdentifierTable):
+        (JSC::createIdentifierTableSpecificCallback):
+        (JSC::createIdentifierTableSpecific):
+        * runtime/Identifier.h:
+        (JSC::ThreadIdentifierTableData::ThreadIdentifierTableData):
+        (JSC::defaultIdentifierTable):
+        (JSC::setDefaultIdentifierTable):
+        (JSC::currentIdentifierTable):
+        (JSC::setCurrentIdentifierTable):
+        (JSC::resetCurrentIdentifierTable):
+        * runtime/InitializeThreading.cpp:
+        (JSC::initializeThreadingOnce):
+        * runtime/JSGlobalData.cpp:
+        (JSC::JSGlobalData::create):
+        * wtf/WTFThreadData.cpp: Removed.
+        * wtf/WTFThreadData.h: Removed.
+
 2010-04-19  Douglas Gregor  <dgregor@apple.com>
 
         Reviewed and landed by Anders Carlsson.
index b596b55..873af95 100644 (file)
@@ -284,8 +284,6 @@ javascriptcore_sources += \
        JavaScriptCore/wtf/ValueCheck.h \
        JavaScriptCore/wtf/Vector.h \
        JavaScriptCore/wtf/VectorTraits.h \
-       JavaScriptCore/wtf/WTFThreadData.cpp \
-       JavaScriptCore/wtf/WTFThreadData.h \
        JavaScriptCore/wtf/gobject/GOwnPtr.cpp \
        JavaScriptCore/wtf/gobject/GOwnPtr.h \
        JavaScriptCore/wtf/gobject/GRefPtr.cpp \
index 0d7dec8..160b754 100644 (file)
@@ -196,6 +196,8 @@ __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_
 __ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
 __ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
 __ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
+__ZN3JSC25g_identifierTableSpecificE
+__ZN3JSC29createIdentifierTableSpecificEv
 __ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
 __ZN3JSC3NaNE
 __ZN3JSC4Heap14primaryHeapEndEv
@@ -317,9 +319,6 @@ __ZN3WTF12createThreadEPFPvS0_ES0_PKc
 __ZN3WTF12detachThreadEj
 __ZN3WTF12isMainThreadEv
 __ZN3WTF12randomNumberEv
-__ZN3WTF13WTFThreadData10staticDataE
-__ZN3WTF13WTFThreadDataC1Ev
-__ZN3WTF13WTFThreadDataD1Ev
 __ZN3WTF13currentThreadEv
 __ZN3WTF13tryFastCallocEmm
 __ZN3WTF13tryFastMallocEm
index 8e74f6f..ecc65d7 100644 (file)
             'wtf/Vector.h',
             'wtf/VectorTraits.h',
             'wtf/VMTags.h',
-            'wtf/WTFThreadData.cpp',
-            'wtf/WTFThreadData.h',
             'wtf/win/MainThreadWin.cpp',
             'wtf/wx/MainThreadWx.cpp',
             'yarr/RegexCompiler.cpp',
index 8ded8ea..be8a154 100644 (file)
@@ -203,7 +203,6 @@ SOURCES += \
     wtf/ThreadingNone.cpp \
     wtf/Threading.cpp \
     wtf/TypeTraits.cpp \
-    wtf/WTFThreadData.cpp \
     wtf/text/CString.cpp \
     wtf/unicode/CollatorDefault.cpp \
     wtf/unicode/icu/CollatorICU.cpp \
index d022ef5..436d848 100644 (file)
@@ -21,7 +21,6 @@ EXPORTS
     ??0ThreadCondition@WTF@@QAE@XZ
     ??0UString@JSC@@QAE@PBD@Z
     ??0UString@JSC@@QAE@PB_WI@Z
-    ??0WTFThreadData@WTF@@QAE@XZ
     ??1ClientData@JSGlobalData@JSC@@UAE@XZ
     ??1Collator@WTF@@QAE@XZ
     ??1Debugger@JSC@@UAE@XZ
@@ -33,7 +32,6 @@ EXPORTS
     ??1Structure@JSC@@QAE@XZ
     ??1ThreadCondition@WTF@@QAE@XZ
     ??1UStringImpl@JSC@@QAE@XZ
-    ??1WTFThreadData@WTF@@QAE@XZ
     ??2JSGlobalObject@JSC@@SAPAXIPAVJSGlobalData@1@@Z
     ??8JSC@@YA_NABVUString@0@0@Z
     ?NaN@JSC@@3NB
@@ -264,7 +262,6 @@ EXPORTS
     ?startIgnoringLeaks@Structure@JSC@@SAXXZ
     ?startProfiling@Profiler@JSC@@QAEXPAVExecState@2@ABVUString@2@@Z
     ?startSampling@JSGlobalData@JSC@@QAEXXZ
-    ?staticData@WTFThreadData@WTF@@0PAV?$ThreadSpecific@VWTFThreadData@WTF@@@2@A
     ?stopIgnoringLeaks@Structure@JSC@@SAXXZ
     ?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z
     ?stopSampling@JSGlobalData@JSC@@QAEXXZ
index c5029ad..1f03f69 100644 (file)
                        RelativePath="..\..\wtf\VectorTraits.h"\r
                        >\r
                </File>\r
-               <File\r
-                       RelativePath="..\..\wtf\WTFThreadData.cpp"\r
-                       >\r
-               </File>\r
-               <File\r
-                       RelativePath="..\..\wtf\WTFThreadData.h"\r
-                       >\r
-               </File>\r
        </Files>\r
        <Globals>\r
        </Globals>\r
index 09f5d1b..7990e2f 100644 (file)
                86CC85A30EE79B7400288682 /* JITCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85A20EE79B7400288682 /* JITCall.cpp */; };
                86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */; };
                86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CCEFDD0F413F8900FD7F9E /* JITCode.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               86D08D5311793613006E5ED0 /* WTFThreadData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86D08D5111793613006E5ED0 /* WTFThreadData.cpp */; };
-               86D08D5411793613006E5ED0 /* WTFThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D08D5211793613006E5ED0 /* WTFThreadData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                86D3B2C310156BDE002865E7 /* ARMAssembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */; };
                86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C010156BDE002865E7 /* ARMAssembler.h */; };
                86D3B2C510156BDE002865E7 /* AssemblerBufferWithConstantPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C110156BDE002865E7 /* AssemblerBufferWithConstantPool.h */; };
                86CC85A20EE79B7400288682 /* JITCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCall.cpp; sourceTree = "<group>"; };
                86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess.cpp; sourceTree = "<group>"; };
                86CCEFDD0F413F8900FD7F9E /* JITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCode.h; sourceTree = "<group>"; };
-               86D08D5111793613006E5ED0 /* WTFThreadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFThreadData.cpp; sourceTree = "<group>"; };
-               86D08D5211793613006E5ED0 /* WTFThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFThreadData.h; sourceTree = "<group>"; };
                86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ARMAssembler.cpp; sourceTree = "<group>"; };
                86D3B2C010156BDE002865E7 /* ARMAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARMAssembler.h; sourceTree = "<group>"; };
                86D3B2C110156BDE002865E7 /* AssemblerBufferWithConstantPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssemblerBufferWithConstantPool.h; sourceTree = "<group>"; };
                                6592C316098B7DE10003D4F6 /* Vector.h */,
                                6592C317098B7DE10003D4F6 /* VectorTraits.h */,
                                96DD73780F9DA3100027FBCC /* VMTags.h */,
-                               86D08D5111793613006E5ED0 /* WTFThreadData.cpp */,
-                               86D08D5211793613006E5ED0 /* WTFThreadData.h */,
                        );
                        path = wtf;
                        sourceTree = "<group>";
                                86565743115BE3DA00291F40 /* CString.h in Headers */,
                                A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */,
                                A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */,
-                               86D08D5411793613006E5ED0 /* WTFThreadData.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */,
                                86565742115BE3DA00291F40 /* CString.cpp in Sources */,
                                A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */,
-                               86D08D5311793613006E5ED0 /* WTFThreadData.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 9af5171..bdd82d8 100644 (file)
@@ -29,7 +29,6 @@
 #include "Interpreter.h"
 #include "Parser.h"
 #include "Debugger.h"
-#include "WTFThreadData.h"
 #include <stdio.h>
 
 namespace JSC {
@@ -37,7 +36,7 @@ namespace JSC {
 Completion checkSyntax(ExecState* exec, const SourceCode& source)
 {
     JSLock lock(exec);
-    ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable());
+    ASSERT(exec->globalData().identifierTable == currentIdentifierTable());
 
     RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source);
     JSObject* error = program->checkSyntax(exec);
@@ -50,7 +49,7 @@ Completion checkSyntax(ExecState* exec, const SourceCode& source)
 Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& source, JSValue thisValue)
 {
     JSLock lock(exec);
-    ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable());
+    ASSERT(exec->globalData().identifierTable == currentIdentifierTable());
 
     RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source);
     JSObject* error = program->compile(exec, scopeChain.node());
index c6555f4..9acccf0 100644 (file)
@@ -28,7 +28,6 @@
 #include <wtf/Assertions.h>
 #include <wtf/FastMalloc.h>
 #include <wtf/HashSet.h>
-#include <wtf/WTFThreadData.h>
 
 using WTF::ThreadSpecific;
 
@@ -229,7 +228,7 @@ PassRefPtr<UString::Rep> Identifier::addSlowCase(ExecState* exec, UString::Rep*
 
 void Identifier::remove(UString::Rep* r)
 {
-    wtfThreadData().currentIdentifierTable()->remove(r);
+    currentIdentifierTable()->remove(r);
 }
     
 Identifier Identifier::from(ExecState* exec, unsigned value)
@@ -253,7 +252,7 @@ void Identifier::checkCurrentIdentifierTable(JSGlobalData* globalData)
 {
     // Check the identifier table accessible through the threadspecific matches the
     // globalData's identifier table.
-    ASSERT_UNUSED(globalData, globalData->identifierTable == wtfThreadData().currentIdentifierTable());
+    ASSERT_UNUSED(globalData, globalData->identifierTable == currentIdentifierTable());
 }
 
 void Identifier::checkCurrentIdentifierTable(ExecState* exec)
@@ -270,4 +269,30 @@ void Identifier::checkCurrentIdentifierTable(ExecState*) { CRASH(); }
 
 #endif
 
+ThreadSpecific<ThreadIdentifierTableData>* g_identifierTableSpecific = 0;
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+pthread_once_t createIdentifierTableSpecificOnce = PTHREAD_ONCE_INIT;
+static void createIdentifierTableSpecificCallback()
+{
+    ASSERT(!g_identifierTableSpecific);
+    g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();
+}
+void createIdentifierTableSpecific()
+{
+    pthread_once(&createIdentifierTableSpecificOnce, createIdentifierTableSpecificCallback);
+    ASSERT(g_identifierTableSpecific);
+}
+
+#else 
+
+void createIdentifierTableSpecific()
+{
+    ASSERT(!g_identifierTableSpecific);
+    g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();
+}
+
+#endif
+
 } // namespace JSC
index 4ab9697..48b1da1 100644 (file)
@@ -140,6 +140,67 @@ namespace JSC {
     IdentifierTable* createIdentifierTable();
     void deleteIdentifierTable(IdentifierTable*);
 
+    struct ThreadIdentifierTableData {
+        ThreadIdentifierTableData()
+            : defaultIdentifierTable(0)
+            , currentIdentifierTable(0)
+        {
+        }
+
+        IdentifierTable* defaultIdentifierTable;
+        IdentifierTable* currentIdentifierTable;
+    };
+
+    extern WTF::ThreadSpecific<ThreadIdentifierTableData>* g_identifierTableSpecific;
+    void createIdentifierTableSpecific();
+
+    inline IdentifierTable* defaultIdentifierTable()
+    {
+        if (!g_identifierTableSpecific)
+            createIdentifierTableSpecific();
+        ThreadIdentifierTableData& data = **g_identifierTableSpecific;
+
+        return data.defaultIdentifierTable;
+    }
+
+    inline void setDefaultIdentifierTable(IdentifierTable* identifierTable)
+    {
+        if (!g_identifierTableSpecific)
+            createIdentifierTableSpecific();
+        ThreadIdentifierTableData& data = **g_identifierTableSpecific;
+
+        data.defaultIdentifierTable = identifierTable;
+    }
+
+    inline IdentifierTable* currentIdentifierTable()
+    {
+        if (!g_identifierTableSpecific)
+            createIdentifierTableSpecific();
+        ThreadIdentifierTableData& data = **g_identifierTableSpecific;
+
+        return data.currentIdentifierTable;
+    }
+
+    inline IdentifierTable* setCurrentIdentifierTable(IdentifierTable* identifierTable)
+    {
+        if (!g_identifierTableSpecific)
+            createIdentifierTableSpecific();
+        ThreadIdentifierTableData& data = **g_identifierTableSpecific;
+
+        IdentifierTable* oldIdentifierTable = data.currentIdentifierTable;
+        data.currentIdentifierTable = identifierTable;
+        return oldIdentifierTable;
+    }
+
+    inline void resetCurrentIdentifierTable()
+    {
+        if (!g_identifierTableSpecific)
+            createIdentifierTableSpecific();
+        ThreadIdentifierTableData& data = **g_identifierTableSpecific;
+
+        data.currentIdentifierTable = data.defaultIdentifierTable;
+    }
+
 } // namespace JSC
 
 #endif // Identifier_h
index 51d43ee..2605a9a 100644 (file)
@@ -36,7 +36,6 @@
 #include "UString.h"
 #include <wtf/DateMath.h>
 #include <wtf/Threading.h>
-#include <wtf/WTFThreadData.h>
 
 using namespace WTF;
 
@@ -49,7 +48,6 @@ static pthread_once_t initializeThreadingKeyOnce = PTHREAD_ONCE_INIT;
 static void initializeThreadingOnce()
 {
     WTF::initializeThreading();
-    wtfThreadData();
     initializeUString();
     JSGlobalData::storeVPtrs();
 #if ENABLE(JSC_MULTIPLE_THREADS)
index d739d75..1600c77 100644 (file)
@@ -49,7 +49,6 @@
 #include "Lookup.h"
 #include "Nodes.h"
 #include "Parser.h"
-#include <wtf/WTFThreadData.h>
 
 #if ENABLE(JSC_MULTIPLE_THREADS)
 #include <wtf/Threading.h>
@@ -204,7 +203,8 @@ PassRefPtr<JSGlobalData> JSGlobalData::createNonDefault()
 PassRefPtr<JSGlobalData> JSGlobalData::create()
 {
     JSGlobalData* globalData = new JSGlobalData(false);
-    wtfThreadData().initializeIdentifierTable(globalData->identifierTable);
+    setDefaultIdentifierTable(globalData->identifierTable);
+    setCurrentIdentifierTable(globalData->identifierTable);
     return adoptRef(globalData);
 }
 
diff --git a/JavaScriptCore/wtf/WTFThreadData.cpp b/JavaScriptCore/wtf/WTFThreadData.cpp
deleted file mode 100644 (file)
index bbc9986..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-#include "config.h"
-#include "WTFThreadData.h"
-
-namespace WTF {
-
-#if WTFTHREADDATA_MULTITHREADED
-ThreadSpecific<WTFThreadData>* WTFThreadData::staticData;
-#else
-WTFThreadData* WTFThreadData::staticData;
-#endif
-
-WTFThreadData::WTFThreadData()
-    : m_atomicStringTable(0)
-    , m_atomicStringTableDestructor(0)
-#if USE(JSC)
-    , m_defaultIdentifierTable(0)
-    , m_currentIdentifierTable(0)
-#endif
-{
-}
-
-WTFThreadData::~WTFThreadData()
-{
-    if (m_atomicStringTableDestructor)
-        m_atomicStringTableDestructor(m_atomicStringTable);
-}
-
-} // namespace WebCore
diff --git a/JavaScriptCore/wtf/WTFThreadData.h b/JavaScriptCore/wtf/WTFThreadData.h
deleted file mode 100644 (file)
index 18ba44b..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-#ifndef WTFThreadData_h
-#define WTFThreadData_h
-
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/Noncopyable.h>
-
-// This was ENABLE(WORKERS) in WebCore, but this is not defined when compiling JSC.
-// However this check was not correct anyway, re this comment:
-//    // FIXME: Workers are not necessarily the only feature that make per-thread global data necessary.
-//    // We need to check for e.g. database objects manipulating strings on secondary threads.
-// Always enabling this is safe, and should be a better option until we can come up
-// with a better define.
-#define WTFTHREADDATA_MULTITHREADED 1
-
-#if WTFTHREADDATA_MULTITHREADED
-#include <wtf/ThreadSpecific.h>
-#include <wtf/Threading.h>
-#endif
-
-// FIXME: This is a temporary layering violation while we move more string code to WTF.
-namespace JSC {
-class IdentifierTable;
-}
-
-// FIXME: This is a temporary layering violation while we move more string code to WTF.
-namespace WebCore {
-class AtomicStringTable;
-}
-
-typedef void (*AtomicStringTableDestructor)(WebCore::AtomicStringTable*);
-
-namespace WTF {
-
-class WTFThreadData : public Noncopyable {
-public:
-    WTFThreadData();
-    ~WTFThreadData();
-
-    WebCore::AtomicStringTable* atomicStringTable()
-    {
-        return m_atomicStringTable;
-    }
-
-#if USE(JSC)
-    void initializeIdentifierTable(JSC::IdentifierTable* identifierTable)
-    {
-        m_defaultIdentifierTable = identifierTable;
-        m_currentIdentifierTable = identifierTable;
-    }
-
-    JSC::IdentifierTable* currentIdentifierTable()
-    {
-        return m_currentIdentifierTable;
-    }
-
-    JSC::IdentifierTable* setCurrentIdentifierTable(JSC::IdentifierTable* identifierTable)
-    {
-        JSC::IdentifierTable* oldIdentifierTable = m_currentIdentifierTable;
-        m_currentIdentifierTable = identifierTable;
-        return oldIdentifierTable;
-    }
-
-    void resetCurrentIdentifierTable()
-    {
-        m_currentIdentifierTable = m_defaultIdentifierTable;
-    }
-#endif
-
-private:
-    WebCore::AtomicStringTable* m_atomicStringTable;
-    AtomicStringTableDestructor m_atomicStringTableDestructor;
-
-#if USE(JSC)
-    JSC::IdentifierTable* m_defaultIdentifierTable;
-    JSC::IdentifierTable* m_currentIdentifierTable;
-#endif
-
-#if WTFTHREADDATA_MULTITHREADED
-    static ThreadSpecific<WTFThreadData>* staticData;
-#else
-    static WTFThreadData* staticData;
-#endif
-    friend WTFThreadData& wtfThreadData();
-    friend class WebCore::AtomicStringTable;
-};
-
-inline WTFThreadData& wtfThreadData()
-{
-#if WTFTHREADDATA_MULTITHREADED
-    // WRT WebCore:
-    //    WTFThreadData is used on main thread before it could possibly be used
-    //    on secondary ones, so there is no need for synchronization here.
-    // WRT JavaScriptCore:
-    //    wtfThreadData() is initially called from initializeThreading(), ensuring
-    //    this is initially called in a pthread_once locked context.
-    if (!WTFThreadData::staticData)
-        WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
-    return **WTFThreadData::staticData;
-#else
-    if (!WTFThreadData::staticData) {
-        WTFThreadData::staticData = static_cast<WTFThreadData*>(fastMalloc(sizeof(WTFThreadData)));
-        // WTFThreadData constructor indirectly uses staticData, so we need to set up the memory before invoking it.
-        new (WTFThreadData::staticData) WTFThreadData;
-    }
-    return *WTFThreadData::staticData;
-#endif
-}
-
-} // namespace WTF
-
-using WTF::WTFThreadData;
-using WTF::wtfThreadData;
-
-#endif // WTFThreadData_h
index d3a9e97..4a7ea31 100644 (file)
@@ -1,3 +1,15 @@
+2010-04-19  Gavin Barraclough  <barraclough@apple.com>
+
+        Reviewed by NOBODY (rolling out r57829).
+        This broke windows.
+
+        * ForwardingHeaders/wtf/WTFThreadData.h: Removed.
+        * JSUtils.cpp:
+        (JSGlueAPIEntry::JSGlueAPIEntry):
+        (JSGlueAPIEntry::~JSGlueAPIEntry):
+        (JSGlueAPICallback::JSGlueAPICallback):
+        (JSGlueAPICallback::~JSGlueAPICallback):
+
 2010-04-16  Gavin Barraclough  <barraclough@apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/WTFThreadData.h b/JavaScriptGlue/ForwardingHeaders/wtf/WTFThreadData.h
deleted file mode 100644 (file)
index 925b698..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/WTFThreadData.h>
index a4a2ba7..67dba86 100644 (file)
@@ -36,7 +36,6 @@
 #include "UserObjectImp.h"
 #include <JavaScriptCore/JSString.h>
 #include <JavaScriptCore/PropertyNameArray.h>
-#include <JavaScriptCore/WTFThreadData.h>
 
 struct ObjectImpList {
     JSObject* imp;
@@ -428,23 +427,23 @@ ExecState* getThreadGlobalExecState()
 
 JSGlueAPIEntry::JSGlueAPIEntry()
     : m_lock(LockForReal)
-    , m_storedIdentifierTable(wtfThreadData().currentIdentifierTable())
+    , m_storedIdentifierTable(currentIdentifierTable())
 {
-    wtfThreadData().setCurrentIdentifierTable(getThreadGlobalObject()->globalExec()->globalData().identifierTable);
+    setCurrentIdentifierTable(getThreadGlobalObject()->globalExec()->globalData().identifierTable);
 }
 
 JSGlueAPIEntry::~JSGlueAPIEntry()
 {
-    wtfThreadData().setCurrentIdentifierTable(m_storedIdentifierTable);
+    setCurrentIdentifierTable(m_storedIdentifierTable);
 }
 
 JSGlueAPICallback::JSGlueAPICallback(ExecState* exec)
     : m_dropLocks(exec)
 {
-    wtfThreadData().resetCurrentIdentifierTable();
+    resetCurrentIdentifierTable();
 }
 
 JSGlueAPICallback::~JSGlueAPICallback()
 {
-    wtfThreadData().setCurrentIdentifierTable(getThreadGlobalObject()->globalExec()->globalData().identifierTable);
+    setCurrentIdentifierTable(getThreadGlobalObject()->globalExec()->globalData().identifierTable);
 }
index 88bd8c0..86422fc 100644 (file)
@@ -1,3 +1,17 @@
+2010-04-19  Gavin Barraclough  <barraclough@apple.com>
+
+        Reviewed by NOBODY (rolling out r57829).
+        This broke windows.
+
+        * ForwardingHeaders/wtf/WTFThreadData.h: Removed.
+        * platform/ThreadGlobalData.cpp:
+        (WebCore::ThreadGlobalData::ThreadGlobalData):
+        (WebCore::ThreadGlobalData::~ThreadGlobalData):
+        * platform/ThreadGlobalData.h:
+        (WebCore::ThreadGlobalData::atomicStringTable):
+        * platform/text/AtomicString.cpp:
+        (WebCore::stringTable):
+
 2010-04-19  Mark Rowe  <mrowe@apple.com>
 
         Build fix.
diff --git a/WebCore/ForwardingHeaders/wtf/WTFThreadData.h b/WebCore/ForwardingHeaders/wtf/WTFThreadData.h
deleted file mode 100644 (file)
index a08417a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WebCore_FWD_WTFThreadData_h
-#define WebCore_FWD_WTFThreadData_h
-#include <JavaScriptCore/WTFThreadData.h>
-#endif
index 434ee5a..ea8ee20 100644 (file)
@@ -31,7 +31,6 @@
 #include "StringImpl.h"
 #include "ThreadTimers.h"
 #include <wtf/UnusedParam.h>
-#include <wtf/WTFThreadData.h>
 
 #if USE(ICU_UNICODE)
 #include "TextCodecICU.h"
@@ -56,7 +55,8 @@ ThreadGlobalData* ThreadGlobalData::staticData;
 #endif
 
 ThreadGlobalData::ThreadGlobalData()
-    : m_eventNames(new EventNames)
+    : m_atomicStringTable(new HashSet<StringImpl*>)
+    , m_eventNames(new EventNames)
     , m_threadTimers(new ThreadTimers)
 #ifndef NDEBUG
     , m_isMainThread(isMainThread())
@@ -68,11 +68,11 @@ ThreadGlobalData::ThreadGlobalData()
     , m_cachedConverterTEC(new TECConverterWrapper)
 #endif
 {
+    // StringImpl::empty() does not construct its static string in a threadsafe fashion,
+    // so ensure it has been initialized from here.
+    //
     // This constructor will have been called on the main thread before being called on
-    // any other thread, and is only called once per thread – this makes this a convenient
-    // point to call methods that internally perform a one-time initialization that is not
-    // threadsafe.
-    wtfThreadData();
+    // any other thread, and is only called once per thread.
     StringImpl::empty();
 }
 
@@ -85,6 +85,7 @@ ThreadGlobalData::~ThreadGlobalData()
     delete m_cachedConverterICU;
 #endif
     delete m_eventNames;
+    delete m_atomicStringTable;
     delete m_threadTimers;
 }
 
index 3d73932..a984645 100644 (file)
@@ -51,6 +51,7 @@ namespace WebCore {
         ~ThreadGlobalData();
 
         EventNames& eventNames() { return *m_eventNames; }
+        HashSet<StringImpl*>& atomicStringTable() { return *m_atomicStringTable; }
         ThreadTimers& threadTimers() { return *m_threadTimers; }
 
 #if USE(ICU_UNICODE)
@@ -62,6 +63,7 @@ namespace WebCore {
 #endif
 
     private:
+        HashSet<StringImpl*>* m_atomicStringTable;
         EventNames* m_eventNames;
         ThreadTimers* m_threadTimers;
 
index 039ab81..53d3f02 100644 (file)
 
 #include "StaticConstructors.h"
 #include "StringHash.h"
+#include "ThreadGlobalData.h"
 #include <wtf/Threading.h>
 #include <wtf/HashSet.h>
-#include <wtf/WTFThreadData.h>
 
 namespace WebCore {
 
-class AtomicStringTable {
-public:
-    static AtomicStringTable* create()
-    {
-        AtomicStringTable* table = new AtomicStringTable;
-
-        WTFThreadData& data = wtfThreadData();
-        data.m_atomicStringTable = table;
-        data.m_atomicStringTableDestructor = AtomicStringTable::destroy;
-
-        return table;
-    }
-
-    HashSet<StringImpl*>& table()
-    {
-        return m_table;
-    }
-
-private:
-    static void destroy(AtomicStringTable* table)
-    {
-        delete table;
-    }
-
-    HashSet<StringImpl*> m_table;
-};
-
 static inline HashSet<StringImpl*>& stringTable()
 {
-    // Once possible we should make this non-lazy (constructed in WTFThreadData's constructor).
-    AtomicStringTable* table = wtfThreadData().atomicStringTable();
-    if (UNLIKELY(!table))
-        table = AtomicStringTable::create();
-    return table->table();
+    return threadGlobalData().atomicStringTable();
 }
 
 struct CStringTranslator {