ASSERT(bytes);
CopiedBlock* block = CopiedSpace::blockFor(ptr);
if (block->isOversize()) {
+ ASSERT(bytes <= block->size());
+ // FIXME: We should be able to shrink the allocation if bytes went below the block size.
+ // For now, we just make sure that our accounting of how much memory we are actually using
+ // is correct.
+ // https://bugs.webkit.org/show_bug.cgi?id=144749
+ bytes = block->size();
m_shared.m_copiedSpace->pin(block);
- return;
}
ASSERT(heap()->m_storageSpace.contains(block));
}
}
-inline void SlotVisitor::reportExtraMemoryUsage(JSCell* owner, size_t size)
+inline void SlotVisitor::reportExtraMemoryVisited(JSCell* owner, size_t size)
{
-#if ENABLE(GGC)
- // We don't want to double-count the extra memory that was reported in previous collections.
- if (heap()->operationInProgress() == EdenCollection && Heap::isRemembered(owner))
- return;
-#else
- UNUSED_PARAM(owner);
-#endif
-
- size_t* counter = &m_shared.m_vm->heap.m_extraMemoryUsage;
-
-#if ENABLE(COMPARE_AND_SWAP)
- for (;;) {
- size_t oldSize = *counter;
- if (WTF::weakCompareAndSwapSize(counter, oldSize, oldSize + size))
- return;
- }
-#else
- (*counter) += size;
-#endif
+ heap()->reportExtraMemoryVisited(owner, size);
}
inline Heap* SlotVisitor::heap() const