Free empty MicrotaskQueue buffer on GC
MicrotaskQueue didn't free its buffer on GC phase if it's empty. Bug: v8:8124 Change-Id: Icdd6a67873cab164dcf67ed1caf5cca55e3f7954 Reviewed-on: https://chromium-review.googlesource.com/c/1351856 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#57891}
This commit is contained in:
parent
e3f6dff547
commit
894cc02144
@ -110,19 +110,21 @@ int MicrotaskQueue::RunMicrotasks(Isolate* isolate) {
|
||||
}
|
||||
|
||||
void MicrotaskQueue::IterateMicrotasks(RootVisitor* visitor) {
|
||||
if (!size_) {
|
||||
return;
|
||||
if (size_) {
|
||||
// Iterate pending Microtasks as root objects to avoid the write barrier for
|
||||
// all single Microtask. If this hurts the GC performance, use a FixedArray.
|
||||
visitor->VisitRootPointers(
|
||||
Root::kStrongRoots, nullptr, ObjectSlot(ring_buffer_ + start_),
|
||||
ObjectSlot(ring_buffer_ + std::min(start_ + size_, capacity_)));
|
||||
visitor->VisitRootPointers(
|
||||
Root::kStrongRoots, nullptr, ObjectSlot(ring_buffer_),
|
||||
ObjectSlot(ring_buffer_ + std::max(start_ + size_ - capacity_,
|
||||
static_cast<intptr_t>(0))));
|
||||
}
|
||||
|
||||
// Iterate pending Microtasks as root objects to avoid the write barrier for
|
||||
// all single Microtask. If this hurts the GC performance, use a FixedArray.
|
||||
visitor->VisitRootPointers(
|
||||
Root::kStrongRoots, nullptr, ObjectSlot(ring_buffer_ + start_),
|
||||
ObjectSlot(ring_buffer_ + std::min(start_ + size_, capacity_)));
|
||||
visitor->VisitRootPointers(
|
||||
Root::kStrongRoots, nullptr, ObjectSlot(ring_buffer_),
|
||||
ObjectSlot(ring_buffer_ + std::max(start_ + size_ - capacity_,
|
||||
static_cast<intptr_t>(0))));
|
||||
if (capacity_ <= kMinimumCapacity) {
|
||||
return;
|
||||
}
|
||||
|
||||
intptr_t new_capacity = capacity_;
|
||||
while (new_capacity > 2 * size_) {
|
||||
|
Loading…
Reference in New Issue
Block a user