v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::internal::Scavenger Class Reference

#include <scavenger.h>

Collaboration diagram for v8::internal::Scavenger:

Classes

struct  PromotedListEntry
 

Public Types

using CopiedList
 
using ObjectAndMap = std::pair<Tagged<HeapObject>, Tagged<Map>>
 
using PinnedList
 
using PromotedList
 
using EmptyChunksList = ::heap::base::Worklist<MutablePageMetadata*, 64>
 

Public Member Functions

 Scavenger (ScavengerCollector *collector, Heap *heap, bool is_logging, EmptyChunksList *empty_chunks, CopiedList *copied_list, PinnedList *pinned_list, PromotedList *promoted_list, EphemeronRememberedSet::TableList *ephemeron_table_list)
 
void ScavengePage (MutablePageMetadata *page)
 
void Process (JobDelegate *delegate=nullptr)
 
void Finalize ()
 
void Publish ()
 
void AddEphemeronHashTable (Tagged< EphemeronHashTable > table)
 
bool PromoteIfLargeObject (Tagged< HeapObject > object)
 
void PinAndPushObject (MemoryChunk *chunk, Tagged< HeapObject > object, MapWord map_word)
 
void VisitPinnedObjects ()
 
size_t bytes_copied () const
 
size_t bytes_promoted () const
 
template<typename THeapObjectSlot >
CopyAndForwardResult SemiSpaceCopyObject (Tagged< Map > map, THeapObjectSlot slot, Tagged< HeapObject > object, int object_size, ObjectFields object_fields)
 
template<typename THeapObjectSlot , Scavenger::PromotionHeapChoice promotion_heap_choice>
CopyAndForwardResult PromoteObject (Tagged< Map > map, THeapObjectSlot slot, Tagged< HeapObject > object, int object_size, ObjectFields object_fields)
 
template<typename THeapObjectSlot , Scavenger::PromotionHeapChoice promotion_heap_choice>
SlotCallbackResult EvacuateObjectDefault (Tagged< Map > map, THeapObjectSlot slot, Tagged< HeapObject > object, int object_size, ObjectFields object_fields)
 
template<typename THeapObjectSlot >
SlotCallbackResult EvacuateObject (THeapObjectSlot slot, Tagged< Map > map, Tagged< HeapObject > source)
 

Static Public Attributes

static constexpr int kCopiedListSegmentSize = 256
 
static constexpr int kPinnedListSegmentSize = 64
 
static constexpr int kPromotedListSegmentSize = 256
 

Private Types

enum  PromotionHeapChoice { kPromoteIntoLocalHeap , kPromoteIntoSharedHeap }
 

Private Member Functions

Heapheap ()
 
void SynchronizePageAccess (Tagged< MaybeObject > object) const
 
void AddPageToSweeperIfNecessary (MutablePageMetadata *page)
 
template<typename TSlot >
SlotCallbackResult CheckAndScavengeObject (Heap *heap, TSlot slot)
 
template<typename TSlot >
void CheckOldToNewSlotForSharedUntyped (MemoryChunk *chunk, MutablePageMetadata *page, TSlot slot)
 
void CheckOldToNewSlotForSharedTyped (MemoryChunk *chunk, MutablePageMetadata *page, SlotType slot_type, Address slot_address, Tagged< MaybeObject > new_target)
 
template<typename THeapObjectSlot >
SlotCallbackResult ScavengeObject (THeapObjectSlot p, Tagged< HeapObject > object)
 
V8_INLINE bool MigrateObject (Tagged< Map > map, Tagged< HeapObject > source, Tagged< HeapObject > target, int size, PromotionHeapChoice promotion_heap_choice)
 
V8_INLINE SlotCallbackResult RememberedSetEntryNeeded (CopyAndForwardResult result)
 
template<typename THeapObjectSlot >
V8_INLINE CopyAndForwardResult SemiSpaceCopyObject (Tagged< Map > map, THeapObjectSlot slot, Tagged< HeapObject > object, int object_size, ObjectFields object_fields)
 
