v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
young-generation-marking-visitor.h
Go to the documentation of this file.
1// Copyright 2023 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_YOUNG_GENERATION_MARKING_VISITOR_H_
6#define V8_HEAP_YOUNG_GENERATION_MARKING_VISITOR_H_
7
8#include <type_traits>
9
12#include "src/heap/heap.h"
15
16namespace v8 {
17namespace internal {
18
20
21template <YoungGenerationMarkingVisitationMode marking_mode>
23 : public NewSpaceVisitor<YoungGenerationMarkingVisitor<marking_mode>> {
24 public:
26
31
32 enum class SlotTreatmentMode {
35 };
36
38 Heap* heap,
39 PretenuringHandler::PretenuringFeedbackMap* local_pretenuring_feedback);
40
42
45 const YoungGenerationMarkingVisitor&) = delete;
46
47 static constexpr bool EnableConcurrentVisitation() {
49 }
50
60 VisitPointersImpl(host, p, p + 1);
61 }
63 MaybeObjectSlot p) final {
64 VisitPointersImpl(host, p, p + 1);
65 }
66
67 // Visitation specializations used for unified heap young gen marking.
71 // Visitation specializations used for collecting pretenuring feedback.
72 template <typename T, typename TBodyDescriptor = typename T::BodyDescriptor>
75
79
80#ifdef V8_COMPRESS_POINTERS
82 ExternalPointerSlot slot) final;
83#endif // V8_COMPRESS_POINTERS
85 CppHeapPointerSlot slot) override;
86
87 template <ObjectVisitationMode visitation_mode,
88 SlotTreatmentMode slot_treatment_mode, typename TSlot>
89 V8_INLINE bool VisitObjectViaSlot(TSlot slot);
90
91 template <typename TSlot>
93
97
99 intptr_t by);
100
105
106 V8_INLINE static constexpr bool CanEncounterFillerOrFreeSpace() {
107 return false;
108 }
109
110 private:
112 return MarkBit::From(obj).Set<AccessMode::ATOMIC>();
113 }
114
115 template <typename TSlot>
117 TSlot end);
118
119#ifdef V8_MINORMS_STRING_SHORTCUTTING
120 V8_INLINE bool ShortCutStrings(HeapObjectSlot slot,
121 Tagged<HeapObject>* heap_object);
122#endif // V8_MINORMS_STRING_SHORTCUTTING
123
124 static constexpr size_t kNumEntries = 128;
125 static constexpr size_t kEntriesMask = kNumEntries - 1;
126 // Fixed-size hashmap that caches live bytes. Hashmap entries are evicted to
127 // the global counters on collision.
128 std::array<std::pair<MutablePageMetadata*, size_t>, kNumEntries>
130
137};
138
139} // namespace internal
140} // namespace v8
141
142#endif // V8_HEAP_YOUNG_GENERATION_MARKING_VISITOR_H_
static V8_ALLOW_UNUSED MarkBit From(Address)
virtual void VisitExternalPointer(Tagged< HeapObject > host, ExternalPointerSlot slot)
Definition visitors.h:188
std::unordered_map< Tagged< AllocationSite >, size_t, Object::Hasher > PretenuringFeedbackMap
YoungGenerationMarkingVisitor(Heap *heap, PretenuringHandler::PretenuringFeedbackMap *local_pretenuring_feedback)
V8_INLINE void VisitPointersImpl(Tagged< HeapObject > host, TSlot start, TSlot end)
PretenuringHandler::PretenuringFeedbackMap *const local_pretenuring_feedback_
V8_INLINE void VisitPointers(Tagged< HeapObject > host, ObjectSlot start, ObjectSlot end) final
EphemeronRememberedSet::TableList::Local ephemeron_table_list_local_
V8_INLINE void VisitCppHeapPointer(Tagged< HeapObject > host, CppHeapPointerSlot slot) override
std::array< std::pair< MutablePageMetadata *, size_t >, kNumEntries > live_bytes_data_
V8_INLINE size_t VisitJSObjectSubclass(Tagged< Map > map, Tagged< T > object, MaybeObjectSize)
V8_INLINE void VisitPointer(Tagged< HeapObject > host, MaybeObjectSlot p) final
V8_INLINE size_t VisitEphemeronHashTable(Tagged< Map > map, Tagged< EphemeronHashTable > table, MaybeObjectSize)
YoungGenerationMarkingVisitor & operator=(const YoungGenerationMarkingVisitor &)=delete
V8_INLINE void VisitPointer(Tagged< HeapObject > host, ObjectSlot p) final
V8_INLINE void VisitPointers(Tagged< HeapObject > host, MaybeObjectSlot start, MaybeObjectSlot end) final
YoungGenerationMarkingVisitor(const YoungGenerationMarkingVisitor &)=delete
V8_INLINE void IncrementLiveBytesCached(MutablePageMetadata *chunk, intptr_t by)
V8_INLINE size_t VisitJSArrayBuffer(Tagged< Map > map, Tagged< JSArrayBuffer > object, MaybeObjectSize)
int start
int end
#define V8_INLINE
Definition v8config.h:500