Commit 66a9c1c5 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Do not process native context list in minor GCs

NativeContexts are always allocated in old space and thus cannot die
or move during minor GCs.

Bug: v8:11708
Change-Id: I01ec7775aa1186d91ca620c464f570f24ac9f215
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3666617Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80818}
parent 84bc824c
......@@ -2996,10 +2996,6 @@ void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) {
ProcessDirtyJSFinalizationRegistries(retainer);
}
void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) {
ProcessNativeContexts(retainer);
}
void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer) {
Object head = VisitWeakList<Context>(this, native_contexts_list(), retainer);
// Update the head of the list of contexts.
......
......@@ -1971,7 +1971,6 @@ class Heap {
ExternalStringTableUpdaterCallback updater_func);
void ProcessAllWeakReferences(WeakObjectRetainer* retainer);
void ProcessYoungWeakReferences(WeakObjectRetainer* retainer);
void ProcessNativeContexts(WeakObjectRetainer* retainer);
void ProcessAllocationSites(WeakObjectRetainer* retainer);
void ProcessDirtyJSFinalizationRegistries(WeakObjectRetainer* retainer);
......
......@@ -5713,30 +5713,6 @@ class YoungGenerationExternalStringTableCleaner : public RootVisitor {
MinorMarkCompactCollector::NonAtomicMarkingState* marking_state_;
};
// Marked young generation objects and all old generation objects will be
// retained.
class MinorMarkCompactWeakObjectRetainer : public WeakObjectRetainer {
public:
explicit MinorMarkCompactWeakObjectRetainer(
MinorMarkCompactCollector* collector)
: marking_state_(collector->non_atomic_marking_state()) {}
Object RetainAs(Object object) override {
HeapObject heap_object = HeapObject::cast(object);
if (!Heap::InYoungGeneration(heap_object)) return object;
// Young generation marking only marks to grey instead of black.
DCHECK(!marking_state_->IsBlack(heap_object));
if (marking_state_->IsGrey(heap_object)) {
return object;
}
return Object();
}
private:
MinorMarkCompactCollector::NonAtomicMarkingState* marking_state_;
};
} // namespace
void MinorMarkCompactCollector::ClearNonLiveReferences() {
......@@ -5750,13 +5726,6 @@ void MinorMarkCompactCollector::ClearNonLiveReferences() {
heap()->external_string_table_.IterateYoung(&external_visitor);
heap()->external_string_table_.CleanUpYoung();
}
{
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_CLEAR_WEAK_LISTS);
// Process the weak references.
MinorMarkCompactWeakObjectRetainer retainer(this);
heap()->ProcessYoungWeakReferences(&retainer);
}
}
void MinorMarkCompactCollector::EvacuatePrologue() {
......
......@@ -172,21 +172,6 @@ bool IsUnscavengedHeapObjectSlot(Heap* heap, FullObjectSlot p) {
} // namespace
class ScavengeWeakObjectRetainer : public WeakObjectRetainer {
public:
Object RetainAs(Object object) override {
if (!Heap::InFromPage(object)) {
return object;
}
MapWord map_word = HeapObject::cast(object).map_word(kRelaxedLoad);
if (map_word.IsForwardingAddress()) {
return map_word.ToForwardingAddress();
}
return Object();
}
};
ScavengerCollector::JobTask::JobTask(
ScavengerCollector* outer,
std::vector<std::unique_ptr<Scavenger>>* scavengers,
......@@ -695,8 +680,6 @@ void Scavenger::Process(JobDelegate* delegate) {
void ScavengerCollector::ProcessWeakReferences(
EphemeronTableList* ephemeron_table_list) {
ScavengeWeakObjectRetainer weak_object_retainer;
heap_->ProcessYoungWeakReferences(&weak_object_retainer);
ClearYoungEphemerons(ephemeron_table_list);
ClearOldEphemerons();
}
......
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