template<typename THeapObjectSlot , PromotionHeapChoice promotion_heap_choice = kPromoteIntoLocalHeap>
V8_INLINE CopyAndForwardResult PromoteObject (Tagged< Map > map, THeapObjectSlot slot, Tagged< HeapObject > object, int object_size, ObjectFields object_fields)
 
template<typename THeapObjectSlot >
V8_INLINE SlotCallbackResult EvacuateObject (THeapObjectSlot slot, Tagged< Map > map, Tagged< HeapObject > source)
 
V8_INLINE bool HandleLargeObject (Tagged< Map > map, Tagged< HeapObject > object, int object_size, ObjectFields object_fields)
 
template<typename THeapObjectSlot , PromotionHeapChoice promotion_heap_choice = kPromoteIntoLocalHeap>
V8_INLINE SlotCallbackResult EvacuateObjectDefault (Tagged< Map > map, THeapObjectSlot slot, Tagged< HeapObject > object, int object_size, ObjectFields object_fields)
 
template<typename THeapObjectSlot >
SlotCallbackResult EvacuateThinString (Tagged< Map > map, THeapObjectSlot slot, Tagged< ThinString > object, int object_size)
 
template<typename THeapObjectSlot >
SlotCallbackResult EvacuateShortcutCandidate (Tagged< Map > map, THeapObjectSlot slot, Tagged< ConsString > object, int object_size)
 
template<typename THeapObjectSlot >
SlotCallbackResult EvacuateInPlaceInternalizableString (Tagged< Map > map, THeapObjectSlot slot, Tagged< String > string, int object_size, ObjectFields object_fields)
 
void IterateAndScavengePromotedObject (Tagged< HeapObject > target, Tagged< Map > map, int size)
 
void RememberPromotedEphemeron (Tagged< EphemeronHashTable > table, int index)
 
V8_INLINE bool ShouldEagerlyProcessPromotedList () const
 
void PushPinnedObject (Tagged< HeapObject > object, Tagged< Map > map, int object_size)
 
void PushPinnedPromotedObject (Tagged< HeapObject > object, Tagged< Map > map, int object_size)
 

Private Attributes

ScavengerCollector *const collector_
 
Heap *const heap_
 
EmptyChunksList::Local local_empty_chunks_
 
CopiedList::Local local_copied_list_
 
PinnedList::Local local_pinned_list_
 
PromotedList::Local local_promoted_list_
 
EphemeronRememberedSet::TableList::Local local_ephemeron_table_list_
 
PretenuringHandler::PretenuringFeedbackMap local_pretenuring_feedback_
 
EphemeronRememberedSet::TableMap local_ephemeron_remembered_set_
 
SurvivingNewLargeObjectsMap local_surviving_new_large_objects_
 
size_t copied_size_ {0}
 
size_t promoted_size_ {0}
 
EvacuationAllocator allocator_
 
const bool is_logging_
 
const bool shared_string_table_
 
const bool mark_shared_heap_
 
const bool shortcut_strings_
 

Static Private Attributes

static const int kInterruptThreshold = 128
 

Friends

class IterateAndScavengePromotedObjectsVisitor
 
class RootScavengeVisitor
 
class ScavengeVisitor
 

Detailed Description

Definition at line 42 of file scavenger.h.

Member Typedef Documentation

◆ CopiedList

◆ EmptyChunksList

◆ ObjectAndMap

Definition at line 51 of file scavenger.h.

◆ PinnedList

◆ PromotedList

Member Enumeration Documentation

◆ PromotionHeapChoice

Enumerator
kPromoteIntoLocalHeap 
kPromoteIntoSharedHeap 

Definition at line 95 of file scavenger.h.

Constructor & Destructor Documentation

◆ Scavenger()

v8::internal::Scavenger::Scavenger ( ScavengerCollector * collector,
Heap * heap,
bool is_logging,
EmptyChunksList * empty_chunks,
CopiedList * copied_list,
PinnedList * pinned_list,
PromotedList * promoted_list,
EphemeronRememberedSet::TableList * ephemeron_table_list )

Definition at line 1109 of file scavenger.cc.

Member Function Documentation

◆ AddEphemeronHashTable()

