Revert "[cppgc-js] Allow overriding marking support"
This reverts commit 2115ba5053
.
Reason for revert: Breaking Blink tests.
Original change's description:
> [cppgc-js] Allow overriding marking support
>
> Adds flags to allow overriding marking support. This adds
> compatibility with EmbedderHeapTracer which allows for disabling
> incremental marking support with `--no-incremental-marking-wrappers`.
>
> The corresponding CppHeap flags are
> * `--cppheap-incremental-marking`
> * `--cppheap-concurrent-marking`
>
> This allows embedders that use types that do not support incremental
> and concurrent marking to switch from EmbedderHeapTracer to CppHeap.
>
> Bug: v8:13207
> Change-Id: I74bdf8ef4be3f6aed8d4d587ea4399546ba2fda4
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3840939
> Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#82652}
Bug: v8:13207
Change-Id: I9e0de0cacfab8489902fef1c371e36c2d45b80ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3850723
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82671}
This commit is contained in:
parent
0f1fc1e0ef
commit
9432358a33
@ -1420,15 +1420,6 @@ DEFINE_BOOL(clear_free_memory, false, "initialize free memory with 0")
|
||||
DEFINE_BOOL(crash_on_aborted_evacuation, false,
|
||||
"crash when evacuation of page fails")
|
||||
|
||||
// v8::CppHeap flags that allow fine-grained control of how C++ memory is
|
||||
// reclaimed in the garbage collector.
|
||||
DEFINE_BOOL(cppheap_incremental_marking, false,
|
||||
"use incremental marking for CppHeap")
|
||||
DEFINE_WEAK_IMPLICATION(incremental_marking, cppheap_incremental_marking)
|
||||
DEFINE_BOOL(cppheap_concurrent_marking, false,
|
||||
"use concurrent marking for CppHeap")
|
||||
DEFINE_WEAK_IMPLICATION(concurrent_marking, cppheap_concurrent_marking)
|
||||
|
||||
// assembler-ia32.cc / assembler-arm.cc / assembler-arm64.cc / assembler-x64.cc
|
||||
#ifdef V8_ENABLE_DEBUG_CODE
|
||||
DEFINE_BOOL(debug_code, DEBUG_BOOL,
|
||||
@ -2249,7 +2240,6 @@ DEFINE_NEG_IMPLICATION(single_threaded_gc, parallel_pointer_update)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded_gc, parallel_scavenge)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded_gc, concurrent_array_buffer_sweeping)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded_gc, stress_concurrent_allocation)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded_gc, cppheap_concurrent_marking)
|
||||
|
||||
// Web snapshots: 1) expose WebSnapshot.* API 2) interpret scripts as web
|
||||
// snapshots if they start with a magic number.
|
||||
|
@ -478,10 +478,10 @@ CppHeap::CppHeap(
|
||||
std::make_shared<CppgcPlatformAdapter>(platform), custom_spaces,
|
||||
cppgc::internal::HeapBase::StackSupport::
|
||||
kSupportsConservativeStackScan,
|
||||
// Default marking and sweeping types are only atomic. The types
|
||||
// Default marking and sweeping types are only incremental. The types
|
||||
// are updated respecting flags only on GC as the flags are not set
|
||||
// properly during heap setup.
|
||||
MarkingType::kAtomic, SweepingType::kAtomic),
|
||||
MarkingType::kIncremental, SweepingType::kIncremental),
|
||||
wrapper_descriptor_(wrapper_descriptor) {
|
||||
CHECK_NE(WrapperDescriptor::kUnknownEmbedderId,
|
||||
wrapper_descriptor_.embedder_id_for_garbage_collected);
|
||||
@ -579,14 +579,12 @@ CppHeap::SweepingType CppHeap::SelectSweepingType() const {
|
||||
}
|
||||
|
||||
void CppHeap::UpdateSupportedGCTypesFromFlags() {
|
||||
CHECK_IMPLIES(FLAG_cppheap_concurrent_marking,
|
||||
FLAG_cppheap_incremental_marking);
|
||||
if (FLAG_cppheap_concurrent_marking) {
|
||||
marking_support_ = MarkingType::kIncrementalAndConcurrent;
|
||||
} else if (FLAG_cppheap_incremental_marking) {
|
||||
// Keep the selection simple for now as production configurations do not turn
|
||||
// off parallel and/or concurrent marking independently.
|
||||
if (!FLAG_parallel_marking || !FLAG_concurrent_marking) {
|
||||
marking_support_ = MarkingType::kIncremental;
|
||||
} else {
|
||||
marking_support_ = MarkingType::kAtomic;
|
||||
marking_support_ = MarkingType::kIncrementalAndConcurrent;
|
||||
}
|
||||
|
||||
sweeping_support_ = FLAG_single_threaded_gc
|
||||
|
@ -101,8 +101,10 @@ void LocalEmbedderHeapTracer::EnterFinalPause() {
|
||||
bool LocalEmbedderHeapTracer::Trace(double max_duration) {
|
||||
if (!InUse()) return true;
|
||||
|
||||
return cpp_heap_ ? cpp_heap_->AdvanceTracing(max_duration)
|
||||
: remote_tracer_->AdvanceTracing(max_duration);
|
||||
if (cpp_heap_)
|
||||
return cpp_heap()->AdvanceTracing(max_duration);
|
||||
else
|
||||
return remote_tracer_->AdvanceTracing(max_duration);
|
||||
}
|
||||
|
||||
bool LocalEmbedderHeapTracer::IsRemoteTracingDone() {
|
||||
|
@ -108,18 +108,8 @@ class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final {
|
||||
bool IsRemoteTracingDone();
|
||||
|
||||
bool ShouldFinalizeIncrementalMarking() {
|
||||
// Covers cases where no remote tracer is in use or the flags for
|
||||
// incremental marking have been disabled.
|
||||
if (!SupportsIncrementalEmbedderSteps()) return true;
|
||||
|
||||
return IsRemoteTracingDone() && embedder_worklist_empty_;
|
||||
}
|
||||
|
||||
bool SupportsIncrementalEmbedderSteps() const {
|
||||
if (!InUse()) return false;
|
||||
|
||||
return cpp_heap_ ? FLAG_cppheap_incremental_marking
|
||||
: FLAG_incremental_marking_wrappers;
|
||||
return !FLAG_incremental_marking_wrappers || !InUse() ||
|
||||
(IsRemoteTracingDone() && embedder_worklist_empty_);
|
||||
}
|
||||
|
||||
void SetEmbedderWorklistEmpty(bool is_empty) {
|
||||
|
@ -455,9 +455,7 @@ void IncrementalMarking::UpdateMarkedBytesAfterScavenge(
|
||||
|
||||
void IncrementalMarking::EmbedderStep(double expected_duration_ms,
|
||||
double* duration_ms) {
|
||||
DCHECK(IsMarking());
|
||||
if (!heap_->local_embedder_heap_tracer()
|
||||
->SupportsIncrementalEmbedderSteps()) {
|
||||
if (!ShouldDoEmbedderStep()) {
|
||||
*duration_ms = 0.0;
|
||||
return;
|
||||
}
|
||||
@ -611,6 +609,11 @@ bool IncrementalMarking::TryInitializeTaskTimeout() {
|
||||
}
|
||||
}
|
||||
|
||||
bool IncrementalMarking::ShouldDoEmbedderStep() {
|
||||
return IsRunning() && FLAG_incremental_marking_wrappers &&
|
||||
heap_->local_embedder_heap_tracer()->InUse();
|
||||
}
|
||||
|
||||
void IncrementalMarking::FastForwardSchedule() {
|
||||
if (scheduled_bytes_to_mark_ < bytes_marked_) {
|
||||
scheduled_bytes_to_mark_ = bytes_marked_;
|
||||
|
@ -174,6 +174,7 @@ class V8_EXPORT_PRIVATE IncrementalMarking final {
|
||||
|
||||
void StartMarking();
|
||||
|
||||
bool ShouldDoEmbedderStep();
|
||||
void EmbedderStep(double expected_duration_ms, double* duration_ms);
|
||||
|
||||
void StartBlackAllocation();
|
||||
|
Loading…
Reference in New Issue
Block a user