Changeset 57879 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Apr 20, 2010, 1:30:12 AM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Completion.cpp
r57853 r57879 30 30 #include "Parser.h" 31 31 #include "Debugger.h" 32 #include "WTFThreadData.h" 32 33 #include <stdio.h> 33 34 … … 37 38 { 38 39 JSLock lock(exec); 39 ASSERT(exec->globalData().identifierTable == currentIdentifierTable());40 ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable()); 40 41 41 42 RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source); … … 50 51 { 51 52 JSLock lock(exec); 52 ASSERT(exec->globalData().identifierTable == currentIdentifierTable());53 ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable()); 53 54 54 55 RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source); -
trunk/JavaScriptCore/runtime/Identifier.cpp
r57853 r57879 29 29 #include <wtf/FastMalloc.h> 30 30 #include <wtf/HashSet.h> 31 #include <wtf/WTFThreadData.h> 31 32 32 33 using WTF::ThreadSpecific; … … 229 230 void Identifier::remove(UString::Rep* r) 230 231 { 231 currentIdentifierTable()->remove(r);232 wtfThreadData().currentIdentifierTable()->remove(r); 232 233 } 233 234 … … 253 254 // Check the identifier table accessible through the threadspecific matches the 254 255 // globalData's identifier table. 255 ASSERT_UNUSED(globalData, globalData->identifierTable == currentIdentifierTable());256 ASSERT_UNUSED(globalData, globalData->identifierTable == wtfThreadData().currentIdentifierTable()); 256 257 } 257 258 … … 270 271 #endif 271 272 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 #else289 290 void createIdentifierTableSpecific()291 {292 ASSERT(!g_identifierTableSpecific);293 g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();294 }295 296 #endif297 298 273 } // namespace JSC -
trunk/JavaScriptCore/runtime/Identifier.h
r57853 r57879 141 141 void deleteIdentifierTable(IdentifierTable*); 142 142 143 struct ThreadIdentifierTableData {144 ThreadIdentifierTableData()145 : defaultIdentifierTable(0)146 , currentIdentifierTable(0)147 {148 }149 150 IdentifierTable* defaultIdentifierTable;151 IdentifierTable* currentIdentifierTable;152 };153 154 extern WTF::ThreadSpecific<ThreadIdentifierTableData>* g_identifierTableSpecific;155 void createIdentifierTableSpecific();156 157 inline IdentifierTable* defaultIdentifierTable()158 {159 if (!g_identifierTableSpecific)160 createIdentifierTableSpecific();161 ThreadIdentifierTableData& data = **g_identifierTableSpecific;162 163 return data.defaultIdentifierTable;164 }165 166 inline void setDefaultIdentifierTable(IdentifierTable* identifierTable)167 {168 if (!g_identifierTableSpecific)169 createIdentifierTableSpecific();170 ThreadIdentifierTableData& data = **g_identifierTableSpecific;171 172 data.defaultIdentifierTable = identifierTable;173 }174 175 inline IdentifierTable* currentIdentifierTable()176 {177 if (!g_identifierTableSpecific)178 createIdentifierTableSpecific();179 ThreadIdentifierTableData& data = **g_identifierTableSpecific;180 181 return data.currentIdentifierTable;182 }183 184 inline IdentifierTable* setCurrentIdentifierTable(IdentifierTable* identifierTable)185 {186 if (!g_identifierTableSpecific)187 createIdentifierTableSpecific();188 ThreadIdentifierTableData& data = **g_identifierTableSpecific;189 190 IdentifierTable* oldIdentifierTable = data.currentIdentifierTable;191 data.currentIdentifierTable = identifierTable;192 return oldIdentifierTable;193 }194 195 inline void resetCurrentIdentifierTable()196 {197 if (!g_identifierTableSpecific)198 createIdentifierTableSpecific();199 ThreadIdentifierTableData& data = **g_identifierTableSpecific;200 201 data.currentIdentifierTable = data.defaultIdentifierTable;202 }203 204 143 } // namespace JSC 205 144 -
trunk/JavaScriptCore/runtime/InitializeThreading.cpp
r57853 r57879 37 37 #include <wtf/DateMath.h> 38 38 #include <wtf/Threading.h> 39 #include <wtf/WTFThreadData.h> 39 40 40 41 using namespace WTF; … … 49 50 { 50 51 WTF::initializeThreading(); 52 wtfThreadData(); 51 53 initializeUString(); 52 54 JSGlobalData::storeVPtrs(); -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r57853 r57879 50 50 #include "Nodes.h" 51 51 #include "Parser.h" 52 #include <wtf/WTFThreadData.h> 52 53 53 54 #if ENABLE(JSC_MULTIPLE_THREADS) … … 204 205 { 205 206 JSGlobalData* globalData = new JSGlobalData(false); 206 setDefaultIdentifierTable(globalData->identifierTable); 207 setCurrentIdentifierTable(globalData->identifierTable); 207 wtfThreadData().initializeIdentifierTable(globalData->identifierTable); 208 208 return adoptRef(globalData); 209 209 }
Note:
See TracChangeset
for help on using the changeset viewer.