@@ -44,7 +44,7 @@ MarkedBlock::Handle* MarkedBlock::tryCreate(Heap& heap)
4444 if (computeBalance) {
4545 balance++;
4646 if (!(balance % 10 ))
47- dataLog (" MarkedBlock Balance: " , balance, " \n " );
47+ dataLog (toCString ( " MarkedBlock Balance: " , balance, " \n " ) );
4848 }
4949 void * blockSpace = tryFastAlignedMalloc (blockSize, blockSize);
5050 if (!blockSpace)
@@ -71,7 +71,7 @@ MarkedBlock::Handle::~Handle()
7171 if (computeBalance) {
7272 balance--;
7373 if (!(balance % 10 ))
74- dataLog (" MarkedBlock Balance: " , balance, " \n " );
74+ dataLog (toCString ( " MarkedBlock Balance: " , balance, " \n " ) );
7575 }
7676 removeFromAllocator ();
7777 m_block->~MarkedBlock ();
@@ -85,7 +85,7 @@ MarkedBlock::MarkedBlock(VM& vm, Handle& handle)
8585 , m_vm(&vm)
8686{
8787 if (false )
88- dataLog (RawPointer (this ), " : Allocated.\n " );
88+ dataLog (toCString ( RawPointer (this ), " : Allocated.\n " ) );
8989}
9090
9191template <MarkedBlock::Handle::EmptyMode emptyMode, MarkedBlock::Handle::SweepMode sweepMode, MarkedBlock::Handle::SweepDestructionMode destructionMode, MarkedBlock::Handle::ScribbleMode scribbleMode, MarkedBlock::Handle::NewlyAllocatedMode newlyAllocatedMode, MarkedBlock::Handle::MarksMode marksMode>
@@ -98,22 +98,19 @@ FreeList MarkedBlock::Handle::specializedSweep()
9898 MarkedBlock& block = this ->block ();
9999
100100 if (false )
101- dataLog (RawPointer (this ), " /" , RawPointer (&block), " : MarkedBlock::Handle::specializedSweep!\n " );
101+ dataLog (toCString ( RawPointer (this ), " /" , RawPointer (&block), " : MarkedBlock::Handle::specializedSweep!\n " ) );
102102
103103 if (Options::useBumpAllocator ()
104104 && emptyMode == IsEmpty
105105 && newlyAllocatedMode == DoesNotHaveNewlyAllocated) {
106106
107107 // This is an incredibly powerful assertion that checks the sanity of our block bits.
108108 if (marksMode == MarksNotStale && !block.m_marks .isEmpty ()) {
109- WTF::dataFile ().atomically (
110- [&] (PrintStream& out) {
111- out.print (" Block " , RawPointer (&block), " : marks not empty!\n " );
112- out.print (" Block lock is held: " , block.m_lock .isHeld (), " \n " );
113- out.print (" Marking version of block: " , block.m_markingVersion , " \n " );
114- out.print (" Marking version of heap: " , space ()->markingVersion (), " \n " );
115- UNREACHABLE_FOR_PLATFORM ();
116- });
109+ dataLog (toCString (" Block " , RawPointer (&block), " : marks not empty!\n " ));
110+ dataLog (toCString (" Block lock is held: " , block.m_lock .isHeld (), " \n " ));
111+ dataLog (toCString (" Marking version of block: " , block.m_markingVersion , " \n " ));
112+ dataLog (toCString (" Marking version of heap: " , space ()->markingVersion (), " \n " ));
113+ RELEASE_ASSERT_NOT_REACHED ();
117114 }
118115
119116 char * startOfLastCell = static_cast <char *>(cellAlign (block.atoms () + m_endAtom - 1 ));
@@ -130,7 +127,7 @@ FreeList MarkedBlock::Handle::specializedSweep()
130127 block.m_lock .unlock ();
131128 FreeList result = FreeList::bump (payloadEnd, payloadEnd - payloadBegin);
132129 if (false )
133- dataLog (" Quickly swept block " , RawPointer (this ), " with cell size " , cellSize (), " and attributes " , m_attributes, " : " , result, " \n " );
130+ dataLog (toCString ( " Quickly swept block " , RawPointer (this ), " with cell size " , cellSize (), " and attributes " , m_attributes, " : " , result, " \n " ) );
134131 return result;
135132 }
136133
@@ -189,7 +186,7 @@ FreeList MarkedBlock::Handle::specializedSweep()
189186 else if (isEmpty)
190187 m_allocator->setIsEmpty (NoLockingNecessary, this , true );
191188 if (false )
192- dataLog (" Slowly swept block " , RawPointer (&block), " with cell size " , cellSize (), " and attributes " , m_attributes, " : " , result, " \n " );
189+ dataLog (toCString ( " Slowly swept block " , RawPointer (&block), " with cell size " , cellSize (), " and attributes " , m_attributes, " : " , result, " \n " ) );
193190 return result;
194191}
195192
@@ -265,7 +262,7 @@ FreeList MarkedBlock::Handle::sweepHelperSelectMarksMode()
265262 HeapVersion markingVersion = space ()->markingVersion ();
266263 bool marksAreUseful = !block ().areMarksStale (markingVersion);
267264
268- if (space ()->isMarking ())
265+ if (space ()->isMarking () && heap ()-> collectionScope () == CollectionScope::Full )
269266 marksAreUseful |= block ().marksConveyLivenessDuringMarking (markingVersion);
270267
271268 if (!marksAreUseful)
@@ -290,20 +287,20 @@ void MarkedBlock::Handle::stopAllocating(const FreeList& freeList)
290287 auto locker = holdLock (block ().m_lock );
291288
292289 if (false )
293- dataLog (RawPointer (this ), " : MarkedBlock::Handle::stopAllocating!\n " );
290+ dataLog (toCString ( RawPointer (this ), " : MarkedBlock::Handle::stopAllocating!\n " ) );
294291 ASSERT (!allocator ()->isAllocated (NoLockingNecessary, this ));
295292
296293 if (!isFreeListed ()) {
297294 if (false )
298- dataLog (" There ain't no newly allocated.\n " );
295+ dataLog (toCString ( " There ain't no newly allocated.\n " ) );
299296 // This means that we either didn't use this block at all for allocation since last GC,
300297 // or someone had already done stopAllocating() before.
301298 ASSERT (freeList.allocationWillFail ());
302299 return ;
303300 }
304301
305302 if (false )
306- dataLog (" Free list: " , freeList, " \n " );
303+ dataLog (toCString ( " Free list: " , freeList, " \n " ) );
307304
308305 // Roll back to a coherent state for Heap introspection. Cells newly
309306 // allocated from our free list are not currently marked, so we need another
@@ -322,7 +319,7 @@ void MarkedBlock::Handle::stopAllocating(const FreeList& freeList)
322319 freeList,
323320 [&] (HeapCell* cell) {
324321 if (false )
325- dataLog (" Free cell: " , RawPointer (cell), " \n " );
322+ dataLog (toCString ( " Free cell: " , RawPointer (cell), " \n " ) );
326323 if (m_attributes.destruction == NeedsDestruction)
327324 cell->zap ();
328325 clearNewlyAllocated (cell);
@@ -349,13 +346,13 @@ FreeList MarkedBlock::Handle::resumeAllocating()
349346 auto locker = holdLock (block ().m_lock );
350347
351348 if (false )
352- dataLog (RawPointer (this ), " : MarkedBlock::Handle::resumeAllocating!\n " );
349+ dataLog (toCString ( RawPointer (this ), " : MarkedBlock::Handle::resumeAllocating!\n " ) );
353350 ASSERT (!allocator ()->isAllocated (NoLockingNecessary, this ));
354351 ASSERT (!isFreeListed ());
355352
356353 if (!hasAnyNewlyAllocated ()) {
357354 if (false )
358- dataLog (" There ain't no newly allocated.\n " );
355+ dataLog (toCString ( " There ain't no newly allocated.\n " ) );
359356 // This means we had already exhausted the block when we stopped allocation.
360357 return FreeList ();
361358 }
@@ -404,7 +401,7 @@ void MarkedBlock::aboutToMarkSlow(HeapVersion markingVersion)
404401 if (handle ().allocator ()->isAllocated (holdLock (allocator->bitvectorLock ()), &handle ())
405402 || !marksConveyLivenessDuringMarking (markingVersion)) {
406403 if (false )
407- dataLog (RawPointer (this ), " : Clearing marks without doing anything else.\n " );
404+ dataLog (toCString ( RawPointer (this ), " : Clearing marks without doing anything else.\n " ) );
408405 // We already know that the block is full and is already recognized as such, or that the
409406 // block did not survive the previous GC. So, we can clear mark bits the old fashioned
410407 // way. Note that it's possible for such a block to have newlyAllocated with an up-to-
@@ -414,7 +411,7 @@ void MarkedBlock::aboutToMarkSlow(HeapVersion markingVersion)
414411 m_marks.clearAll ();
415412 } else {
416413 if (false )
417- dataLog (RawPointer (this ), " : Doing things.\n " );
414+ dataLog (toCString ( RawPointer (this ), " : Doing things.\n " ) );
418415 HeapVersion newlyAllocatedVersion = space ()->newlyAllocatedVersion ();
419416 if (handle ().m_newlyAllocatedVersion == newlyAllocatedVersion) {
420417 // Merge the contents of marked into newlyAllocated. If we get the full set of bits
@@ -480,7 +477,7 @@ void MarkedBlock::Handle::didConsumeFreeList()
480477{
481478 auto locker = holdLock (block ().m_lock );
482479 if (false )
483- dataLog (RawPointer (this ), " : MarkedBlock::Handle::didConsumeFreeList!\n " );
480+ dataLog (toCString ( RawPointer (this ), " : MarkedBlock::Handle::didConsumeFreeList!\n " ) );
484481 ASSERT (isFreeListed ());
485482 m_isFreeListed = false ;
486483 allocator ()->setIsAllocated (NoLockingNecessary, this , true );
@@ -576,16 +573,6 @@ void MarkedBlock::assertValidCell(VM& vm, HeapCell* cell) const
576573}
577574#endif
578575
579- void MarkedBlock::Handle::dumpState (PrintStream& out)
580- {
581- CommaPrinter comma;
582- allocator ()->forEachBitVectorWithName (
583- holdLock (allocator ()->bitvectorLock ()),
584- [&] (FastBitVector& bitvector, const char * name) {
585- out.print (comma, name, " :" , bitvector[index ()] ? " YES" : " no" );
586- });
587- }
588-
589576} // namespace JSC
590577
591578namespace WTF {
0 commit comments