Skip to content
Permalink
Browse files
Unreviewed, revert "The extraMemorySize() get wrong when transferring…
… ArrayBuffer from Worker VM"

https://bugs.webkit.org/show_bug.cgi?id=241826
rdar://95384643

This reverts commit 71960be.

m_extraMemorySize must be monotonically increasing during GC cycles until
full-collection happens. And after the full-collection, it is adjusted.
We already adjusted it in sweep of m_arrayBuffer, so, we should not reduce
that number. This is used for GC invocation scheduling. So, if we would like to
have a number which more precisely reflecting the current status,
then we should have yet another one. And we can still use extraMemorySize
since it will be adjusted after the full-collection. So we can consider
that transferred array-buffer is collected at the full-collection.

Canonical link: https://commits.webkit.org/251708@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Constellation committed Jun 21, 2022
1 parent 1090246 commit 206d7d6cb3b7fb593a243e9bb9852e4b4b948cab
Showing 5 changed files with 0 additions and 27 deletions.
@@ -44,7 +44,6 @@ class GCIncomingRefCountedSet {
void sweep(VM&);

size_t size() const { return m_bytes; };
void reduceSize(size_t);

private:
Vector<T*> m_vector;
@@ -72,23 +72,6 @@ void GCIncomingRefCountedSet<T>::sweep(VM& vm)
m_vector[i--] = m_vector.last();
m_vector.removeLast();
}

constexpr bool verify = false;
if constexpr (verify) {
CheckedSize size;
for (size_t i = m_vector.size(); i--;) {
T* object = m_vector[i];
size += object->gcSizeEstimateInBytes();
}
ASSERT(m_bytes == size);
}
}

template<typename T>
void GCIncomingRefCountedSet<T>::reduceSize(size_t bytes)
{
ASSERT(m_bytes >= bytes);
m_bytes -= bytes;
}

} // namespace JSC
@@ -659,11 +659,6 @@ void Heap::addReference(JSCell* cell, ArrayBuffer* buffer)
}
}

void Heap::reduceArrayBufferSize(size_t bytes)
{
m_arrayBuffers.reduceSize(bytes);
}

template<typename CellType, typename CellSet>
void Heap::finalizeMarkedUnconditionalFinalizers(CellSet& cellSet)
{
@@ -439,7 +439,6 @@ class Heap {
const JITStubRoutineSet& jitStubRoutines() { return *m_jitStubRoutines; }

void addReference(JSCell*, ArrayBuffer*);
void reduceArrayBufferSize(size_t bytes);

bool isDeferred() const { return !!m_deferralDepth; }

@@ -303,11 +303,8 @@ bool ArrayBuffer::transferTo(VM& vm, ArrayBufferContents& result)
return true;
}

CheckedSize sizeReduced { gcSizeEstimateInBytes() };
result = WTFMove(m_contents);
notifyDetaching(vm);
sizeReduced -= gcSizeEstimateInBytes();
vm.heap.reduceArrayBufferSize(sizeReduced);
return true;
}

0 comments on commit 206d7d6

Please sign in to comment.