v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
marking-state.h
Go to the documentation of this file.
1// Copyright 2022 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 V8_HEAP_MARKING_STATE_H_
6#define V8_HEAP_MARKING_STATE_H_
7
9#include "src/heap/marking.h"
11
12namespace v8 {
13namespace internal {
14
15class MemoryChunkMetadata;
16class MutablePageMetadata;
17
18template <typename ConcreteState, AccessMode access_mode>
20 public:
22#if V8_COMPRESS_POINTERS
23 : cage_base_(cage_base)
24#endif
25 {
26 }
27
28 // The pointer compression cage base value used for decompression of all
29 // tagged values except references to InstructionStream objects.
31#if V8_COMPRESS_POINTERS
32 return cage_base_;
33#else
34 return PtrComprCageBase{};
35#endif // V8_COMPRESS_POINTERS
36 }
37
39 // Helper method for fully marking an object and accounting its live bytes.
40 // Should be used to mark individual objects in one-off cases.
42 // Same, but does not require the object to be initialized.
44 int object_size);
45 V8_INLINE bool IsMarked(const Tagged<HeapObject> obj) const;
46 V8_INLINE bool IsUnmarked(const Tagged<HeapObject> obj) const;
47
48 private:
49#if V8_COMPRESS_POINTERS
50 const PtrComprCageBase cage_base_;
51#endif // V8_COMPRESS_POINTERS
52};
53
54// This is used by marking visitors.
55class MarkingState final
56 : public MarkingStateBase<MarkingState, AccessMode::ATOMIC> {
57 public:
60};
61
63 : public MarkingStateBase<NonAtomicMarkingState, AccessMode::NON_ATOMIC> {
64 public:
67};
68
69} // namespace internal
70} // namespace v8
71
72#endif // V8_HEAP_MARKING_STATE_H_
V8_INLINE PtrComprCageBase cage_base() const
V8_INLINE bool IsMarked(const Tagged< HeapObject > obj) const
V8_INLINE bool TryMarkAndAccountLiveBytes(Tagged< HeapObject > obj)
V8_INLINE bool TryMark(Tagged< HeapObject > obj)
MarkingStateBase(PtrComprCageBase cage_base)
V8_INLINE bool IsUnmarked(const Tagged< HeapObject > obj) const
MarkingState(PtrComprCageBase cage_base)
NonAtomicMarkingState(PtrComprCageBase cage_base)
#define V8_INLINE
Definition v8config.h:500