V8 Project
v8::internal::SpaceIterator Class Reference

#include <heap.h>

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

Public Member Functions

 SpaceIterator (Heap *heap)
 
 SpaceIterator (Heap *heap, HeapObjectCallback size_func)
 
virtual ~SpaceIterator ()
 
bool has_next ()
 
ObjectIteratornext ()
 
- Public Member Functions inherited from v8::internal::Malloced
void * operator new (size_t size)
 
void operator delete (void *p)
 

Private Member Functions

ObjectIteratorCreateIterator ()
 

Private Attributes

Heapheap_
 
int current_space_
 
ObjectIteratoriterator_
 
HeapObjectCallback size_func_
 

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 2172 of file heap.h.

Constructor & Destructor Documentation

◆ SpaceIterator() [1/2]

v8::internal::SpaceIterator::SpaceIterator ( Heap heap)
explicit

Definition at line 5459 of file heap.cc.

5460  : heap_(heap),
5462  iterator_(NULL),
5463  size_func_(NULL) {}
ObjectIterator * iterator_
Definition: heap.h:2186
HeapObjectCallback size_func_
Definition: heap.h:2187
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

◆ SpaceIterator() [2/2]

v8::internal::SpaceIterator::SpaceIterator ( Heap heap,
HeapObjectCallback  size_func 
)

Definition at line 5466 of file heap.cc.

5467  : heap_(heap),
5469  iterator_(NULL),
5470  size_func_(size_func) {}

◆ ~SpaceIterator()

v8::internal::SpaceIterator::~SpaceIterator ( )
virtual

Definition at line 5473 of file heap.cc.

5473  {
5474  // Delete active iterator if any.
5475  delete iterator_;
5476 }

References iterator_.

Member Function Documentation

◆ CreateIterator()

ObjectIterator * v8::internal::SpaceIterator::CreateIterator ( )
private

Definition at line 5502 of file heap.cc.

5502  {
5503  DCHECK(iterator_ == NULL);
5504 
5505  switch (current_space_) {
5506  case NEW_SPACE:
5507  iterator_ = new SemiSpaceIterator(heap_->new_space(), size_func_);
5508  break;
5509  case OLD_POINTER_SPACE:
5510  iterator_ =
5511  new HeapObjectIterator(heap_->old_pointer_space(), size_func_);
5512  break;
5513  case OLD_DATA_SPACE:
5514  iterator_ = new HeapObjectIterator(heap_->old_data_space(), size_func_);
5515  break;
5516  case CODE_SPACE:
5517  iterator_ = new HeapObjectIterator(heap_->code_space(), size_func_);
5518  break;
5519  case MAP_SPACE:
5520  iterator_ = new HeapObjectIterator(heap_->map_space(), size_func_);
5521  break;
5522  case CELL_SPACE:
5523  iterator_ = new HeapObjectIterator(heap_->cell_space(), size_func_);
5524  break;
5525  case PROPERTY_CELL_SPACE:
5526  iterator_ =
5527  new HeapObjectIterator(heap_->property_cell_space(), size_func_);
5528  break;
5529  case LO_SPACE:
5530  iterator_ = new LargeObjectIterator(heap_->lo_space(), size_func_);
5531  break;
5532  }
5533 
5534  // Return the newly allocated iterator;
5535  DCHECK(iterator_ != NULL);
5536  return iterator_;
5537 }
OldSpace * old_pointer_space()
Definition: heap.h:594
PropertyCellSpace * property_cell_space()
Definition: heap.h:599
OldSpace * code_space()
Definition: heap.h:596
LargeObjectSpace * lo_space()
Definition: heap.h:600
CellSpace * cell_space()
Definition: heap.h:598
OldSpace * old_data_space()
Definition: heap.h:595
NewSpace * new_space()
Definition: heap.h:593
MapSpace * map_space()
Definition: heap.h:597
#define DCHECK(condition)
Definition: logging.h:205
@ OLD_DATA_SPACE
Definition: globals.h:361
@ PROPERTY_CELL_SPACE
Definition: globals.h:365
@ OLD_POINTER_SPACE
Definition: globals.h:360

References v8::internal::CELL_SPACE, v8::internal::Heap::cell_space(), v8::internal::CODE_SPACE, v8::internal::Heap::code_space(), current_space_, DCHECK, heap_, iterator_, v8::internal::LO_SPACE, v8::internal::Heap::lo_space(), v8::internal::MAP_SPACE, v8::internal::Heap::map_space(), v8::internal::NEW_SPACE, v8::internal::Heap::new_space(), NULL, v8::internal::OLD_DATA_SPACE, v8::internal::Heap::old_data_space(), v8::internal::OLD_POINTER_SPACE, v8::internal::Heap::old_pointer_space(), v8::internal::PROPERTY_CELL_SPACE, v8::internal::Heap::property_cell_space(), and size_func_.

Referenced by next().

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

◆ has_next()

bool v8::internal::SpaceIterator::has_next ( )

Definition at line 5479 of file heap.cc.

5479  {
5480  // Iterate until no more spaces.
5481  return current_space_ != LAST_SPACE;
5482 }

References current_space_, and v8::internal::LAST_SPACE.

◆ next()

ObjectIterator * v8::internal::SpaceIterator::next ( )

Definition at line 5485 of file heap.cc.

5485  {
5486  if (iterator_ != NULL) {
5487  delete iterator_;
5488  iterator_ = NULL;
5489  // Move to the next space
5490  current_space_++;
5491  if (current_space_ > LAST_SPACE) {
5492  return NULL;
5493  }
5494  }
5495 
5496  // Return iterator for the new current space.
5497  return CreateIterator();
5498 }
ObjectIterator * CreateIterator()
Definition: heap.cc:5502

References CreateIterator(), current_space_, iterator_, v8::internal::LAST_SPACE, and NULL.

+ Here is the call graph for this function:

Member Data Documentation

◆ current_space_

int v8::internal::SpaceIterator::current_space_
private

Definition at line 2185 of file heap.h.

Referenced by CreateIterator(), has_next(), and next().

◆ heap_

Heap* v8::internal::SpaceIterator::heap_
private

Definition at line 2184 of file heap.h.

Referenced by CreateIterator().

◆ iterator_

ObjectIterator* v8::internal::SpaceIterator::iterator_
private

Definition at line 2186 of file heap.h.

Referenced by CreateIterator(), next(), and ~SpaceIterator().

◆ size_func_

HeapObjectCallback v8::internal::SpaceIterator::size_func_
private

Definition at line 2187 of file heap.h.

Referenced by CreateIterator().


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