V8 Project
v8::internal::HeapObjectIterator Class Reference

#include <spaces.h>

+ Inheritance diagram for v8::internal::HeapObjectIterator:
+ Collaboration diagram for v8::internal::HeapObjectIterator:

Public Member Functions

 HeapObjectIterator (PagedSpace *space)
 
 HeapObjectIterator (PagedSpace *space, HeapObjectCallback size_func)
 
 HeapObjectIterator (Page *page, HeapObjectCallback size_func)
 
HeapObjectNext ()
 
virtual HeapObjectnext_object ()
 
- Public Member Functions inherited from v8::internal::ObjectIterator
virtual ~ObjectIterator ()
 
- Public Member Functions inherited from v8::internal::Malloced
void * operator new (size_t size)
 
void operator delete (void *p)
 

Private Types

enum  PageMode { kOnePageOnly , kAllPagesInSpace }
 

Private Member Functions

HeapObjectFromCurrentPage ()
 
bool AdvanceToNextPage ()
 
void Initialize (PagedSpace *owner, Address start, Address end, PageMode mode, HeapObjectCallback size_func)
 

Private Attributes

Address cur_addr_
 
Address cur_end_
 
HeapObjectCallback size_func_
 
PagedSpacespace_
 
PageMode page_mode_
 

Additional Inherited Members

- Static Public Member Functions inherited from v8::internal::Malloced
static void FatalProcessOutOfMemory ()
 
static void * New (size_t size)
 
static void Delete (void *p)
 

Detailed Description

Definition at line 1186 of file spaces.h.

Member Enumeration Documentation

◆ PageMode

Enumerator
kOnePageOnly 
kAllPagesInSpace 

Definition at line 1209 of file spaces.h.

Constructor & Destructor Documentation

◆ HeapObjectIterator() [1/3]

v8::internal::HeapObjectIterator::HeapObjectIterator ( PagedSpace space)
explicit

Definition at line 21 of file spaces.cc.

21  {
22  // You can't actually iterate over the anchor page. It is not a real page,
23  // just an anchor for the double linked page list. Initialize as if we have
24  // reached the end of the anchor page, then the first iteration will move on
25  // to the first page.
27 }
void Initialize(PagedSpace *owner, Address start, Address end, PageMode mode, HeapObjectCallback size_func)
Definition: spaces.cc:55
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi space(in MBytes)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References Initialize(), kAllPagesInSpace, NULL, and space().

+ Here is the call graph for this function:

◆ HeapObjectIterator() [2/3]

v8::internal::HeapObjectIterator::HeapObjectIterator ( PagedSpace space,
HeapObjectCallback  size_func 
)

Definition at line 30 of file spaces.cc.

31  {
32  // You can't actually iterate over the anchor page. It is not a real page,
33  // just an anchor for the double linked page list. Initialize the current
34  // address and end as NULL, then the first iteration will move on
35  // to the first page.
36  Initialize(space, NULL, NULL, kAllPagesInSpace, size_func);
37 }

References Initialize(), kAllPagesInSpace, NULL, and space().

+ Here is the call graph for this function:

◆ HeapObjectIterator() [3/3]

v8::internal::HeapObjectIterator::HeapObjectIterator ( Page page,
HeapObjectCallback  size_func 
)

Definition at line 40 of file spaces.cc.

41  {
42  Space* owner = page->owner();
43  DCHECK(owner == page->heap()->old_pointer_space() ||
44  owner == page->heap()->old_data_space() ||
45  owner == page->heap()->map_space() ||
46  owner == page->heap()->cell_space() ||
47  owner == page->heap()->property_cell_space() ||
48  owner == page->heap()->code_space());
49  Initialize(reinterpret_cast<PagedSpace*>(owner), page->area_start(),
50  page->area_end(), kOnePageOnly, size_func);
51  DCHECK(page->WasSwept() || page->SweepingCompleted());
52 }
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::MemoryChunk::area_end(), v8::internal::MemoryChunk::area_start(), v8::internal::Heap::cell_space(), v8::internal::Heap::code_space(), DCHECK, v8::internal::MemoryChunk::heap(), Initialize(), kOnePageOnly, v8::internal::Heap::map_space(), v8::internal::Heap::old_data_space(), v8::internal::Heap::old_pointer_space(), v8::internal::MemoryChunk::owner(), v8::internal::Heap::property_cell_space(), v8::internal::MemoryChunk::SweepingCompleted(), and v8::internal::Page::WasSwept().

+ Here is the call graph for this function:

Member Function Documentation

◆ AdvanceToNextPage()

bool v8::internal::HeapObjectIterator::AdvanceToNextPage ( )
private

Definition at line 68 of file spaces.cc.

68  {
70  if (page_mode_ == kOnePageOnly) return false;
71  Page* cur_page;
72  if (cur_addr_ == NULL) {
73  cur_page = space_->anchor();
74  } else {
75  cur_page = Page::FromAddress(cur_addr_ - 1);
76  DCHECK(cur_addr_ == cur_page->area_end());
77  }
78  cur_page = cur_page->next_page();
79  if (cur_page == space_->anchor()) return false;
80  cur_addr_ = cur_page->area_start();
81  cur_end_ = cur_page->area_end();
82  DCHECK(cur_page->WasSwept() || cur_page->SweepingCompleted());
83  return true;
84 }
static MemoryChunk * FromAddress(Address a)
Definition: spaces.h:276

