Commit 29b4d2a1 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

cppgc: Random style fixes and comment updates

Bug: chromium:1056170
Change-Id: I00511c69e9681a80993bcb8ddb370030fc3d208c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2649030
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72343}
parent 3a405b01
......@@ -10,9 +10,17 @@
namespace cppgc {
// Indicator for the stack state of the embedder.
/**
* Indicator for the stack state of the embedder.
*/
enum class EmbedderStackState {
/**
* Stack may contain interesting heap pointers.
*/
kMayContainHeapPointers,
/**
* Stack does not contain any interesting heap pointers.
*/
kNoHeapPointers,
};
......
......@@ -12,8 +12,13 @@
namespace cppgc {
namespace internal {
class CompactionWorklists {
class CompactionWorklists final {
public:
CompactionWorklists() = default;
CompactionWorklists(const CompactionWorklists&) = delete;
CompactionWorklists& operator=(const CompactionWorklists&) = delete;
using MovableReference = const void*;
using MovableReferencesWorklist =
......
......@@ -435,7 +435,7 @@ Compactor::Compactor(RawHeap& heap) : heap_(heap) {
bool Compactor::ShouldCompact(
GarbageCollector::Config::MarkingType marking_type,
GarbageCollector::Config::StackState stack_state) {
GarbageCollector::Config::StackState stack_state) const {
if (compactable_spaces_.empty() ||
(marking_type == GarbageCollector::Config::MarkingType::kAtomic &&
stack_state ==
......
......@@ -20,6 +20,9 @@ class V8_EXPORT_PRIVATE Compactor final {
explicit Compactor(RawHeap&);
~Compactor() { DCHECK(!is_enabled_); }
Compactor(const Compactor&) = delete;
Compactor& operator=(const Compactor&) = delete;
void InitializeIfShouldCompact(GarbageCollector::Config::MarkingType,
GarbageCollector::Config::StackState);
// Returns true is compaction was cancelled.
......@@ -32,12 +35,11 @@ class V8_EXPORT_PRIVATE Compactor final {
}
void EnableForNextGCForTesting() { enable_for_next_gc_for_testing_ = true; }
bool IsEnabledForTesting() const { return is_enabled_; }
private:
bool ShouldCompact(GarbageCollector::Config::MarkingType,
GarbageCollector::Config::StackState);
GarbageCollector::Config::StackState) const;
RawHeap& heap_;
// Compactor does not own the compactable spaces. The heap owns all spaces.
......@@ -46,7 +48,6 @@ class V8_EXPORT_PRIVATE Compactor final {
std::unique_ptr<CompactionWorklists> compaction_worklists_;
bool is_enabled_ = false;
bool enable_for_next_gc_for_testing_ = false;
};
......
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