void v8::internal::Scavenger::AddEphemeronHashTable ( Tagged< EphemeronHashTable > table)

Definition at line 1370 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddPageToSweeperIfNecessary()

void v8::internal::Scavenger::AddPageToSweeperIfNecessary ( MutablePageMetadata * page)
private

◆ bytes_copied()

size_t v8::internal::Scavenger::bytes_copied ( ) const
inline

Definition at line 91 of file scavenger.h.

Here is the caller graph for this function:

◆ bytes_promoted()

size_t v8::internal::Scavenger::bytes_promoted ( ) const
inline

Definition at line 92 of file scavenger.h.

Here is the caller graph for this function:

◆ CheckAndScavengeObject()

template<typename TSlot >
SlotCallbackResult v8::internal::Scavenger::CheckAndScavengeObject ( Heap * heap,
TSlot slot )
inlineprivate

Definition at line 407 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckOldToNewSlotForSharedTyped()

void v8::internal::Scavenger::CheckOldToNewSlotForSharedTyped ( MemoryChunk * chunk,
MutablePageMetadata * page,
SlotType slot_type,
Address slot_address,
Tagged< MaybeObject > new_target )
inlineprivate

Definition at line 1388 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckOldToNewSlotForSharedUntyped()

template<typename TSlot >
void v8::internal::Scavenger::CheckOldToNewSlotForSharedUntyped ( MemoryChunk * chunk,
MutablePageMetadata * page,
TSlot slot )
inlineprivate

Definition at line 1375 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EvacuateInPlaceInternalizableString()

template<typename THeapObjectSlot >
SlotCallbackResult v8::internal::Scavenger::EvacuateInPlaceInternalizableString ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< String > string,
int object_size,
ObjectFields object_fields )
inlineprivate

Definition at line 302 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EvacuateObject() [1/2]

template<typename THeapObjectSlot >
SlotCallbackResult v8::internal::Scavenger::EvacuateObject ( THeapObjectSlot slot,
Tagged< Map > map,
Tagged< HeapObject > source )

Definition at line 315 of file scavenger-inl.h.

Here is the call graph for this function:

◆ EvacuateObject() [2/2]

template<typename THeapObjectSlot >
V8_INLINE SlotCallbackResult v8::internal::Scavenger::EvacuateObject ( THeapObjectSlot slot,
Tagged< Map > map,
Tagged< HeapObject > source )
private
Here is the caller graph for this function:

◆ EvacuateObjectDefault() [1/2]

template<typename THeapObjectSlot , Scavenger::PromotionHeapChoice promotion_heap_choice>
SlotCallbackResult v8::internal::Scavenger::EvacuateObjectDefault ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< HeapObject > object,
int object_size,
ObjectFields object_fields )

Definition at line 189 of file scavenger-inl.h.

Here is the call graph for this function:

◆ EvacuateObjectDefault() [2/2]

template<typename THeapObjectSlot , PromotionHeapChoice promotion_heap_choice = kPromoteIntoLocalHeap>
V8_INLINE SlotCallbackResult v8::internal::Scavenger::EvacuateObjectDefault ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< HeapObject > object,
int object_size,
ObjectFields object_fields )
private
Here is the caller graph for this function:

◆ EvacuateShortcutCandidate()

template<typename THeapObjectSlot >
SlotCallbackResult v8::internal::Scavenger::EvacuateShortcutCandidate ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< ConsString > object,
int object_size )
inlineprivate

Definition at line 260 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EvacuateThinString()

template<typename THeapObjectSlot >
SlotCallbackResult v8::internal::Scavenger::EvacuateThinString ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< ThinString > object,
int object_size )
inlineprivate

Definition at line 234 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Finalize()

void v8::internal::Scavenger::Finalize ( )

Definition at line 1339 of file scavenger.cc.

Here is the call graph for this function:

◆ HandleLargeObject()

bool v8::internal::Scavenger::HandleLargeObject ( Tagged< Map > map,
Tagged< HeapObject > object,
int object_size,
ObjectFields object_fields )
private

Definition at line 169 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ heap()

Heap * v8::internal::Scavenger::heap ( )
inlineprivate

Definition at line 101 of file scavenger.h.

