1 // Copyright 2020 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_ 6 #define INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_ 7 8 #include "cppgc/internal/atomic-entry-flag.h" 9 #include "v8config.h" // NOLINT(build/include_directory) 10 11 namespace cppgc { 12 namespace internal { 13 14 class V8_EXPORT ProcessHeap final { 15 public: EnterIncrementalOrConcurrentMarking()16 static void EnterIncrementalOrConcurrentMarking() { 17 concurrent_marking_flag_.Enter(); 18 } ExitIncrementalOrConcurrentMarking()19 static void ExitIncrementalOrConcurrentMarking() { 20 concurrent_marking_flag_.Exit(); 21 } 22 IsAnyIncrementalOrConcurrentMarking()23 static bool IsAnyIncrementalOrConcurrentMarking() { 24 return concurrent_marking_flag_.MightBeEntered(); 25 } 26 27 private: 28 static AtomicEntryFlag concurrent_marking_flag_; 29 }; 30 31 } // namespace internal 32 } // namespace cppgc 33 34 #endif // INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_ 35