Changeset 57853 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Apr 19, 2010, 4:26:29 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Completion.cpp
r57829 r57853 30 30 #include "Parser.h" 31 31 #include "Debugger.h" 32 #include "WTFThreadData.h"33 32 #include <stdio.h> 34 33 … … 38 37 { 39 38 JSLock lock(exec); 40 ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable());39 ASSERT(exec->globalData().identifierTable == currentIdentifierTable()); 41 40 42 41 RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source); … … 51 50 { 52 51 JSLock lock(exec); 53 ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable());52 ASSERT(exec->globalData().identifierTable == currentIdentifierTable()); 54 53 55 54 RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source); -
trunk/JavaScriptCore/runtime/Identifier.cpp
r57829 r57853 29 29 #include <wtf/FastMalloc.h> 30 30 #include <wtf/HashSet.h> 31 #include <wtf/WTFThreadData.h>32 31 33 32 using WTF::ThreadSpecific; … … 230 229 void Identifier::remove(UString::Rep* r) 231 230 { 232 wtfThreadData().currentIdentifierTable()->remove(r);231 currentIdentifierTable()->remove(r); 233 232 } 234 233 … … 254 253 // Check the identifier table accessible through the threadspecific matches the 255 254 // globalData's identifier table. 256 ASSERT_UNUSED(globalData, globalData->identifierTable == wtfThreadData().currentIdentifierTable());255 ASSERT_UNUSED(globalData, globalData->identifierTable == currentIdentifierTable()); 257 256 } 258 257 … … 271 270 #endif 272 271 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 273 298 } // namespace JSC -
trunk/JavaScriptCore/runtime/Identifier.h
r57829 r57853 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 143 204 } // namespace JSC 144 205 -
trunk/JavaScriptCore/runtime/InitializeThreading.cpp
r57829 r57853 37 37 #include <wtf/DateMath.h> 38 38 #include <wtf/Threading.h> 39 #include <wtf/WTFThreadData.h>40 39 41 40 using namespace WTF; … … 50 49 { 51 50 WTF::initializeThreading(); 52 wtfThreadData();53 51 initializeUString(); 54 52 JSGlobalData::storeVPtrs(); -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r57829 r57853 50 50 #include "Nodes.h" 51 51 #include "Parser.h" 52 #include <wtf/WTFThreadData.h>53 52 54 53 #if ENABLE(JSC_MULTIPLE_THREADS) … … 205 204 { 206 205 JSGlobalData* globalData = new JSGlobalData(false); 207 wtfThreadData().initializeIdentifierTable(globalData->identifierTable); 206 setDefaultIdentifierTable(globalData->identifierTable); 207 setCurrentIdentifierTable(globalData->identifierTable); 208 208 return adoptRef(globalData); 209 209 }
Note:
See TracChangeset
for help on using the changeset viewer.