References v8::internal::PagedSpace::anchor(), v8::internal::MemoryChunk::area_end(), v8::internal::MemoryChunk::area_start(), cur_addr_, cur_end_, DCHECK, v8::internal::MemoryChunk::FromAddress(), kOnePageOnly, v8::internal::Page::next_page(), NULL, page_mode_, space_, v8::internal::MemoryChunk::SweepingCompleted(), and v8::internal::Page::WasSwept().

Referenced by Next().

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

◆ FromCurrentPage()

HeapObject * v8::internal::HeapObjectIterator::FromCurrentPage ( )
inlineprivate

Definition at line 84 of file spaces-inl.h.

84  {
85  while (cur_addr_ != cur_end_) {
86  if (cur_addr_ == space_->top() && cur_addr_ != space_->limit()) {
87  cur_addr_ = space_->limit();
88  continue;
89  }
90  HeapObject* obj = HeapObject::FromAddress(cur_addr_);
91  int obj_size = (size_func_ == NULL) ? obj->Size() : size_func_(obj);
92  cur_addr_ += obj_size;
94  if (!obj->IsFiller()) {
95  DCHECK_OBJECT_SIZE(obj_size);
96  return obj;
97  }
98  }
99  return NULL;
100 }
HeapObjectCallback size_func_
Definition: spaces.h:1213
static HeapObject * FromAddress(Address address)
Definition: objects-inl.h:1464
#define DCHECK_OBJECT_SIZE(size)
Definition: spaces.h:84

References cur_addr_, cur_end_, DCHECK, DCHECK_OBJECT_SIZE, v8::internal::HeapObject::FromAddress(), v8::internal::PagedSpace::limit(), NULL, v8::internal::HeapObject::Size(), size_func_, space_, and v8::internal::PagedSpace::top().

Referenced by Next().

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

◆ Initialize()

void v8::internal::HeapObjectIterator::Initialize ( PagedSpace owner,
Address  start,
Address  end,
HeapObjectIterator::PageMode  mode,
HeapObjectCallback  size_func 
)
inlineprivate

Definition at line 55 of file spaces.cc.

57  {
58  space_ = space;
59  cur_addr_ = cur;
60  cur_end_ = end;
61  page_mode_ = mode;
62  size_func_ = size_f;
63 }
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp

References cur_addr_, cur_end_, mode(), page_mode_, size_func_, space(), and space_.

Referenced by HeapObjectIterator().

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

◆ Next()

HeapObject* v8::internal::HeapObjectIterator::Next ( )
inline

Definition at line 1198 of file spaces.h.

1198  {
1199  do {
1200  HeapObject* next_obj = FromCurrentPage();
1201  if (next_obj != NULL) return next_obj;
1202  } while (AdvanceToNextPage());
1203  return NULL;
1204  }

References AdvanceToNextPage(), FromCurrentPage(), and NULL.

Referenced by v8::internal::Heap::ClearAllICsByKind(), v8::internal::MarkCompactCollector::ClearNonLiveReferences(), v8::DumpHeapConstants(), v8::internal::MarkCompactCollector::EvacuateNewSpaceAndCandidates(), v8::internal::PagedSpace::FindObject(), v8::internal::StoreBuffer::IteratePointersToNewSpace(), v8::internal::MarkCompactCollector::MarkLiveObjects(), next_object(), and v8::internal::Heap::Scavenge().

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

◆ next_object()

virtual HeapObject* v8::internal::HeapObjectIterator::next_object ( )
inlinevirtual

Implements v8::internal::ObjectIterator.

Definition at line 1206 of file spaces.h.

1206 { return Next(); }

References Next().

+ Here is the call graph for this function:

Member Data Documentation

◆ cur_addr_

Address v8::internal::HeapObjectIterator::cur_addr_
private

Definition at line 1211 of file spaces.h.

Referenced by AdvanceToNextPage(), FromCurrentPage(), and Initialize().

◆ cur_end_

Address v8::internal::HeapObjectIterator::cur_end_
private

Definition at line 1212 of file spaces.h.

Referenced by AdvanceToNextPage(), FromCurrentPage(), and Initialize().

◆ page_mode_

PageMode v8::internal::HeapObjectIterator::page_mode_
private

Definition at line 1215 of file spaces.h.

Referenced by AdvanceToNextPage(), and Initialize().

◆ size_func_

HeapObjectCallback v8::internal::HeapObjectIterator::size_func_
private

Definition at line 1213 of file spaces.h.

Referenced by FromCurrentPage(), and Initialize().

◆ space_

PagedSpace* v8::internal::HeapObjectIterator::space_
private

Definition at line 1214 of file spaces.h.

Referenced by AdvanceToNextPage(), FromCurrentPage(), and Initialize().


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