Skip to content

Commit 0bf94cf

Browse files
committed
[JSC] Replace an unreachable branch in Heap::stopTheMutator with an assert
https://bugs.webkit.org/show_bug.cgi?id=328987 rdar://191050629 Reviewed by Yusuke Suzuki. Heap::stopTheMutator returned false when the mutator already held the conn, after asserting that the mutator had no heap access. That branch is never taken: only the collector thread calls stopTheMutator, and only while it is conducting, so no mutator holds the conn. Its asserts could not hold either: a mutator is given the conn only while it has heap access, and releasing heap access also gives up the conn. Replace the branch, and the two other asserts that the mutator does not hold the conn, with one assert at the top of the loop. * Source/JavaScriptCore/heap/Heap.cpp: (JSC::Heap::clearConcurrentRetainedDataIfPossible): Canonical link: https://commits.webkit.org/324791@main
1 parent be58304 commit 0bf94cf

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

‎Source/JavaScriptCore/heap/Heap.cpp‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,21 +1403,16 @@ bool Heap::stopTheMutator()
14031403
{
14041404
for (;;) {
14051405
unsigned oldState = m_worldState.load();
1406+
// Only called by the collector thread when it is conducting.
1407+
RELEASE_ASSERT(!(oldState & mutatorHasConnBit));
1408+
14061409
if (oldState & stoppedBit) {
14071410
RELEASE_ASSERT(!(oldState & hasAccessBit));
14081411
RELEASE_ASSERT(!(oldState & mutatorWaitingBit));
1409-
RELEASE_ASSERT(!(oldState & mutatorHasConnBit));
14101412
return true;
14111413
}
1412-
1413-
if (oldState & mutatorHasConnBit) {
1414-
RELEASE_ASSERT(!(oldState & hasAccessBit));
1415-
RELEASE_ASSERT(!(oldState & stoppedBit));
1416-
return false;
1417-
}
14181414

14191415
if (!(oldState & hasAccessBit)) {
1420-
RELEASE_ASSERT(!(oldState & mutatorHasConnBit));
14211416
RELEASE_ASSERT(!(oldState & mutatorWaitingBit));
14221417
// We can stop the world instantly.
14231418
if (m_worldState.compareExchangeWeak(oldState, oldState | stoppedBit))

0 commit comments

Comments
 (0)