Commit fd8d03e8 authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

[heap] Convert GCRequestType to enum class

Bug: v8:12244,v8:12245
Change-Id: I1f0c7fa26e6db208f621470d4bcbea904909a799
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3274014
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77859}
parent fbc7f3ed
......@@ -1395,13 +1395,13 @@ void Heap::HandleGCRequest() {
} else if (CollectionRequested()) {
CheckCollectionRequested();
} else if (incremental_marking()->request_type() ==
IncrementalMarking::COMPLETE_MARKING) {
IncrementalMarking::GCRequestType::COMPLETE_MARKING) {
incremental_marking()->reset_request_type();
CollectAllGarbage(current_gc_flags_,
GarbageCollectionReason::kFinalizeMarkingViaStackGuard,
current_gc_callback_flags_);
} else if (incremental_marking()->request_type() ==
IncrementalMarking::FINALIZATION &&
IncrementalMarking::GCRequestType::FINALIZATION &&
incremental_marking()->IsMarking() &&
!incremental_marking()->finalize_marking_completed()) {
incremental_marking()->reset_request_type();
......
......@@ -639,7 +639,7 @@ void IncrementalMarking::FinalizeMarking(CompletionAction action) {
"[IncrementalMarking] requesting finalization of incremental "
"marking.\n");
}
request_type_ = FINALIZATION;
request_type_ = GCRequestType::FINALIZATION;
if (action == GC_VIA_STACK_GUARD) {
heap_->isolate()->stack_guard()->RequestGC();
}
......@@ -709,7 +709,7 @@ void IncrementalMarking::MarkingComplete(CompletionAction action) {
heap()->isolate()->PrintWithTimestamp(
"[IncrementalMarking] Complete (normal).\n");
}
request_type_ = COMPLETE_MARKING;
request_type_ = GCRequestType::COMPLETE_MARKING;
if (action == GC_VIA_STACK_GUARD) {
heap_->isolate()->stack_guard()->RequestGC();
}
......
......@@ -33,7 +33,7 @@ class V8_EXPORT_PRIVATE IncrementalMarking final {
enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD };
enum GCRequestType { NONE, COMPLETE_MARKING, FINALIZATION };
enum class GCRequestType { NONE, COMPLETE_MARKING, FINALIZATION };
using MarkingState = MarkCompactCollector::MarkingState;
using AtomicMarkingState = MarkCompactCollector::AtomicMarkingState;
......@@ -123,17 +123,18 @@ class V8_EXPORT_PRIVATE IncrementalMarking final {
inline bool IsComplete() const { return state() == COMPLETE; }
inline bool IsReadyToOverApproximateWeakClosure() const {
return request_type_ == FINALIZATION && !finalize_marking_completed_;
return request_type_ == GCRequestType::FINALIZATION &&
!finalize_marking_completed_;
}
inline bool NeedsFinalization() {
return IsMarking() &&
(request_type_ == FINALIZATION || request_type_ == COMPLETE_MARKING);
return IsMarking() && (request_type_ == GCRequestType::FINALIZATION ||
request_type_ == GCRequestType::COMPLETE_MARKING);
}
GCRequestType request_type() const { return request_type_; }
void reset_request_type() { request_type_ = NONE; }
void reset_request_type() { request_type_ = GCRequestType::NONE; }
bool CanBeActivated();
......@@ -310,7 +311,7 @@ class V8_EXPORT_PRIVATE IncrementalMarking final {
bool finalize_marking_completed_ = false;
IncrementalMarkingJob incremental_marking_job_;
std::atomic<GCRequestType> request_type_{NONE};
std::atomic<GCRequestType> request_type_{GCRequestType::NONE};
Observer new_generation_observer_;
Observer old_generation_observer_;
......
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