Commit 2d767e80 authored by mhahnenberg@apple.com's avatar mhahnenberg@apple.com
Browse files

We should avoid weakCompareAndSwap when parallel GC is disabled

https://bugs.webkit.org/show_bug.cgi?id=99331

Reviewed by Filip Pizlo.

CopiedBlock::reportLiveBytes and didEvacuateBytes uses weakCompareAndSwap, which some platforms 
don't support. For platforms that don't have parallel GC enabled, we should just use a normal store.

* heap/CopiedBlock.h:
(JSC::CopiedBlock::reportLiveBytes):
(JSC::CopiedBlock::didEvacuateBytes):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b5cc6e33
2012-10-15 Mark Hahnenberg <mhahnenberg@apple.com>
We should avoid weakCompareAndSwap when parallel GC is disabled
https://bugs.webkit.org/show_bug.cgi?id=99331
Reviewed by Filip Pizlo.
CopiedBlock::reportLiveBytes and didEvacuateBytes uses weakCompareAndSwap, which some platforms
don't support. For platforms that don't have parallel GC enabled, we should just use a normal store.
* heap/CopiedBlock.h:
(JSC::CopiedBlock::reportLiveBytes):
(JSC::CopiedBlock::didEvacuateBytes):
2012-10-15 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Fix make distcheck.
......
......@@ -119,12 +119,16 @@ inline CopiedBlock::CopiedBlock(Region* region)
inline void CopiedBlock::reportLiveBytes(unsigned bytes)
{
#if ENABLE(PARALLEL_GC)
unsigned oldValue = 0;
unsigned newValue = 0;
do {
oldValue = m_liveBytes;
newValue = oldValue + bytes;
} while (!WTF::weakCompareAndSwap(&m_liveBytes, oldValue, newValue));
#else
m_liveBytes += bytes;
#endif
}
inline void CopiedBlock::didSurviveGC()
......@@ -136,6 +140,7 @@ inline void CopiedBlock::didSurviveGC()
inline bool CopiedBlock::didEvacuateBytes(unsigned bytes)
{
ASSERT(m_liveBytes >= bytes);
#if ENABLE(PARALLEL_GC)
unsigned oldValue = 0;
unsigned newValue = 0;
do {
......@@ -144,6 +149,10 @@ inline bool CopiedBlock::didEvacuateBytes(unsigned bytes)
} while (!WTF::weakCompareAndSwap(&m_liveBytes, oldValue, newValue));
ASSERT(m_liveBytes < oldValue);
return !newValue;
#else
m_liveBytes -= bytes;
return !m_liveBytes;
#endif
}
inline bool CopiedBlock::canBeRecycled()
......
......@@ -1132,6 +1132,8 @@
#define ENABLE_OBJECT_MARK_LOGGING 0
#define ENABLE_PARALLEL_GC 0
#if !defined(ENABLE_PARALLEL_GC) && !ENABLE(OBJECT_MARK_LOGGING) && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(BLACKBERRY) || PLATFORM(GTK)) && ENABLE(COMPARE_AND_SWAP)
#define ENABLE_PARALLEL_GC 1
#elif PLATFORM(QT)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment