Commit a2a50d7f authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

Revert "[heap] Align v8 and oilpan worklists"

This reverts commit 6cfba48b.

Reason for revert: Removing dynamic parameter caused regressions for scavenger.

Original change's description:
> [heap] Align v8 and oilpan worklists
>
> This CL makes the following changes:
> 1) Size of allocated buffer is set by a template parameter
>    (with a default value instead of hardcoded size)
> 2) Remove dynamic parameter for initializing number of
>    tasks (see comment in scavenger.cc)
>
> This CL aligns the v8 and oilpan heaps so that they provide
> the same interface and functionality.
>
> Change-Id: I77d63793f0a54ea29198ddd6bd298eae2c15cf42
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2030920
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Commit-Queue: Omer Katz <omerkatz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66158}

TBR=ulan@chromium.org,mlippautz@chromium.org,omerkatz@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Iab127d59882ded33d0df3897326031bfc2d2aaf2
Bug: chromium:1052750
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071862
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66430}
parent c8e10a16
......@@ -253,9 +253,9 @@ void ScavengerCollector::CollectGarbage() {
const int num_scavenge_tasks = NumberOfScavengeTasks();
OneshotBarrier barrier(base::TimeDelta::FromMilliseconds(kMaxWaitTimeMs));
Worklist<MemoryChunk*, 64> empty_chunks;
Scavenger::CopiedList copied_list;
Scavenger::PromotionList promotion_list;
EphemeronTableList ephemeron_table_list;
Scavenger::CopiedList copied_list(num_scavenge_tasks);
Scavenger::PromotionList promotion_list(num_scavenge_tasks);
EphemeronTableList ephemeron_table_list(num_scavenge_tasks);
for (int i = 0; i < num_scavenge_tasks; i++) {
scavengers[i] =
new Scavenger(this, heap_, is_logging, &empty_chunks, &copied_list,
......
......@@ -89,6 +89,10 @@ class Scavenger {
int task_id_;
};
explicit PromotionList(int num_tasks)
: regular_object_promotion_list_(num_tasks),
large_object_promotion_list_(num_tasks) {}
inline void PushRegularObject(int task_id, HeapObject object, int size);
inline void PushLargeObject(int task_id, HeapObject object, Map map,
int size);
......
......@@ -24,7 +24,7 @@ namespace internal {
//
// Work stealing is best effort, i.e., there is no way to inform other tasks
// of the need of items.
template <typename EntryType, int SEGMENT_SIZE, int MAX_NUM_TASKS = 8>
template <typename EntryType, int SEGMENT_SIZE>
class Worklist {
public:
class View {
......@@ -58,11 +58,14 @@ class Worklist {
int task_id_;
};
static const int kMaxNumTasks = MAX_NUM_TASKS;
static const int kMaxNumTasks = 8;
static const size_t kSegmentCapacity = SEGMENT_SIZE;
Worklist() {
for (int i = 0; i < kMaxNumTasks; i++) {
Worklist() : Worklist(kMaxNumTasks) {}
explicit Worklist(int num_tasks) : num_tasks_(num_tasks) {
DCHECK_LE(num_tasks, kMaxNumTasks);
for (int i = 0; i < num_tasks_; i++) {
private_push_segment(i) = NewSegment();
private_pop_segment(i) = NewSegment();
}
......@@ -70,7 +73,7 @@ class Worklist {
~Worklist() {
CHECK(IsEmpty());
for (int i = 0; i < kMaxNumTasks; i++) {
for (int i = 0; i < num_tasks_; i++) {
DCHECK_NOT_NULL(private_push_segment(i));
DCHECK_NOT_NULL(private_pop_segment(i));
delete private_push_segment(i);
......@@ -88,7 +91,7 @@ class Worklist {
}
bool Push(int task_id, EntryType entry) {
DCHECK_LT(task_id, kMaxNumTasks);
DCHECK_LT(task_id, num_tasks_);
DCHECK_NOT_NULL(private_push_segment(task_id));
if (!private_push_segment(task_id)->Push(entry)) {
PublishPushSegmentToGlobal(task_id);
......@@ -100,7 +103,7 @@ class Worklist {
}
bool Pop(int task_id, EntryType* entry) {
DCHECK_LT(task_id, kMaxNumTasks);
DCHECK_LT(task_id, num_tasks_);
DCHECK_NOT_NULL(private_pop_segment(task_id));
if (!private_pop_segment(task_id)->Pop(entry)) {
if (!private_push_segment(task_id)->IsEmpty()) {
......@@ -134,7 +137,7 @@ class Worklist {
}
bool AreLocalsEmpty() {
for (int i = 0; i < kMaxNumTasks; i++) {
for (int i = 0; i < num_tasks_; i++) {
if (!IsLocalEmpty(i)) return false;
}
return true;
......@@ -152,7 +155,7 @@ class Worklist {
//
// Assumes that no other tasks are running.
void Clear() {
for (int i = 0; i < kMaxNumTasks; i++) {
for (int i = 0; i < num_tasks_; i++) {
private_pop_segment(i)->Clear();
private_push_segment(i)->Clear();
}
......@@ -169,7 +172,7 @@ class Worklist {
// Assumes that no other tasks are running.
template <typename Callback>
void Update(Callback callback) {
for (int i = 0; i < kMaxNumTasks; i++) {
for (int i = 0; i < num_tasks_; i++) {
private_pop_segment(i)->Update(callback);
private_push_segment(i)->Update(callback);
}
......@@ -183,7 +186,7 @@ class Worklist {
// Assumes that no other tasks are running.
template <typename Callback>
void Iterate(Callback callback) {
for (int i = 0; i < kMaxNumTasks; i++) {
for (int i = 0; i < num_tasks_; i++) {
private_pop_segment(i)->Iterate(callback);
private_push_segment(i)->Iterate(callback);
}
......@@ -441,6 +444,7 @@ class Worklist {
PrivateSegmentHolder private_segments_[kMaxNumTasks];
GlobalPool global_pool_;
int num_tasks_;
};
} // namespace internal
......
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