Commit 894cc021 authored by tzik's avatar tzik Committed by Commit Bot

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/1351856Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57891}
parent e3f6dff5
......@@ -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_) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment