Changeset 115579 in webkit for trunk/Source/JavaScriptCore/heap/Heap.cpp
- Timestamp:
- Apr 28, 2012, 1:51:27 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/Heap.cpp
r115545 r115579 342 342 Heap::~Heap() 343 343 { 344 // Destroy our block freeing thread. 344 delete m_markListSet; 345 346 m_objectSpace.shrink(); 347 m_storageSpace.freeAllBlocks(); 348 releaseFreeBlocks(); 345 349 { 346 350 MutexLocker locker(m_freeBlockLock); … … 350 354 waitForThreadCompletion(m_blockFreeingThread); 351 355 352 // The destroy function must already have been called, so assert this. 353 ASSERT(!m_globalData); 354 } 355 356 void Heap::destroy() 357 { 358 JSLock lock(SilenceAssertionsOnly); 359 360 if (!m_globalData) 361 return; 362 356 ASSERT(!size()); 357 ASSERT(!capacity()); 358 } 359 360 // The JSGlobalData is being destroyed and the collector will never run again. 361 // Run all pending finalizers now because we won't get another chance. 362 void Heap::lastChanceToFinalize() 363 { 363 364 ASSERT(!m_globalData->dynamicGlobalObject); 364 365 ASSERT(m_operationInProgress == NoOperation); 365 366 // The global object is not GC protected at this point, so sweeping may delete it 367 // (and thus the global data) before other objects that may use the global data. 368 RefPtr<JSGlobalData> protect(m_globalData); 369 370 #if ENABLE(JIT) 371 m_globalData->jitStubs->clearHostFunctionStubs(); 372 #endif 373 374 delete m_markListSet; 375 m_markListSet = 0; 376 366 367 // FIXME: Make this a release-mode crash once we're sure no one's doing this. 368 if (size_t size = m_protectedValues.size()) 369 LOG_ERROR("JavaScriptCore heap deallocated while %ld values were still protected", size); 370 371 m_weakSet.finalizeAll(); 377 372 canonicalizeCellLivenessData(); 378 373 clearMarks(); 379 380 m_weakSet.finalizeAll(); 374 sweep(); 381 375 m_globalData->smallStrings.finalizeSmallStrings(); 382 m_objectSpace.shrink();383 m_storageSpace.destroy();384 ASSERT(!size());385 376 386 377 #if ENABLE(SIMPLE_HEAP_PROFILING) … … 388 379 m_destroyedTypeCounts.dump(WTF::dataFile(), "Destroyed Type Counts"); 389 380 #endif 390 391 releaseFreeBlocks();392 393 m_globalData = 0;394 381 } 395 382
Note:
See TracChangeset
for help on using the changeset viewer.