Here is the caller graph for this function:

◆ IterateAndScavengePromotedObject()

void v8::internal::Scavenger::IterateAndScavengePromotedObject ( Tagged< HeapObject > target,
Tagged< Map > map,
int size )
private

Definition at line 1131 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MigrateObject()

bool v8::internal::Scavenger::MigrateObject ( Tagged< Map > map,
Tagged< HeapObject > source,
Tagged< HeapObject > target,
int size,
PromotionHeapChoice promotion_heap_choice )
private

Definition at line 48 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PinAndPushObject()

void v8::internal::Scavenger::PinAndPushObject ( MemoryChunk * chunk,
Tagged< HeapObject > object,
MapWord map_word )

Definition at line 1410 of file scavenger.cc.

Here is the call graph for this function:

◆ Process()

void v8::internal::Scavenger::Process ( JobDelegate * delegate = nullptr)

Definition at line 1245 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PromoteIfLargeObject()

bool v8::internal::Scavenger::PromoteIfLargeObject ( Tagged< HeapObject > object)

Definition at line 1404 of file scavenger.cc.

Here is the call graph for this function:

◆ PromoteObject() [1/2]

template<typename THeapObjectSlot , Scavenger::PromotionHeapChoice promotion_heap_choice>
CopyAndForwardResult v8::internal::Scavenger::PromoteObject ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< HeapObject > object,
int object_size,
ObjectFields object_fields )

Definition at line 118 of file scavenger-inl.h.

Here is the call graph for this function:

◆ PromoteObject() [2/2]

template<typename THeapObjectSlot , PromotionHeapChoice promotion_heap_choice = kPromoteIntoLocalHeap>
V8_INLINE CopyAndForwardResult v8::internal::Scavenger::PromoteObject ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< HeapObject > object,
int object_size,
ObjectFields object_fields )
private
Here is the caller graph for this function:

◆ Publish()

void v8::internal::Scavenger::Publish ( )

Definition at line 1364 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PushPinnedObject()

void v8::internal::Scavenger::PushPinnedObject ( Tagged< HeapObject > object,
Tagged< Map > map,
int object_size )
private

Definition at line 1428 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PushPinnedPromotedObject()

void v8::internal::Scavenger::PushPinnedPromotedObject ( Tagged< HeapObject > object,
Tagged< Map > map,
int object_size )
private

Definition at line 1438 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RememberedSetEntryNeeded()

SlotCallbackResult v8::internal::Scavenger::RememberedSetEntryNeeded ( CopyAndForwardResult result)
private

Definition at line 162 of file scavenger-inl.h.

Here is the caller graph for this function:

◆ RememberPromotedEphemeron()

void v8::internal::Scavenger::RememberPromotedEphemeron ( Tagged< EphemeronHashTable > table,
int index )
private

Definition at line 1150 of file scavenger.cc.

Here is the caller graph for this function:

◆ ScavengeObject()

template<typename THeapObjectSlot >
SlotCallbackResult v8::internal::Scavenger::ScavengeObject ( THeapObjectSlot p,
Tagged< HeapObject > object )
inlineprivate

Definition at line 353 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ScavengePage()

void v8::internal::Scavenger::ScavengePage ( MutablePageMetadata * page)

Definition at line 1157 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SemiSpaceCopyObject() [1/2]

template<typename THeapObjectSlot >
CopyAndForwardResult v8::internal::Scavenger::SemiSpaceCopyObject ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< HeapObject > object,
int object_size,
ObjectFields object_fields )

Definition at line 80 of file scavenger-inl.h.

Here is the call graph for this function:

◆ SemiSpaceCopyObject() [2/2]

template<typename THeapObjectSlot >
V8_INLINE CopyAndForwardResult v8::internal::Scavenger::SemiSpaceCopyObject ( Tagged< Map > map,
THeapObjectSlot slot,
Tagged< HeapObject > object,
int object_size,
ObjectFields object_fields )
private
Here is the caller graph for this function:

◆ ShouldEagerlyProcessPromotedList()

bool v8::internal::Scavenger::ShouldEagerlyProcessPromotedList ( ) const
private

