heap: Add callback for incremental marking start
The callback is useful to embedders to trigger various actions such as recomputing live set. Bug: chromium:1056170 Change-Id: I7d80b9b768a728e23303f945e416df97fd9b7805 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2173358 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Cr-Commit-Position: refs/heads/master@{#67532}
This commit is contained in:
parent
0b8d4bda0c
commit
c586450cd3
@ -3510,6 +3510,28 @@ void Heap::FinalizeIncrementalMarkingAtomically(
|
||||
CollectAllGarbage(current_gc_flags_, gc_reason, current_gc_callback_flags_);
|
||||
}
|
||||
|
||||
void Heap::InvokeIncrementalMarkingPrologueCallbacks() {
|
||||
GCCallbacksScope scope(this);
|
||||
if (scope.CheckReenter()) {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
TRACE_GC(tracer(), GCTracer::Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE);
|
||||
VMState<EXTERNAL> state(isolate_);
|
||||
HandleScope handle_scope(isolate_);
|
||||
CallGCPrologueCallbacks(kGCTypeIncrementalMarking, kNoGCCallbackFlags);
|
||||
}
|
||||
}
|
||||
|
||||
void Heap::InvokeIncrementalMarkingEpilogueCallbacks() {
|
||||
GCCallbacksScope scope(this);
|
||||
if (scope.CheckReenter()) {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
TRACE_GC(tracer(), GCTracer::Scope::MC_INCREMENTAL_EXTERNAL_EPILOGUE);
|
||||
VMState<EXTERNAL> state(isolate_);
|
||||
HandleScope handle_scope(isolate_);
|
||||
CallGCEpilogueCallbacks(kGCTypeIncrementalMarking, kNoGCCallbackFlags);
|
||||
}
|
||||
}
|
||||
|
||||
void Heap::FinalizeIncrementalMarkingIncrementally(
|
||||
GarbageCollectionReason gc_reason) {
|
||||
if (FLAG_trace_incremental_marking) {
|
||||
@ -3526,27 +3548,9 @@ void Heap::FinalizeIncrementalMarkingIncrementally(
|
||||
TRACE_EVENT0("v8", "V8.GCIncrementalMarkingFinalize");
|
||||
TRACE_GC(tracer(), GCTracer::Scope::MC_INCREMENTAL_FINALIZE);
|
||||
|
||||
{
|
||||
GCCallbacksScope scope(this);
|
||||
if (scope.CheckReenter()) {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
TRACE_GC(tracer(), GCTracer::Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE);
|
||||
VMState<EXTERNAL> state(isolate_);
|
||||
HandleScope handle_scope(isolate_);
|
||||
CallGCPrologueCallbacks(kGCTypeIncrementalMarking, kNoGCCallbackFlags);
|
||||
}
|
||||
}
|
||||
InvokeIncrementalMarkingPrologueCallbacks();
|
||||
incremental_marking()->FinalizeIncrementally();
|
||||
{
|
||||
GCCallbacksScope scope(this);
|
||||
if (scope.CheckReenter()) {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
TRACE_GC(tracer(), GCTracer::Scope::MC_INCREMENTAL_EXTERNAL_EPILOGUE);
|
||||
VMState<EXTERNAL> state(isolate_);
|
||||
HandleScope handle_scope(isolate_);
|
||||
CallGCEpilogueCallbacks(kGCTypeIncrementalMarking, kNoGCCallbackFlags);
|
||||
}
|
||||
}
|
||||
InvokeIncrementalMarkingEpilogueCallbacks();
|
||||
}
|
||||
|
||||
void Heap::RegisterDeserializedObjectsForBlackAllocation(
|
||||
|
@ -1731,6 +1731,9 @@ class Heap {
|
||||
void FinalizeIncrementalMarkingIncrementally(
|
||||
GarbageCollectionReason gc_reason);
|
||||
|
||||
void InvokeIncrementalMarkingPrologueCallbacks();
|
||||
void InvokeIncrementalMarkingEpilogueCallbacks();
|
||||
|
||||
// Returns the timer used for a given GC type.
|
||||
// - GCScavenger: young generation GC
|
||||
// - GCCompactor: full GC
|
||||
|
@ -322,6 +322,9 @@ void IncrementalMarking::StartMarking() {
|
||||
heap()->isolate()->PrintWithTimestamp(
|
||||
"[IncrementalMarking] Start marking\n");
|
||||
}
|
||||
|
||||
heap_->InvokeIncrementalMarkingPrologueCallbacks();
|
||||
|
||||
is_compacting_ = !FLAG_never_compact && collector_->StartCompaction();
|
||||
collector_->StartMarking();
|
||||
|
||||
@ -352,6 +355,8 @@ void IncrementalMarking::StartMarking() {
|
||||
heap_->local_embedder_heap_tracer()->TracePrologue(
|
||||
heap_->flags_for_embedder_tracer());
|
||||
}
|
||||
|
||||
heap_->InvokeIncrementalMarkingEpilogueCallbacks();
|
||||
}
|
||||
|
||||
void IncrementalMarking::StartBlackAllocation() {
|
||||
|
Loading…
Reference in New Issue
Block a user