v8
3.14.5(node0.10.28)
V8 is Google's open source JavaScript engine
|
#include <mark-compact.h>
Public Types | |
enum | CompactionMode { INCREMENTAL_COMPACTION, NON_INCREMENTAL_COMPACTION } |
enum | SweeperType { CONSERVATIVE, LAZY_CONSERVATIVE, PRECISE } |
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) |
Public Member Functions | |
void | SetFlags (int flags) |
void | CollectEvacuationCandidates (PagedSpace *space) |
void | AddEvacuationCandidate (Page *p) |
void | Prepare (GCTracer *tracer) |
void | CollectGarbage () |
bool | StartCompaction (CompactionMode mode) |
void | AbortCompaction () |
GCTracer * | tracer () |
Heap * | heap () const |
CodeFlusher * | code_flusher () |
bool | is_code_flushing_enabled () const |
void | EnableCodeFlushing (bool enable) |
INLINE (static bool ShouldSkipEvacuationSlotRecording(Object **anchor)) | |
INLINE (static bool ShouldSkipEvacuationSlotRecording(Object *host)) | |
INLINE (static bool IsOnEvacuationCandidate(Object *obj)) | |
void | EvictEvacuationCandidate (Page *page) |
void | RecordRelocSlot (RelocInfo *rinfo, Object *target) |
void | RecordCodeEntrySlot (Address slot, Code *target) |
void | RecordCodeTargetPatch (Address pc, Code *target) |
INLINE (void RecordSlot(Object **anchor_slot, Object **slot, Object *object)) | |
void | MigrateObject (Address dst, Address src, int size, AllocationSpace to_old_space) |
bool | TryPromoteObject (HeapObject *object, int object_size) |
Object * | encountered_weak_maps () |
void | set_encountered_weak_maps (Object *weak_map) |
void | InvalidateCode (Code *code) |
void | ClearMarkbits () |
bool | is_compacting () const |
Static Public Member Functions | |
static void | Initialize () |
static void | ReportDeleteIfNeeded (HeapObject *obj, Isolate *isolate) |
static bool | IsMarked (Object *obj) |
static intptr_t | SweepConservatively (PagedSpace *space, 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 486 of file mark-compact.h.
typedef MaybeObject*(* AllocationFunction)(Heap *heap, HeapObject *object, int object_size) |
Definition at line 493 of file mark-compact.h.
typedef void(* EncodingFunction)(Heap *heap, HeapObject *old_object, int object_size, Object *new_object, int *offset) |
Definition at line 505 of file mark-compact.h.
typedef int(MarkCompactCollector::* LiveObjectCallback)(HeapObject *obj) |
Definition at line 515 of file mark-compact.h.
typedef void(* ProcessNonLiveFunction)(HeapObject *object, Isolate *isolate) |
Definition at line 512 of file mark-compact.h.
enum CompactionMode |
Enumerator | |
---|---|
INCREMENTAL_COMPACTION | |
NON_INCREMENTAL_COMPACTION |
Definition at line 533 of file mark-compact.h.
enum SweeperType |
Enumerator | |
---|---|
CONSERVATIVE | |
LAZY_CONSERVATIVE | |
PRECISE |
Definition at line 568 of file mark-compact.h.
void AbortCompaction | ( | ) |
Definition at line 759 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().
void AddEvacuationCandidate | ( | Page * | p | ) |
Definition at line 322 of file mark-compact.cc.
References MemoryChunk::MarkEvacuationCandidate().
Referenced by MarkCompactCollector::CollectEvacuationCandidates().
void ClearMarkbits | ( | ) |
Definition at line 470 of file mark-compact.cc.
References Heap::cell_space(), MarkBit::Clear(), Heap::code_space(), MemoryChunk::FromAddress(), Heap::lo_space(), Heap::map_space(), Marking::MarkBitFrom(), Heap::new_space(), MarkBit::Next(), v8::internal::NULL, Heap::old_data_space(), and Heap::old_pointer_space().
Referenced by MarkCompactCollector::Prepare().
|
inline |
Definition at line 564 of file mark-compact.h.
Referenced by StaticMarkingVisitor< StaticVisitor >::VisitJSFunction(), and StaticMarkingVisitor< StaticVisitor >::VisitSharedFunctionInfo().
void CollectEvacuationCandidates | ( | PagedSpace * | space | ) |
Definition at line 606 of file mark-compact.cc.
References MarkCompactCollector::AddEvacuationCandidate(), v8::internal::AllocationSpaceName(), MemoryChunk::area_size(), PagedSpace::AreaSize(), ASSERT, MemoryChunk::ClearEvacuationCandidate(), v8::internal::CODE_SPACE, PagedSpace::CountFreeListItems(), PagedSpace::CountTotalPages(), Space::heap(), Space::identity(), v8::internal::kPageSizeBits, MemoryChunk::LiveBytes(), v8::internal::MB, v8::internal::Min(), Heap::ms_count(), v8::internal::NULL, v8::internal::OLD_DATA_SPACE, v8::internal::OLD_POINTER_SPACE, v8::internal::PrintF(), PagedSpace::SizeOfObjects(), and Page::WasSwept().
Referenced by MarkCompactCollector::StartCompaction().
void CollectGarbage | ( | ) |
Definition at line 376 of file mark-compact.cc.
References ASSERT, Smi::FromInt(), Heap::incremental_marking(), IncrementalMarking::IsStopped(), and v8::internal::NULL.
void EnableCodeFlushing | ( | bool | enable | ) |
Definition at line 3584 of file mark-compact.cc.
References MarkCompactCollector::heap(), and v8::internal::NULL.
|
inline |
Definition at line 633 of file mark-compact.h.
Referenced by MarkCompactMarkingVisitor::VisitJSWeakMap().
|
inline |
Definition at line 599 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().
Referenced by MarkCompactCollector::RecordCodeEntrySlot(), and MarkCompactCollector::RecordRelocSlot().
|
inline |
Definition at line 562 of file mark-compact.h.
Referenced by MarkCompactCollector::EnableCodeFlushing(), MarkCompactCollector::MigrateObject(), MarkCompactCollector::Prepare(), MarkCompactCollector::RecordCodeTargetPatch(), MarkCompactCollector::StartCompaction(), and MarkCompactCollector::TryPromoteObject().
|
static |
Definition at line 3612 of file mark-compact.cc.
References IncrementalMarking::Initialize(), and MarkCompactMarkingVisitor::Initialize().
|
inline |
Definition at line 584 of file mark-compact.h.
References MemoryChunk::FromAddress().
|
inline |
Definition at line 589 of file mark-compact.h.
References MemoryChunk::FromAddress().
|
inline |
Definition at line 594 of file mark-compact.h.
References MemoryChunk::FromAddress().
INLINE | ( | void | RecordSlotObject **anchor_slot, Object **slot, Object *object | ) |
void InvalidateCode | ( | Code * | code | ) |
Definition at line 2822 of file mark-compact.cc.
References ASSERT, Heap::incremental_marking(), IncrementalMarking::IsCompacting(), Marking::IsWhite(), and Marking::MarkBitFrom().
Referenced by Deoptimizer::DeoptimizeFunction().
|
inline |
Definition at line 565 of file mark-compact.h.
References v8::internal::NULL.
Referenced by StaticMarkingVisitor< StaticVisitor >::VisitJSFunction(), and StaticMarkingVisitor< StaticVisitor >::VisitSharedFunctionInfo().
|
inline |
Definition at line 642 of file mark-compact.h.
Referenced by Heap::ProcessWeakReferences(), and MarkCompactCollector::RecordCodeTargetPatch().
|
inlinestatic |
Definition at line 75 of file mark-compact-inl.h.
References ASSERT, HeapObject::cast(), MarkBit::Get(), and Marking::MarkBitFrom().
Referenced by MarkCompactMarkingVisitor::VisitJSWeakMap().
void MigrateObject | ( | Address | dst, |
Address | src, | ||
int | size, | ||
AllocationSpace | to_old_space | ||
) |
Definition at line 2244 of file mark-compact.cc.
References Memory::Address_at(), SlotsBuffer::AddTo(), ASSERT, Code::cast(), SlotsBuffer::CODE_ENTRY_SLOT, v8::internal::CODE_SPACE, MemoryChunk::FromAddress(), HeapObject::FromAddress(), MarkCompactCollector::heap(), HEAP_PROFILE, SlotsBuffer::IGNORE_OVERFLOW, Heap::InNewSpace(), v8::internal::IsAligned(), JSFunction::kCodeEntryOffset, v8::internal::kPointerSize, v8::internal::LO_SPACE, StoreBuffer::Mark(), Heap::MoveBlock(), v8::internal::NEW_SPACE, Memory::Object_at(), 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 776 of file mark-compact.cc.
References IncrementalMarking::Abort(), MarkCompactCollector::AbortCompaction(), ASSERT, MarkCompactCollector::ClearMarkbits(), MarkCompactCollector::heap(), Heap::incremental_marking(), MarkCompactCollector::NON_INCREMENTAL_COMPACTION, v8::internal::NULL, MarkCompactCollector::StartCompaction(), and MarkCompactCollector::tracer().
Definition at line 3675 of file mark-compact.cc.
References SlotsBuffer::AddTo(), SlotsBuffer::CODE_ENTRY_SLOT, MarkCompactCollector::EvictEvacuationCandidate(), SlotsBuffer::FAIL_ON_OVERFLOW, MemoryChunk::FromAddress(), MemoryChunk::IsEvacuationCandidate(), and MemoryChunk::slots_buffer_address().
Referenced by StaticMarkingVisitor< StaticVisitor >::VisitCodeEntry().
Definition at line 3690 of file mark-compact.cc.
References ASSERT, MarkCompactCollector::heap(), Isolate::inner_pointer_to_code_cache(), MarkCompactCollector::is_compacting(), Marking::IsBlack(), Heap::isolate(), Heap::MARK_COMPACT, Marking::MarkBitFrom(), and MarkCompactCollector::RecordRelocSlot().
void RecordRelocSlot | ( | RelocInfo * | rinfo, |
Object * | target | ||
) |
Definition at line 3659 of file mark-compact.cc.
References SlotsBuffer::AddTo(), MarkCompactCollector::EvictEvacuationCandidate(), SlotsBuffer::FAIL_ON_OVERFLOW, MemoryChunk::FromAddress(), MemoryChunk::IsEvacuationCandidate(), v8::internal::NULL, and MemoryChunk::slots_buffer_address().
Referenced by MarkCompactCollector::RecordCodeTargetPatch(), IncrementalMarking::RecordWriteIntoCodeSlow(), StaticMarkingVisitor< StaticVisitor >::VisitCodeTarget(), StaticMarkingVisitor< StaticVisitor >::VisitDebugTarget(), and StaticMarkingVisitor< StaticVisitor >::VisitEmbeddedPointer().
|
static |
Definition at line 3599 of file mark-compact.cc.
References HeapObject::address(), and PROFILE.
Referenced by LargeObjectSpace::FreeUnmarkedObjects().
|
inline |
Definition at line 634 of file mark-compact.h.
Referenced by MarkCompactMarkingVisitor::VisitJSWeakMap().
|
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().
bool StartCompaction | ( | CompactionMode | mode | ) |
Definition at line 340 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 3344 of file mark-compact.cc.
References MemoryChunk::AddressToMarkbitIndex(), MemoryChunk::area_end(), MemoryChunk::area_start(), ASSERT, ASSERT_EQ, PagedSpace::Free(), MemoryChunk::IsEvacuationCandidate(), v8::internal::kPointerSize, MemoryChunk::LiveBytes(), MemoryChunk::markbits(), Page::MarkSweptConservatively(), MemoryChunk::ResetLiveBytes(), and Page::WasSwept().
Referenced by PagedSpace::AdvanceSweeper().
|
inline |
Definition at line 544 of file mark-compact.h.
Referenced by MarkCompactCollector::Prepare(), and MarkCompactCollector::TryPromoteObject().
bool TryPromoteObject | ( | HeapObject * | object, |
int | object_size | ||
) |
Definition at line 2409 of file mark-compact.cc.
References HeapObject::address(), PagedSpace::AllocateRaw(), LargeObjectSpace::AllocateRaw(), ASSERT, HeapObject::cast(), MarkCompactCollector::heap(), Space::identity(), Page::kMaxNonCodeHeapObjectSize, v8::internal::LO_SPACE, Heap::lo_space(), Heap::mark_compact_collector(), MarkCompactCollector::MigrateObject(), v8::internal::NOT_EXECUTABLE, Heap::TargetSpace(), and MarkCompactCollector::tracer().
|
friend |
Definition at line 705 of file mark-compact.h.
|
friend |
Definition at line 833 of file mark-compact.h.
|
friend |
Definition at line 704 of file mark-compact.h.
|
friend |
Definition at line 703 of file mark-compact.h.
|
friend |
Definition at line 702 of file mark-compact.h.
|
friend |
Definition at line 706 of file mark-compact.h.
|
static |
Definition at line 558 of file mark-compact.h.
|
static |
Definition at line 557 of file mark-compact.h.