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