Commit f176e1aa authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Rename IsGlobalEmpty to IsEmpty

Rename method to IsEmpty for Worklist. IsGlobalEmpty is easy to
confuse with IsGlobalPoolEmpty.

Change-Id: Id9744cef2630f7c0642ec37ef9a18296acee87e3
Reviewed-on: https://chromium-review.googlesource.com/1115222
Commit-Queue: Dominik Inführ <dinfuehr@google.com>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54153}
parent ed64d25f
......@@ -724,8 +724,8 @@ void ConcurrentMarking::RescheduleTasksIfNeeded() {
if (pending_task_count_ > 0) return;
}
if (!shared_->IsGlobalPoolEmpty() ||
!weak_objects_->current_ephemerons.IsGlobalEmpty() ||
!weak_objects_->discovered_ephemerons.IsGlobalEmpty()) {
!weak_objects_->current_ephemerons.IsEmpty() ||
!weak_objects_->discovered_ephemerons.IsEmpty()) {
ScheduleTasks();
}
}
......
......@@ -2194,8 +2194,8 @@ void Heap::Scavenge() {
// Parallel phase scavenging all copied and promoted objects.
TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE_PARALLEL);
job.Run(isolate()->async_counters());
DCHECK(copied_list.IsGlobalEmpty());
DCHECK(promotion_list.IsGlobalEmpty());
DCHECK(copied_list.IsEmpty());
DCHECK(promotion_list.IsEmpty());
}
{
// Scavenge weak global handles.
......@@ -2209,8 +2209,8 @@ void Heap::Scavenge() {
&root_scavenge_visitor);
scavengers[kMainThreadId]->Process();
DCHECK(copied_list.IsGlobalEmpty());
DCHECK(promotion_list.IsGlobalEmpty());
DCHECK(copied_list.IsEmpty());
DCHECK(promotion_list.IsEmpty());
isolate()
->global_handles()
->IterateNewSpaceWeakUnmodifiedRootsForPhantomHandles(
......
......@@ -845,8 +845,8 @@ void MarkCompactCollector::Finish() {
heap()->VerifyCountersBeforeConcurrentSweeping();
#endif
CHECK(weak_objects_.current_ephemerons.IsGlobalEmpty());
CHECK(weak_objects_.discovered_ephemerons.IsGlobalEmpty());
CHECK(weak_objects_.current_ephemerons.IsEmpty());
CHECK(weak_objects_.discovered_ephemerons.IsEmpty());
weak_objects_.next_ephemerons.Clear();
sweeper()->StartSweeperTasks();
......@@ -1499,8 +1499,8 @@ void MarkCompactCollector::ProcessEphemeronsUntilFixpoint() {
ConcurrentMarking::StopRequest::COMPLETE_ONGOING_TASKS);
}
CHECK(weak_objects_.current_ephemerons.IsGlobalEmpty());
CHECK(weak_objects_.discovered_ephemerons.IsGlobalEmpty());
CHECK(weak_objects_.current_ephemerons.IsEmpty());
CHECK(weak_objects_.discovered_ephemerons.IsEmpty());
work_to_do =
work_to_do || !marking_worklist()->IsEmpty() ||
......@@ -1509,8 +1509,8 @@ void MarkCompactCollector::ProcessEphemeronsUntilFixpoint() {
}
CHECK(marking_worklist()->IsEmpty());
CHECK(weak_objects_.current_ephemerons.IsGlobalEmpty());
CHECK(weak_objects_.discovered_ephemerons.IsGlobalEmpty());
CHECK(weak_objects_.current_ephemerons.IsEmpty());
CHECK(weak_objects_.discovered_ephemerons.IsEmpty());
}
bool MarkCompactCollector::ProcessEphemerons() {
......@@ -1774,10 +1774,10 @@ void MarkCompactCollector::ClearNonLiveReferences() {
ClearWeakCollections();
DCHECK(weak_objects_.weak_cells.IsGlobalEmpty());
DCHECK(weak_objects_.transition_arrays.IsGlobalEmpty());
DCHECK(weak_objects_.weak_references.IsGlobalEmpty());
DCHECK(weak_objects_.weak_objects_in_code.IsGlobalEmpty());
DCHECK(weak_objects_.weak_cells.IsEmpty());
DCHECK(weak_objects_.transition_arrays.IsEmpty());
DCHECK(weak_objects_.weak_references.IsEmpty());
DCHECK(weak_objects_.weak_objects_in_code.IsEmpty());
}
void MarkCompactCollector::MarkDependentCodeForDeoptimization() {
......@@ -4156,7 +4156,7 @@ void MinorMarkCompactCollector::MarkRootSetInParallel(
new YoungGenerationMarkingTask(isolate(), this, worklist(), i));
}
job.Run(isolate()->async_counters());
DCHECK(worklist()->IsGlobalEmpty());
DCHECK(worklist()->IsEmpty());
}
}
old_to_new_slots_ = slots;
......
......@@ -43,7 +43,7 @@ class Worklist {
// Returns true if the worklist is empty. Can only be used from the main
// thread without concurrent access.
bool IsGlobalEmpty() { return worklist_->IsGlobalEmpty(); }
bool IsEmpty() { return worklist_->IsEmpty(); }
bool IsGlobalPoolEmpty() { return worklist_->IsGlobalPoolEmpty(); }
......@@ -69,7 +69,7 @@ class Worklist {
}
~Worklist() {
CHECK(IsGlobalEmpty());
CHECK(IsEmpty());
for (int i = 0; i < num_tasks_; i++) {
DCHECK_NOT_NULL(private_push_segment(i));
DCHECK_NOT_NULL(private_pop_segment(i));
......@@ -128,7 +128,7 @@ class Worklist {
bool IsGlobalPoolEmpty() { return global_pool_.IsEmpty(); }
bool IsGlobalEmpty() {
bool IsEmpty() {
if (!AreLocalsEmpty()) return false;
return global_pool_.IsEmpty();
}
......
......@@ -111,7 +111,7 @@ TEST(WorkListTest, CreateEmpty) {
TestWorklist worklist;
TestWorklist::View worklist_view(&worklist, 0);
EXPECT_TRUE(worklist_view.IsLocalEmpty());
EXPECT_TRUE(worklist.IsGlobalEmpty());
EXPECT_TRUE(worklist.IsEmpty());
}
TEST(WorkListTest, LocalPushPop) {
......@@ -147,14 +147,14 @@ TEST(WorkListTest, LocalPushStaysPrivate) {
TestWorklist::View worklist_view2(&worklist, 1);
SomeObject dummy;
SomeObject* retrieved = nullptr;
EXPECT_TRUE(worklist.IsGlobalEmpty());
EXPECT_TRUE(worklist.IsEmpty());
EXPECT_TRUE(worklist_view1.Push(&dummy));
EXPECT_FALSE(worklist.IsGlobalEmpty());
EXPECT_FALSE(worklist.IsEmpty());
EXPECT_FALSE(worklist_view2.Pop(&retrieved));
EXPECT_EQ(nullptr, retrieved);
EXPECT_TRUE(worklist_view1.Pop(&retrieved));
EXPECT_EQ(&dummy, retrieved);
EXPECT_TRUE(worklist.IsGlobalEmpty());
EXPECT_TRUE(worklist.IsEmpty());
}
TEST(WorkListTest, GlobalUpdateNull) {
......@@ -167,7 +167,7 @@ TEST(WorkListTest, GlobalUpdateNull) {
}
EXPECT_TRUE(worklist_view.Push(object));
worklist.Update([](SomeObject* object, SomeObject** out) { return false; });
EXPECT_TRUE(worklist.IsGlobalEmpty());
EXPECT_TRUE(worklist.IsEmpty());
}
TEST(WorkListTest, GlobalUpdate) {
......@@ -236,7 +236,7 @@ TEST(WorkListTest, Clear) {
}
EXPECT_TRUE(worklist_view.Push(object));
worklist.Clear();
EXPECT_TRUE(worklist.IsGlobalEmpty());
EXPECT_TRUE(worklist.IsEmpty());
}
TEST(WorkListTest, SingleSegmentSteal) {
......@@ -258,7 +258,7 @@ TEST(WorkListTest, SingleSegmentSteal) {
EXPECT_EQ(&dummy, retrieved);
EXPECT_FALSE(worklist_view1.Pop(&retrieved));
}
EXPECT_TRUE(worklist.IsGlobalEmpty());
EXPECT_TRUE(worklist.IsEmpty());
}
TEST(WorkListTest, MultipleSegmentsStolen) {
......@@ -298,7 +298,7 @@ TEST(WorkListTest, MultipleSegmentsStolen) {
EXPECT_EQ(expect_bag3, retrieved);
EXPECT_FALSE(worklist_view1.Pop(&retrieved));
}
EXPECT_TRUE(worklist.IsGlobalEmpty());
EXPECT_TRUE(worklist.IsEmpty());
}
TEST(WorkListTest, MergeGlobalPool) {
......@@ -317,14 +317,14 @@ TEST(WorkListTest, MergeGlobalPool) {
TestWorklist worklist2;
TestWorklist::View worklist_view2(&worklist2, 0);
worklist2.MergeGlobalPool(&worklist1);
EXPECT_FALSE(worklist2.IsGlobalEmpty());
EXPECT_FALSE(worklist2.IsEmpty());
for (size_t i = 0; i < TestWorklist::kSegmentCapacity; i++) {
EXPECT_TRUE(worklist_view2.Pop(&retrieved));
EXPECT_EQ(&dummy, retrieved);
EXPECT_FALSE(worklist_view1.Pop(&retrieved));
}
EXPECT_TRUE(worklist1.IsGlobalEmpty());
EXPECT_TRUE(worklist2.IsGlobalEmpty());
EXPECT_TRUE(worklist1.IsEmpty());
EXPECT_TRUE(worklist2.IsEmpty());
}
} // 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