Changeset 32652 in webkit for trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
- Timestamp:
- Apr 28, 2008, 11:22:14 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r32587 r32652 45 45 #include "string_object.h" 46 46 47 #if USE(MULTIPLE_THREADS) 48 #include <wtf/ThreadSpecific.h> 49 using namespace WTF; 50 #endif 51 47 52 #if HAVE(SYS_TIME_H) 48 53 #include <sys/time.h> … … 58 63 59 64 namespace KJS { 65 66 extern HashTable arrayTable; 67 extern HashTable dateTable; 68 extern HashTable mathTable; 69 extern HashTable numberTable; 70 extern HashTable RegExpImpTable; 71 extern HashTable RegExpObjectImpTable; 72 extern HashTable stringTable; 60 73 61 74 // Default number of ticks before a timeout check should be done. … … 119 132 } 120 133 121 void JSGlobalObject::init() 134 struct ThreadClassInfoHashTables { 135 ThreadClassInfoHashTables() 136 : arrayTable(KJS::arrayTable) 137 , dateTable(KJS::dateTable) 138 , mathTable(KJS::mathTable) 139 , numberTable(KJS::numberTable) 140 , RegExpImpTable(KJS::RegExpImpTable) 141 , RegExpObjectImpTable(KJS::RegExpObjectImpTable) 142 , stringTable(KJS::stringTable) 143 { 144 } 145 146 ~ThreadClassInfoHashTables() 147 { 148 #if USE(MULTIPLE_THREADS) 149 delete[] arrayTable.table; 150 delete[] dateTable.table; 151 delete[] mathTable.table; 152 delete[] numberTable.table; 153 delete[] RegExpImpTable.table; 154 delete[] RegExpObjectImpTable.table; 155 delete[] stringTable.table; 156 #endif 157 } 158 159 #if USE(MULTIPLE_THREADS) 160 HashTable arrayTable; 161 HashTable dateTable; 162 HashTable mathTable; 163 HashTable numberTable; 164 HashTable RegExpImpTable; 165 HashTable RegExpObjectImpTable; 166 HashTable stringTable; 167 #else 168 HashTable& arrayTable; 169 HashTable& dateTable; 170 HashTable& mathTable; 171 HashTable& numberTable; 172 HashTable& RegExpImpTable; 173 HashTable& RegExpObjectImpTable; 174 HashTable& stringTable; 175 #endif 176 }; 177 178 ThreadClassInfoHashTables* JSGlobalObject::threadClassInfoHashTables() 179 { 180 #if USE(MULTIPLE_THREADS) 181 static ThreadSpecific<ThreadClassInfoHashTables> sharedInstance; 182 return sharedInstance; 183 #else 184 static ThreadClassInfoHashTables sharedInstance; 185 return &sharedInstance; 186 #endif 187 } 188 189 void JSGlobalObject::init(JSObject* thisValue) 122 190 { 123 191 ASSERT(JSLock::currentThreadIsHoldingLock()); … … 142 210 d()->activations = newStackNode; 143 211 d()->activationCount = 0; 212 213 d()->perThreadData.arrayTable = &threadClassInfoHashTables()->arrayTable; 214 d()->perThreadData.dateTable = &threadClassInfoHashTables()->dateTable; 215 d()->perThreadData.mathTable = &threadClassInfoHashTables()->mathTable; 216 d()->perThreadData.numberTable = &threadClassInfoHashTables()->numberTable; 217 d()->perThreadData.RegExpImpTable = &threadClassInfoHashTables()->RegExpImpTable; 218 d()->perThreadData.RegExpObjectImpTable = &threadClassInfoHashTables()->RegExpObjectImpTable; 219 d()->perThreadData.stringTable = &threadClassInfoHashTables()->stringTable; 220 d()->perThreadData.propertyNames = CommonIdentifiers::shared(); 221 222 d()->globalExec.set(new GlobalExecState(this, thisValue)); 144 223 145 224 d()->pageGroupIdentifier = 0; … … 232 311 d()->evalFunction = 0; 233 312 234 ExecState* exec = &d()->globalExec;313 ExecState* exec = d()->globalExec.get(); 235 314 236 315 // Prototypes … … 419 498 (*it)->m_scopeChain.mark(); 420 499 421 markIfNeeded(d()->globalExec .exception());500 markIfNeeded(d()->globalExec->exception()); 422 501 423 502 markIfNeeded(d()->objectConstructor); … … 463 542 ExecState* JSGlobalObject::globalExec() 464 543 { 465 return &d()->globalExec;544 return d()->globalExec.get(); 466 545 } 467 546 … … 493 572 } 494 573 574 495 575 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.