v8
3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
|
#include <mark-compact.h>
Data Structures | |
class | SweeperTask |
Public Types | |
enum | CompactionMode { INCREMENTAL_COMPACTION, NON_INCREMENTAL_COMPACTION } |
enum | SweeperType { CONSERVATIVE, LAZY_CONSERVATIVE, PARALLEL_CONSERVATIVE, CONCURRENT_CONSERVATIVE, PRECISE } |
enum | SweepingParallelism { SWEEP_SEQUENTIALLY, SWEEP_IN_PARALLEL } |
typedef MaybeObject *(* | AllocationFunction )(Heap *heap, HeapObject *object, int object_size) |
typedef void(* | EncodingFunction )(Heap *heap, HeapObject *old_object, int object_size, Object *new_object, int *offset) |
typedef void(* | ProcessNonLiveFunction )(HeapObject *object, Isolate *isolate) |
typedef int(MarkCompactCollector::* | LiveObjectCallback )(HeapObject *obj) |
Static Public Member Functions | |
static void | Initialize () |
static void | ReportDeleteIfNeeded (HeapObject *obj, Isolate *isolate) |
static bool | IsMarked (Object *obj) |
template<SweepingParallelism type> | |
static intptr_t | SweepConservatively (PagedSpace *space, FreeList *free_list, Page *p) |
Static Public Attributes | |
static const uint32_t | kSingleFreeEncoding = 0 |
static const uint32_t | kMultiFreeEncoding = 1 |
Friends | |
class | RootMarkingVisitor |
class | MarkingVisitor |
class | MarkCompactMarkingVisitor |
class | CodeMarkingVisitor |
class | SharedFunctionInfoMarkingVisitor |
class | Heap |
Definition at line 537 of file mark-compact.h.
typedef MaybeObject*(* AllocationFunction)(Heap *heap, HeapObject *object, int object_size) |
Definition at line 544 of file mark-compact.h.
typedef void(* EncodingFunction)(Heap *heap, HeapObject *old_object, int object_size, Object *new_object, int *offset) |
Definition at line 556 of file mark-compact.h.
typedef int(MarkCompactCollector::* LiveObjectCallback)(HeapObject *obj) |
Definition at line 566 of file mark-compact.h.
typedef void(* ProcessNonLiveFunction)(HeapObject *object, Isolate *isolate) |
Definition at line 563 of file mark-compact.h.
enum CompactionMode |
Enumerator | |
---|---|
INCREMENTAL_COMPACTION | |
NON_INCREMENTAL_COMPACTION |
Definition at line 588 of file mark-compact.h.
enum SweeperType |
Enumerator | |
---|---|
CONSERVATIVE | |
LAZY_CONSERVATIVE | |
PARALLEL_CONSERVATIVE | |
CONCURRENT_CONSERVATIVE | |
PRECISE |
Definition at line 624 of file mark-compact.h.
enum SweepingParallelism |
Enumerator | |
---|---|
SWEEP_SEQUENTIALLY | |
SWEEP_IN_PARALLEL |
Definition at line 632 of file mark-compact.h.
|
inline |
Definition at line 716 of file mark-compact.h.
void AbortCompaction | ( | ) |
Definition at line 941 of file mark-compact.cc.
References ASSERT_EQ, MemoryChunk::ClearEvacuationCandidate(), MemoryChunk::ClearFlag(), SlotsBufferAllocator::DeallocateChain(), MemoryChunk::RESCAN_ON_EVACUATION, and MemoryChunk::slots_buffer_address().
Referenced by MarkCompactCollector::Prepare(), and MarkCompactCollector::TearDown().
void AddEvacuationCandidate | ( | Page * | p | ) |
Definition at line 366 of file mark-compact.cc.
References MemoryChunk::MarkEvacuationCandidate().
Referenced by MarkCompactCollector::CollectEvacuationCandidates().
bool AreSweeperThreadsActivated | ( | ) |
Definition at line 657 of file mark-compact.cc.
References MarkCompactCollector::isolate(), v8::internal::NULL, and Isolate::sweeper_threads().
Referenced by PagedSpace::EnsureSweeperProgress().
void ClearMarkbits | ( | ) |
Definition at line 556 of file mark-compact.cc.
References Heap::cell_space(), MarkBit::Clear(), Heap::code_space(), MemoryChunk::FromAddress(), Heap::lo_space(), Heap::map_space(), Heap::new_space(), MarkBit::Next(), v8::internal::NULL, obj, Heap::old_data_space(), Heap::old_pointer_space(), and Heap::property_cell_space().
Referenced by MarkCompactCollector::Prepare().
|
inline |
Definition at line 620 of file mark-compact.h.
Referenced by Context::AddOptimizedFunction(), SharedFunctionInfo::ClearOptimizedCodeMap(), and SharedFunctionInfo::ReplaceCode().
void CollectEvacuationCandidates | ( | PagedSpace * | space | ) |
Definition at line 786 of file mark-compact.cc.
References MarkCompactCollector::AddEvacuationCandidate(), v8::internal::AllocationSpaceName(), MemoryChunk::area_size(), PagedSpace::AreaSize(), ASSERT, MemoryChunk::ClearEvacuationCandidate(), v8::internal::CODE_SPACE, PagedSpace::CountTotalPages(), Space::heap(), Space::identity(), v8::internal::kPageSizeBits, MemoryChunk::LiveBytes(), v8::internal::MB, v8::internal::Min(), v8::internal::mode(), Heap::ms_count(), v8::internal::NULL, PagedSpace::ObtainFreeListStatistics(), v8::internal::OLD_DATA_SPACE, v8::internal::OLD_POINTER_SPACE, v8::internal::PrintF(), PagedSpace::SizeOfObjects(), PagedSpace::SizeStats::Total(), and Page::WasSwept().
Referenced by MarkCompactCollector::StartCompaction().
void CollectGarbage | ( | ) |
Definition at line 421 of file mark-compact.cc.
References ASSERT, v8::internal::EVEN_MARKING_PARITY, Smi::FromInt(), MarkCompactCollector::heap(), Heap::incremental_marking(), IncrementalMarking::IsStopped(), v8::internal::NULL, and v8::internal::ODD_MARKING_PARITY.
void EnableCodeFlushing | ( | bool | enable | ) |
Definition at line 4307 of file mark-compact.cc.
References CodeFlusher::EvictAllCandidates(), MarkCompactCollector::isolate(), v8::internal::NULL, and v8::internal::PrintF().
|
inline |
Definition at line 705 of file mark-compact.h.
Referenced by MarkCompactMarkingVisitor::VisitWeakCollection().
|
inline |
Definition at line 617 of file mark-compact.h.
Referenced by MarkCompactCollector::CollectGarbage(), MarkCompactMarkingVisitor::INLINE(), MarkCompactCollector::MarkWeakObjectToCodeTable(), MarkCompactCollector::MigrateObject(), MarkCompactCollector::Prepare(), MarkCompactCollector::RecordCodeTargetPatch(), MarkCompactCollector::RefillFreeLists(), MarkCompactCollector::StartCompaction(), MarkCompactCollector::SweepInParallel(), MarkCompactCollector::TryPromoteObject(), and MarkCompactCollector::WaitUntilSweepingCompleted().
|
static |
Definition at line 4352 of file mark-compact.cc.
References IncrementalMarking::Initialize(), and MarkCompactMarkingVisitor::Initialize().
|
inline |
Definition at line 652 of file mark-compact.h.
References MemoryChunk::FromAddress().
|
inline |
Definition at line 657 of file mark-compact.h.
References MemoryChunk::FromAddress().
|
inline |
Definition at line 662 of file mark-compact.h.
References MemoryChunk::FromAddress().
|
inline |
Definition at line 667 of file mark-compact.h.
References MemoryChunk::ClearEvacuationCandidate(), Space::identity(), v8::internal::OLD_DATA_SPACE, MemoryChunk::owner(), v8::internal::PrintF(), MemoryChunk::RESCAN_ON_EVACUATION, and MemoryChunk::SetFlag().
INLINE | ( | void | RecordSlotObject **anchor_slot, Object **slot, Object *object, SlotsBuffer::AdditionMode mode=SlotsBuffer::FAIL_ON_OVERFLOW | ) |
void InvalidateCode | ( | Code * | code | ) |
Definition at line 3396 of file mark-compact.cc.
References ASSERT, Heap::incremental_marking(), and IncrementalMarking::IsCompacting().
|
inline |
Definition at line 621 of file mark-compact.h.
References v8::internal::NULL.
|
inline |
Definition at line 718 of file mark-compact.h.
Referenced by Heap::ProcessWeakReferences(), and MarkCompactCollector::RecordCodeTargetPatch().
bool IsConcurrentSweepingInProgress | ( | ) |
Definition at line 662 of file mark-compact.cc.
Referenced by PagedSpace::EnsureSweeperProgress(), Heap::IsSweepingComplete(), and MarkCompactCollector::Prepare().
|
inlinestatic |
Definition at line 75 of file mark-compact-inl.h.
References ASSERT, and HeapObject::cast().
Referenced by MarkCompactMarkingVisitor::INLINE(), MarkCompactCollector::MarkWeakObjectToCodeTable(), and MarkCompactMarkingVisitor::VisitWeakCollection().
|
inline |
Definition at line 4347 of file mark-compact.cc.
References Heap::isolate().
Referenced by MarkCompactCollector::AreSweeperThreadsActivated(), MarkCompactCollector::EnableCodeFlushing(), MarkCompactCollector::MigrateObject(), MarkCompactCollector::RecordCodeTargetPatch(), and MarkCompactCollector::WaitUntilSweepingCompleted().
void MarkAllocationSite | ( | AllocationSite * | site | ) |
Definition at line 2156 of file mark-compact.cc.
Referenced by MarkCompactWeakObjectRetainer::RetainAs().
|
inline |
Definition at line 720 of file mark-compact.h.
void MarkWeakObjectToCodeTable | ( | ) |
Definition at line 2212 of file mark-compact.cc.
References HeapObject::cast(), MarkCompactCollector::heap(), and MarkCompactCollector::IsMarked().
void MigrateObject | ( | HeapObject * | dst, |
HeapObject * | src, | ||
int | size, | ||
AllocationSpace | to_old_space | ||
) |
Definition at line 2829 of file mark-compact.cc.
References HeapObject::address(), Memory::Address_at(), SlotsBuffer::AddTo(), ASSERT, ConstantPoolArray::cast(), Code::cast(), SlotsBuffer::CODE_ENTRY_SLOT, v8::internal::CODE_SPACE, ConstantPoolArray::count_of_code_ptr_entries(), MemoryChunk::FromAddress(), MarkCompactCollector::heap(), Isolate::heap_profiler(), SlotsBuffer::IGNORE_OVERFLOW, Heap::InNewSpace(), HeapProfiler::is_tracking_object_moves(), v8::internal::IsAligned(), MarkCompactCollector::isolate(), Heap::isolate(), JSFunction::kCodeEntryOffset, Page::kMaxRegularHeapObjectSize, v8::internal::kPointerSize, v8::internal::LO_SPACE, StoreBuffer::Mark(), Heap::MoveBlock(), v8::internal::NEW_SPACE, Memory::Object_at(), HeapProfiler::ObjectMoveEvent(), ConstantPoolArray::OffsetOfElementAt(), v8::internal::OLD_DATA_SPACE, v8::internal::OLD_POINTER_SPACE, PROFILE, Code::Relocate(), SlotsBuffer::RELOCATED_CODE_OBJECT, and Heap::store_buffer().
Referenced by MarkCompactCollector::TryPromoteObject().
void Prepare | ( | GCTracer * | tracer | ) |
Definition at line 958 of file mark-compact.cc.
References IncrementalMarking::Abort(), MarkCompactCollector::AbortCompaction(), ASSERT, MarkCompactCollector::ClearMarkbits(), MarkCompactCollector::heap(), v8::internal::IDLE, Heap::incremental_marking(), MarkCompactCollector::IsConcurrentSweepingInProgress(), MarkCompactCollector::NON_INCREMENTAL_COMPACTION, v8::internal::NULL, MarkCompactCollector::StartCompaction(), MarkCompactCollector::tracer(), and MarkCompactCollector::WaitUntilSweepingCompleted().
Definition at line 4434 of file mark-compact.cc.
References SlotsBuffer::AddTo(), SlotsBuffer::CODE_ENTRY_SLOT, SlotsBuffer::FAIL_ON_OVERFLOW, MemoryChunk::FromAddress(), MemoryChunk::IsEvacuationCandidate(), and MemoryChunk::slots_buffer_address().
Definition at line 4449 of file mark-compact.cc.
References ASSERT, MarkCompactCollector::heap(), Isolate::inner_pointer_to_code_cache(), MarkCompactCollector::is_compacting(), MarkCompactCollector::isolate(), Heap::MARK_COMPACT, and MarkCompactCollector::RecordRelocSlot().
void RecordRelocSlot | ( | RelocInfo * | rinfo, |
Object * | target | ||
) |
Definition at line 4399 of file mark-compact.cc.
References SlotsBuffer::AddTo(), SlotsBuffer::CODE_ENTRY_SLOT, SlotsBuffer::FAIL_ON_OVERFLOW, MemoryChunk::FromAddress(), MemoryChunk::IsEvacuationCandidate(), v8::internal::NULL, and MemoryChunk::slots_buffer_address().
Referenced by MarkCompactCollector::RecordCodeTargetPatch(), and IncrementalMarking::RecordWriteIntoCodeSlow().
intptr_t RefillFreeLists | ( | PagedSpace * | space | ) |
Definition at line 637 of file mark-compact.cc.
References PagedSpace::AddToAccountingStats(), FreeList::Concatenate(), PagedSpace::DecrementUnsweptFreeBytes(), PagedSpace::free_list(), and MarkCompactCollector::heap().
Referenced by PagedSpace::EnsureSweeperProgress(), and MarkCompactCollector::WaitUntilSweepingCompleted().
|
static |
Definition at line 4334 of file mark-compact.cc.
References HeapObject::address(), and PROFILE.
Referenced by LargeObjectSpace::FreeUnmarkedObjects().
|
inline |
Definition at line 737 of file mark-compact.h.
Referenced by PagedSpace::EnsureSweeperProgress(), and MarkCompactCollector::set_sequential_sweeping().
|
inline |
Definition at line 708 of file mark-compact.h.
Referenced by MarkCompactMarkingVisitor::VisitWeakCollection().
|
inline |
Definition at line 733 of file mark-compact.h.
References MarkCompactCollector::sequential_sweeping().
|
inline |
Definition at line 47 of file mark-compact-inl.h.
References Heap::kAbortIncrementalMarkingMask, Heap::kReduceMemoryFootprintMask, and Heap::kSweepPreciselyMask.
Referenced by Heap::CollectAllAvailableGarbage(), and Heap::CollectAllGarbage().
void SetUp | ( | ) |
Definition at line 355 of file mark-compact.cc.
References Heap::old_data_space(), and Heap::old_pointer_space().
Referenced by Heap::SetUp().
bool StartCompaction | ( | CompactionMode | mode | ) |
Definition at line 384 of file mark-compact.cc.
References ASSERT, Heap::code_space(), MarkCompactCollector::CollectEvacuationCandidates(), PagedSpace::EvictEvacuationCandidatesFromFreeLists(), MarkCompactCollector::heap(), MarkCompactCollector::NON_INCREMENTAL_COMPACTION, Heap::old_data_space(), and Heap::old_pointer_space().
Referenced by MarkCompactCollector::Prepare().
|
static |
Definition at line 3987 of file mark-compact.cc.
References MemoryChunk::area_end(), MemoryChunk::area_start(), ASSERT, ASSERT_EQ, CHECK, MemoryChunk::IsEvacuationCandidate(), MemoryChunk::LiveBytes(), Page::MarkSweptConservatively(), v8::internal::mode(), v8::internal::NULL, MemoryChunk::ResetLiveBytes(), v8::internal::size, MarkCompactCollector::SWEEP_IN_PARALLEL, MarkCompactCollector::SWEEP_SEQUENTIALLY, and Page::WasSwept().
void SweepInParallel | ( | PagedSpace * | space | ) |
Definition at line 4081 of file mark-compact.cc.
References FreeList::Concatenate(), MarkCompactCollector::heap(), Heap::old_pointer_space(), MemoryChunk::PARALLEL_SWEEPING_FINALIZE, MemoryChunk::set_parallel_sweeping(), and MemoryChunk::TryParallelSweeping().
Referenced by SweeperThread::Run().
void TearDown | ( | ) |
Definition at line 361 of file mark-compact.cc.
References MarkCompactCollector::AbortCompaction().
Referenced by Heap::TearDown().
|
inline |
Definition at line 599 of file mark-compact.h.
Referenced by MarkCompactCollector::Prepare(), and MarkCompactCollector::TryPromoteObject().
bool TryPromoteObject | ( | HeapObject * | object, |
int | object_size | ||
) |
Definition at line 3026 of file mark-compact.cc.
References PagedSpace::AllocateRaw(), ASSERT, HeapObject::cast(), CHECK, MarkCompactCollector::heap(), Space::identity(), Page::kMaxRegularHeapObjectSize, Heap::mark_compact_collector(), MarkCompactCollector::MigrateObject(), Heap::TargetSpace(), and MarkCompactCollector::tracer().
void WaitUntilSweepingCompleted | ( | ) |
Definition at line 618 of file mark-compact.cc.
References ASSERT, MarkCompactCollector::heap(), MarkCompactCollector::isolate(), Isolate::num_sweeper_threads(), v8::internal::OLD_DATA_SPACE, v8::internal::OLD_POINTER_SPACE, Heap::paged_space(), MarkCompactCollector::RefillFreeLists(), PagedSpace::ResetUnsweptFreeBytes(), Isolate::sweeper_threads(), and SweeperThread::WaitForSweeperThread().
Referenced by PagedSpace::EnsureSweeperProgress(), and MarkCompactCollector::Prepare().
|
friend |
Definition at line 826 of file mark-compact.h.
|
friend |
Definition at line 976 of file mark-compact.h.
|
friend |
Definition at line 825 of file mark-compact.h.
|
friend |
Definition at line 824 of file mark-compact.h.
|
friend |
Definition at line 823 of file mark-compact.h.
|
friend |
Definition at line 827 of file mark-compact.h.
|
static |
Definition at line 613 of file mark-compact.h.
|
static |
Definition at line 612 of file mark-compact.h.