Commit 30691690 authored by Michael Lippautz's avatar Michael Lippautz Committed by V8 LUCI CQ

Reland "[heap] Rework Worklist base type"

This is a reland of commit a19316d9

- Revert malloc_usable_size() changes temporarily to land them in
  isolation.
- Add cosmetics from https://crrev.com/c/3827876

Original change's description:
> [heap] Rework Worklist base type
>
> Worklist uses a singly-linked list of segments to hold entries.
> Segment size was based on a compile-time constant but already stored
> in the segment itself.
>
> Rework the segments to query `malloc_usable_size()` on allocation and
> adjust the capacity properly. For PartitionAlloc, it turns out that
> there's ~20% more capacity available for the 64-element segments.
>
> This slows down actual allocation of the segments with the upside of
> improving utilization and requiring 20% less segments.
>
> Change-Id: Ib8595c3fb9fb75b02e4022f6c525bb59a2df7ab7
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3826047
> Commit-Queue: Anton Bikineev <bikineev@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Anton Bikineev <bikineev@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#82432}

Change-Id: Ic8c5257cfe3c347b11eea5c513ca7f62e09f637f
Bug: v8:13193
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3829475Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82493}
parent ee89a269
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// This has to come after windows.h. // This has to come after windows.h.
#include <VersionHelpers.h> #include <VersionHelpers.h>
#include <dbghelp.h> // For SymLoadModule64 and al. #include <dbghelp.h> // For SymLoadModule64 and al.
#include <mmsystem.h> // For timeGetTime(). #include <mmsystem.h> // For timeGetTime().
#include <tlhelp32.h> // For Module32First and al. #include <tlhelp32.h> // For Module32First and al.
......
...@@ -4,16 +4,12 @@ ...@@ -4,16 +4,12 @@
#include "src/heap/base/worklist.h" #include "src/heap/base/worklist.h"
namespace heap { namespace heap::base::internal {
namespace base {
namespace internal {
// static // static
SegmentBase* SegmentBase::GetSentinelSegmentAddress() { SegmentBase* SegmentBase::GetSentinelSegmentAddress() {
static SegmentBase kSentinelSegment(0); static SegmentBase sentinel_segment(0);
return &kSentinelSegment; return &sentinel_segment;
} }
} // namespace internal } // namespace heap::base::internal
} // namespace base
} // namespace heap
This diff is collapsed.
...@@ -704,7 +704,7 @@ void Scavenger::Process(JobDelegate* delegate) { ...@@ -704,7 +704,7 @@ void Scavenger::Process(JobDelegate* delegate) {
scavenge_visitor.Visit(object_and_size.first); scavenge_visitor.Visit(object_and_size.first);
done = false; done = false;
if (delegate && ((++objects % kInterruptThreshold) == 0)) { if (delegate && ((++objects % kInterruptThreshold) == 0)) {
if (!copied_list_local_.IsEmpty()) { if (!copied_list_local_.IsLocalEmpty()) {
delegate->NotifyConcurrencyIncrease(); delegate->NotifyConcurrencyIncrease();
} }
} }
......
...@@ -20,10 +20,10 @@ namespace heap { ...@@ -20,10 +20,10 @@ namespace heap {
void PublishSegment(MarkingWorklist* worklist, HeapObject object) { void PublishSegment(MarkingWorklist* worklist, HeapObject object) {
MarkingWorklist::Local local(worklist); MarkingWorklist::Local local(worklist);
for (size_t i = 0; i <= MarkingWorklist::kSegmentSize; i++) { for (size_t i = 0; i < MarkingWorklist::kMinSegmentSizeForTesting; i++) {
local.Push(object); local.Push(object);
} }
CHECK(local.Pop(&object)); local.Publish();
} }
TEST(ConcurrentMarking) { TEST(ConcurrentMarking) {
......
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