diff options
Diffstat (limited to 'Source/JavaScriptCore/heap/CopiedBlockInlines.h')
-rw-r--r-- | Source/JavaScriptCore/heap/CopiedBlockInlines.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/Source/JavaScriptCore/heap/CopiedBlockInlines.h b/Source/JavaScriptCore/heap/CopiedBlockInlines.h index 0068abcdd..c6fb76217 100644 --- a/Source/JavaScriptCore/heap/CopiedBlockInlines.h +++ b/Source/JavaScriptCore/heap/CopiedBlockInlines.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012, 2013, 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,13 +30,19 @@ #include "Heap.h" namespace JSC { - -inline void CopiedBlock::reportLiveBytes(JSCell* owner, unsigned bytes) + +inline void CopiedBlock::reportLiveBytes(LockHolder&, JSCell* owner, CopyToken token, unsigned bytes) { -#if ENABLE(PARALLEL_GC) - SpinLockHolder locker(&m_workListLock); + checkConsistency(); +#ifndef NDEBUG + m_liveObjects++; #endif m_liveBytes += bytes; + checkConsistency(); + ASSERT(m_liveBytes <= m_capacity); + + if (isPinned()) + return; if (!shouldEvacuate()) { pin(); @@ -44,9 +50,22 @@ inline void CopiedBlock::reportLiveBytes(JSCell* owner, unsigned bytes) } if (!m_workList) - m_workList = adoptPtr(new CopyWorkList(Heap::heap(owner)->blockAllocator())); + m_workList = std::make_unique<CopyWorkList>(); + + m_workList->append(CopyWorklistItem(owner, token)); +} - m_workList->append(owner); +inline void CopiedBlock::reportLiveBytesDuringCopying(unsigned bytes) +{ + checkConsistency(); + // This doesn't need to be locked because the thread that calls this function owns the current block. + m_isOld = true; +#ifndef NDEBUG + m_liveObjects++; +#endif + m_liveBytes += bytes; + checkConsistency(); + ASSERT(m_liveBytes <= CopiedBlock::blockSize); } } // namespace JSC |