[heap] Fix regression around GC request via stack guard
When a GC was requested via stack guard, we don't restart incremental marking anymore on finding new objects but rather finish the GC cycle. This regressed in https://crrev.com/c/3702801 Bug: v8:12985, chromium:1338071, v8:12775 Change-Id: Ie515cea6d5345ad1111a4fb9f042cffc52083453 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3716486 Reviewed-by: Omer Katz <omerkatz@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/main@{#81291}
This commit is contained in:
parent
94ebff7b94
commit
9076fce87b
@ -1529,7 +1529,7 @@ void Heap::HandleGCRequest() {
|
||||
CheckMemoryPressure();
|
||||
} else if (CollectionRequested()) {
|
||||
CheckCollectionRequested();
|
||||
} else if (incremental_marking()->IsComplete()) {
|
||||
} else if (incremental_marking()->CollectionRequested()) {
|
||||
CollectAllGarbage(current_gc_flags_,
|
||||
GarbageCollectionReason::kFinalizeMarkingViaStackGuard,
|
||||
current_gc_callback_flags_);
|
||||
|
@ -524,7 +524,9 @@ bool IncrementalMarking::Stop() {
|
||||
}
|
||||
}
|
||||
|
||||
collection_requested_ = false;
|
||||
heap_->isolate()->stack_guard()->ClearGC();
|
||||
|
||||
SetState(STOPPED);
|
||||
is_compacting_ = false;
|
||||
FinishBlackAllocation();
|
||||
@ -608,6 +610,7 @@ void IncrementalMarking::MarkingComplete(CompletionAction action) {
|
||||
}
|
||||
|
||||
if (action == CompletionAction::kGcViaStackGuard) {
|
||||
collection_requested_ = true;
|
||||
heap_->isolate()->stack_guard()->RequestGC();
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,8 @@ class V8_EXPORT_PRIVATE IncrementalMarking final {
|
||||
bool IsMarking() const { return state() >= MARKING; }
|
||||
bool IsComplete() const { return state() == COMPLETE; }
|
||||
|
||||
bool CollectionRequested() const { return collection_requested_; }
|
||||
|
||||
bool CanBeActivated();
|
||||
bool WasActivated();
|
||||
|
||||
@ -269,6 +271,7 @@ class V8_EXPORT_PRIVATE IncrementalMarking final {
|
||||
bool is_compacting_ = false;
|
||||
bool was_activated_ = false;
|
||||
bool black_allocation_ = false;
|
||||
bool collection_requested_ = false;
|
||||
IncrementalMarkingJob incremental_marking_job_;
|
||||
|
||||
Observer new_generation_observer_;
|
||||
|
Loading…
Reference in New Issue
Block a user