Commit b1b8190e authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Add Heap::IsGCWithStack() method

Replace Heap::IsGCWithoutStack() with Heap::IsGCWithStack() to avoid
double-negation.

Bug: chromium:1359294, v8:12578
Change-Id: I8f2e9feb48e574fae6a7721f86a70728b089ec67
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3878170
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83037}
parent 349837a5
......@@ -501,9 +501,9 @@ void Heap::SetGCState(HeapState state) {
gc_state_.store(state, std::memory_order_relaxed);
}
bool Heap::IsGCWithoutStack() const {
bool Heap::IsGCWithStack() const {
return local_embedder_heap_tracer()->embedder_stack_state() ==
cppgc::EmbedderStackState::kNoHeapPointers;
cppgc::EmbedderStackState::kMayContainHeapPointers;
}
void Heap::PrintShortHeapStatistics() {
......
......@@ -693,7 +693,7 @@ class Heap {
inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; }
bool IsGCWithoutStack() const;
bool IsGCWithStack() const;
// If an object has an AllocationMemento trailing it, return it, otherwise
// return a null AllocationMemento.
......
......@@ -572,7 +572,7 @@ bool MarkCompactCollector::StartCompaction(StartCompactionMode mode) {
// Bailouts for completely disabled compaction.
if (!v8_flags.compact ||
(mode == StartCompactionMode::kAtomic && !heap()->IsGCWithoutStack() &&
(mode == StartCompactionMode::kAtomic && heap()->IsGCWithStack() &&
!v8_flags.compact_with_stack) ||
(v8_flags.gc_experiment_less_compaction &&
!heap_->ShouldReduceMemory())) {
......@@ -586,7 +586,7 @@ bool MarkCompactCollector::StartCompaction(StartCompactionMode mode) {
}
if (v8_flags.compact_code_space &&
(heap()->IsGCWithoutStack() || v8_flags.compact_code_space_with_stack)) {
(!heap()->IsGCWithStack() || v8_flags.compact_code_space_with_stack)) {
CollectEvacuationCandidates(heap()->code_space());
} else if (v8_flags.trace_fragmentation) {
TraceFragmentation(heap()->code_space());
......@@ -4507,7 +4507,7 @@ void MarkCompactCollector::EvacuatePagesInParallel() {
// Evacuation of new space pages cannot be aborted, so it needs to run
// before old space evacuation.
bool force_page_promotion =
!heap()->IsGCWithoutStack() && !v8_flags.compact_with_stack;
heap()->IsGCWithStack() && !v8_flags.compact_with_stack;
for (Page* page : new_space_evacuation_pages_) {
intptr_t live_bytes_on_page = non_atomic_marking_state()->live_bytes(page);
DCHECK_LT(0, live_bytes_on_page);
......@@ -4524,7 +4524,7 @@ void MarkCompactCollector::EvacuatePagesInParallel() {
evacuation_items.emplace_back(ParallelWorkItem{}, page);
}
if (!heap()->IsGCWithoutStack()) {
if (heap()->IsGCWithStack()) {
if (!v8_flags.compact_with_stack ||
!v8_flags.compact_code_space_with_stack) {
for (Page* page : old_space_evacuation_pages_) {
......
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