Skip to content
Permalink
Browse files
Visiting a WeakBlock should report bytes visited, since we reported t…
…hem allocated.

<https://webkit.org/b/153978>

Reviewed by Darin Adler.

When creating a WeakBlock, we tell Heap that we've allocated 1 KB (WeakBlock::blockSize)
of memory. Consequently, when visiting a WeakBlock, we should also report 1 KB of memory
visited. Otherwise Heap will think that those 1 KB already went away.

This was causing us to underestimate heap size, which affects collection scheduling.

* heap/SlotVisitor.h:
(JSC::SlotVisitor::reportMemoryVisited):
* heap/WeakBlock.cpp:
(JSC::WeakBlock::visit):


Canonical link: https://commits.webkit.org/172078@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196251 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Andreas Kling committed Feb 8, 2016
1 parent 211e5b4 commit bb7022b7b3891bf8ed5c8061f0f411fb8f9e5044
Showing with 21 additions and 0 deletions.
  1. +18 −0 Source/JavaScriptCore/ChangeLog
  2. +1 −0 Source/JavaScriptCore/heap/SlotVisitor.h
  3. +2 −0 Source/JavaScriptCore/heap/WeakBlock.cpp
@@ -1,3 +1,21 @@
2016-02-08 Andreas Kling <akling@apple.com>

Visiting a WeakBlock should report bytes visited, since we reported them allocated.
<https://webkit.org/b/153978>

Reviewed by Darin Adler.

When creating a WeakBlock, we tell Heap that we've allocated 1 KB (WeakBlock::blockSize)
of memory. Consequently, when visiting a WeakBlock, we should also report 1 KB of memory
visited. Otherwise Heap will think that those 1 KB already went away.

This was causing us to underestimate heap size, which affects collection scheduling.

* heap/SlotVisitor.h:
(JSC::SlotVisitor::reportMemoryVisited):
* heap/WeakBlock.cpp:
(JSC::WeakBlock::visit):

2016-02-07 Saam barati <sbarati@apple.com>

Follow up patch to: [ES6] bound functions .name property should be "bound " + the target function's name
@@ -105,6 +105,7 @@ class SlotVisitor {
void copyLater(JSCell*, CopyToken, void*, size_t);

void reportExtraMemoryVisited(size_t);
void reportMemoryVisited(size_t bytes) { m_bytesVisited += bytes; }

void addWeakReferenceHarvester(WeakReferenceHarvester*);
void addUnconditionalFinalizer(UnconditionalFinalizer*);
@@ -109,6 +109,8 @@ void WeakBlock::visit(HeapRootVisitor& heapRootVisitor)

SlotVisitor& visitor = heapRootVisitor.visitor();

visitor.reportMemoryVisited(WeakBlock::blockSize);

for (size_t i = 0; i < weakImplCount(); ++i) {
WeakImpl* weakImpl = &weakImpls()[i];
if (weakImpl->state() != WeakImpl::Live)

0 comments on commit bb7022b

Please sign in to comment.