cppgc-js: Make use of simple unmarker when young gen is enabled
Young generation collection requires that full GCs unmark before starting marking. Bug: v8:12324 Change-Id: Id6cc218057252cbf0664326126f34b07ac8ea247 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3229570 Auto-Submit: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Anton Bikineev <bikineev@chromium.org> Cr-Commit-Position: refs/heads/main@{#77445}
This commit is contained in:
parent
43633af0e3
commit
dfbd9edb87
3
BUILD.gn
3
BUILD.gn
@ -357,7 +357,7 @@ declare_args() {
|
|||||||
v8_current_cpu == "x86" || v8_current_cpu == "x64" ||
|
v8_current_cpu == "x86" || v8_current_cpu == "x64" ||
|
||||||
v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
|
v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
|
||||||
v8_current_cpu == "mips64el" || v8_current_cpu == "mipsel" ||
|
v8_current_cpu == "mips64el" || v8_current_cpu == "mipsel" ||
|
||||||
v8_current_cpu == "loong64" || v8_current_cpu == "riscv64"
|
v8_current_cpu == "loong64" || v8_current_cpu == "riscv64"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Derived defaults.
|
# Derived defaults.
|
||||||
@ -5504,6 +5504,7 @@ v8_source_set("cppgc_base") {
|
|||||||
"src/heap/cppgc/sweeper.cc",
|
"src/heap/cppgc/sweeper.cc",
|
||||||
"src/heap/cppgc/sweeper.h",
|
"src/heap/cppgc/sweeper.h",
|
||||||
"src/heap/cppgc/task-handle.h",
|
"src/heap/cppgc/task-handle.h",
|
||||||
|
"src/heap/cppgc/unmarker.h",
|
||||||
|
|
||||||
# TODO(v8:11952): Remove the testing header here once depending on both,
|
# TODO(v8:11952): Remove the testing header here once depending on both,
|
||||||
# //v8:v8 and //v8:v8_for_testing does not result in ODR violations.
|
# //v8:v8 and //v8:v8_for_testing does not result in ODR violations.
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "src/heap/cppgc/raw-heap.h"
|
#include "src/heap/cppgc/raw-heap.h"
|
||||||
#include "src/heap/cppgc/stats-collector.h"
|
#include "src/heap/cppgc/stats-collector.h"
|
||||||
#include "src/heap/cppgc/sweeper.h"
|
#include "src/heap/cppgc/sweeper.h"
|
||||||
|
#include "src/heap/cppgc/unmarker.h"
|
||||||
#include "src/heap/embedder-tracing.h"
|
#include "src/heap/embedder-tracing.h"
|
||||||
#include "src/heap/gc-tracer.h"
|
#include "src/heap/gc-tracer.h"
|
||||||
#include "src/heap/marking-worklist.h"
|
#include "src/heap/marking-worklist.h"
|
||||||
@ -417,6 +418,10 @@ bool ShouldReduceMemory(CppHeap::TraceFlags flags) {
|
|||||||
void CppHeap::TracePrologue(TraceFlags flags) {
|
void CppHeap::TracePrologue(TraceFlags flags) {
|
||||||
CHECK(!sweeper_.IsSweepingInProgress());
|
CHECK(!sweeper_.IsSweepingInProgress());
|
||||||
|
|
||||||
|
#if defined(CPPGC_YOUNG_GENERATION)
|
||||||
|
cppgc::internal::SequentialUnmarker unmarker(raw_heap());
|
||||||
|
#endif // defined(CPPGC_YOUNG_GENERATION)
|
||||||
|
|
||||||
current_flags_ = flags;
|
current_flags_ = flags;
|
||||||
const UnifiedHeapMarker::MarkingConfig marking_config{
|
const UnifiedHeapMarker::MarkingConfig marking_config{
|
||||||
UnifiedHeapMarker::MarkingConfig::CollectionType::kMajor,
|
UnifiedHeapMarker::MarkingConfig::CollectionType::kMajor,
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "src/heap/cppgc/prefinalizer-handler.h"
|
#include "src/heap/cppgc/prefinalizer-handler.h"
|
||||||
#include "src/heap/cppgc/stats-collector.h"
|
#include "src/heap/cppgc/stats-collector.h"
|
||||||
#include "src/heap/cppgc/sweeper.h"
|
#include "src/heap/cppgc/sweeper.h"
|
||||||
|
#include "src/heap/cppgc/unmarker.h"
|
||||||
|
|
||||||
namespace cppgc {
|
namespace cppgc {
|
||||||
|
|
||||||
@ -61,19 +62,6 @@ namespace internal {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class Unmarker final : private HeapVisitor<Unmarker> {
|
|
||||||
friend class HeapVisitor<Unmarker>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit Unmarker(RawHeap& heap) { Traverse(heap); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool VisitHeapObjectHeader(HeapObjectHeader& header) {
|
|
||||||
if (header.IsMarked()) header.Unmark();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void CheckConfig(Heap::Config config, Heap::MarkingType marking_support,
|
void CheckConfig(Heap::Config config, Heap::MarkingType marking_support,
|
||||||
Heap::SweepingType sweeping_support) {
|
Heap::SweepingType sweeping_support) {
|
||||||
CHECK_WITH_MSG(
|
CHECK_WITH_MSG(
|
||||||
@ -160,7 +148,7 @@ void Heap::StartGarbageCollection(Config config) {
|
|||||||
|
|
||||||
#if defined(CPPGC_YOUNG_GENERATION)
|
#if defined(CPPGC_YOUNG_GENERATION)
|
||||||
if (config.collection_type == Config::CollectionType::kMajor)
|
if (config.collection_type == Config::CollectionType::kMajor)
|
||||||
Unmarker unmarker(raw_heap());
|
SequentialUnmarker unmarker(raw_heap());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const Marker::MarkingConfig marking_config{
|
const Marker::MarkingConfig marking_config{
|
||||||
|
30
src/heap/cppgc/unmarker.h
Normal file
30
src/heap/cppgc/unmarker.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright 2021 the V8 project authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef V8_HEAP_CPPGC_UNMARKER_H_
|
||||||
|
#define V8_HEAP_CPPGC_UNMARKER_H_
|
||||||
|
|
||||||
|
#include "src/heap/cppgc/heap-object-header.h"
|
||||||
|
#include "src/heap/cppgc/heap-visitor.h"
|
||||||
|
|
||||||
|
namespace cppgc {
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
class SequentialUnmarker final : private HeapVisitor<SequentialUnmarker> {
|
||||||
|
friend class HeapVisitor<SequentialUnmarker>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SequentialUnmarker(RawHeap& heap) { Traverse(heap); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool VisitHeapObjectHeader(HeapObjectHeader& header) {
|
||||||
|
if (header.IsMarked()) header.Unmark();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
} // namespace cppgc
|
||||||
|
|
||||||
|
#endif // V8_HEAP_CPPGC_UNMARKER_H_
|
Loading…
Reference in New Issue
Block a user