Definition at line 29 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SynchronizePageAccess()

void v8::internal::Scavenger::SynchronizePageAccess ( Tagged< MaybeObject > object) const
inlineprivate

Definition at line 37 of file scavenger-inl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VisitPinnedObjects()

void v8::internal::Scavenger::VisitPinnedObjects ( )

Definition at line 1448 of file scavenger.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ IterateAndScavengePromotedObjectsVisitor

Definition at line 211 of file scavenger.h.

◆ RootScavengeVisitor

friend class RootScavengeVisitor
friend

Definition at line 212 of file scavenger.h.

◆ ScavengeVisitor

friend class ScavengeVisitor
friend

Definition at line 213 of file scavenger.h.

Member Data Documentation

◆ allocator_

EvacuationAllocator v8::internal::Scavenger::allocator_
private

Definition at line 204 of file scavenger.h.

◆ collector_

ScavengerCollector* const v8::internal::Scavenger::collector_
private

Definition at line 192 of file scavenger.h.

◆ copied_size_

size_t v8::internal::Scavenger::copied_size_ {0}
private

Definition at line 202 of file scavenger.h.

◆ heap_

Heap* const v8::internal::Scavenger::heap_
private

Definition at line 193 of file scavenger.h.

◆ is_logging_

const bool v8::internal::Scavenger::is_logging_
private

Definition at line 206 of file scavenger.h.

◆ kCopiedListSegmentSize

int v8::internal::Scavenger::kCopiedListSegmentSize = 256
staticconstexpr

Definition at line 44 of file scavenger.h.

◆ kInterruptThreshold

const int v8::internal::Scavenger::kInterruptThreshold = 128
staticprivate

Definition at line 99 of file scavenger.h.

◆ kPinnedListSegmentSize

int v8::internal::Scavenger::kPinnedListSegmentSize = 64
staticconstexpr

Definition at line 45 of file scavenger.h.

◆ kPromotedListSegmentSize

int v8::internal::Scavenger::kPromotedListSegmentSize = 256
staticconstexpr

Definition at line 46 of file scavenger.h.

◆ local_copied_list_

CopiedList::Local v8::internal::Scavenger::local_copied_list_
private

Definition at line 195 of file scavenger.h.

◆ local_empty_chunks_

EmptyChunksList::Local v8::internal::Scavenger::local_empty_chunks_
private

Definition at line 194 of file scavenger.h.

◆ local_ephemeron_remembered_set_

EphemeronRememberedSet::TableMap v8::internal::Scavenger::local_ephemeron_remembered_set_
private

Definition at line 200 of file scavenger.h.

◆ local_ephemeron_table_list_

EphemeronRememberedSet::TableList::Local v8::internal::Scavenger::local_ephemeron_table_list_
private

Definition at line 198 of file scavenger.h.

◆ local_pinned_list_

PinnedList::Local v8::internal::Scavenger::local_pinned_list_
private

Definition at line 196 of file scavenger.h.

◆ local_pretenuring_feedback_

PretenuringHandler::PretenuringFeedbackMap v8::internal::Scavenger::local_pretenuring_feedback_
private

Definition at line 199 of file scavenger.h.

◆ local_promoted_list_

PromotedList::Local v8::internal::Scavenger::local_promoted_list_
private

Definition at line 197 of file scavenger.h.

◆ local_surviving_new_large_objects_

SurvivingNewLargeObjectsMap v8::internal::Scavenger::local_surviving_new_large_objects_
private

Definition at line 201 of file scavenger.h.

◆ mark_shared_heap_

const bool v8::internal::Scavenger::mark_shared_heap_
private

Definition at line 208 of file scavenger.h.

◆ promoted_size_

size_t v8::internal::Scavenger::promoted_size_ {0}
private

Definition at line 203 of file scavenger.h.

◆ shared_string_table_

const bool v8::internal::Scavenger::shared_string_table_
private

Definition at line 207 of file scavenger.h.

◆ shortcut_strings_

const bool v8::internal::Scavenger::shortcut_strings_
private

Definition at line 209 of file scavenger.h.


The documentation for this class was generated from the following files: