Changeset 116659 in webkit for trunk/Source/JavaScriptCore/heap/MarkStack.cpp
- Timestamp:
- May 10, 2012, 10:32:39 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/MarkStack.cpp
r113455 r116659 37 37 #include "ScopeChain.h" 38 38 #include "Structure.h" 39 #include "UString.h" 39 40 #include "WriteBarrier.h" 40 41 #include <wtf/MainThread.h> … … 219 220 220 221 #if ENABLE(PARALLEL_GC) 221 void MarkStackThreadSharedData::markingThreadMain() 222 void MarkStackThreadSharedData::resetChildren() 223 { 224 for (unsigned i = 0; i < m_slaveMarkStacks.size(); ++i) 225 m_slaveMarkStacks[i]->reset(); 226 } 227 228 void MarkStackThreadSharedData::markingThreadMain(SlotVisitor* slotVisitor) 222 229 { 223 230 WTF::registerGCThread(); 224 SlotVisitor slotVisitor(*this); 225 ParallelModeEnabler enabler(slotVisitor); 226 slotVisitor.drainFromShared(SlotVisitor::SlaveDrain); 227 } 228 229 void MarkStackThreadSharedData::markingThreadStartFunc(void* shared) 230 { 231 static_cast<MarkStackThreadSharedData*>(shared)->markingThreadMain(); 231 ParallelModeEnabler enabler(*slotVisitor); 232 slotVisitor->drainFromShared(SlotVisitor::SlaveDrain); 233 delete slotVisitor; 234 } 235 236 void MarkStackThreadSharedData::markingThreadStartFunc(void* myVisitor) 237 { 238 SlotVisitor* slotVisitor = static_cast<SlotVisitor*>(myVisitor); 239 slotVisitor->sharedData().markingThreadMain(slotVisitor); 232 240 } 233 241 #endif … … 242 250 #if ENABLE(PARALLEL_GC) 243 251 for (unsigned i = 1; i < Options::numberOfGCMarkers; ++i) { 244 m_markingThreads.append(createThread(markingThreadStartFunc, this, "JavaScriptCore::Marking")); 252 SlotVisitor* slotVisitor = new SlotVisitor(*this); 253 m_slaveMarkStacks.append(slotVisitor); 254 m_markingThreads.append(createThread(markingThreadStartFunc, slotVisitor, "JavaScriptCore::Marking")); 245 255 ASSERT(m_markingThreads.last()); 246 256 } … … 274 284 ASSERT(m_opaqueRoots.isEmpty()); 275 285 #endif 276 277 286 m_weakReferenceHarvesters.removeAll(); 278 287 } … … 287 296 m_opaqueRoots.clear(); 288 297 #endif 298 m_uniqueStrings.clear(); 289 299 } 290 300 … … 487 497 } 488 498 499 inline void MarkStack::internalAppend(JSValue* slot) 500 { 501 ASSERT(slot); 502 JSValue value = *slot; 503 ASSERT(value); 504 if (!value.isCell()) 505 return; 506 507 if (value.isString()) { 508 JSString* string = jsCast<JSString*>(value.asCell()); 509 if (!string->isHashConstSingleton() && string->length() > 1 && !string->isRope()) { 510 UniqueStringMap::AddResult addResult = m_uniqueStrings.add(string->string().impl(), value); 511 if (addResult.isNewEntry) 512 string->setHashConstSingleton(); 513 else { 514 JSValue existingJSValue = addResult.iterator->second; 515 if (value != existingJSValue) 516 jsCast<JSString*>(existingJSValue.asCell())->clearHashConstSingleton(); 517 *slot = existingJSValue; 518 return; 519 } 520 } 521 } 522 523 internalAppend(value.asCell()); 524 } 525 526 489 527 void SlotVisitor::copyAndAppend(void** ptr, size_t bytes, JSValue* values, unsigned length) 490 528 { … … 500 538 if (!value) 501 539 continue; 502 internalAppend( value);540 internalAppend(&newValues[i]); 503 541 } 504 542
Note:
See TracChangeset
for help on using the changeset viewer.