V8 Project
v8::internal::Bitmap Class Reference

#include <spaces.h>

+ Collaboration diagram for v8::internal::Bitmap:

Classes

class  CellPrinter
 

Public Member Functions

int CellsCount ()
 
 INLINE (static uint32_t IndexToCell(uint32_t index))
 
 INLINE (static uint32_t CellToIndex(uint32_t index))
 
 INLINE (static uint32_t CellAlignIndex(uint32_t index))
 
 INLINE (MarkBit::CellType *cells())
 
 INLINE (Address address())
 
 INLINE (static Bitmap *FromAddress(Address addr))
 
MarkBit MarkBitFromIndex (uint32_t index, bool data_only=false)
 
void Print ()
 
bool IsClean ()
 

Static Public Member Functions

static int CellsForLength (int length)
 
static int SizeFor (int cells_count)
 
static void Clear (MemoryChunk *chunk)
 
static void PrintWord (uint32_t word, uint32_t himask=0)
 

Static Public Attributes

static const uint32_t kBitsPerCell = 32
 
static const uint32_t kBitsPerCellLog2 = 5
 
static const uint32_t kBitIndexMask = kBitsPerCell - 1
 
static const uint32_t kBytesPerCell = kBitsPerCell / kBitsPerByte
 
static const uint32_t kBytesPerCellLog2 = kBitsPerCellLog2 - kBitsPerByteLog2
 
static const size_t kLength = (1 << kPageSizeBits) >> (kPointerSizeLog2)
 
static const size_t kSize
 

Detailed Description

Definition at line 144 of file spaces.h.

Member Function Documentation

◆ CellsCount()

int v8::internal::Bitmap::CellsCount ( )
inline

Definition at line 162 of file spaces.h.

162 { return CellsForLength(kLength); }
static const size_t kLength
Definition: spaces.h:152
static int CellsForLength(int length)
Definition: spaces.h:158

References CellsForLength(), and kLength.

Referenced by Clear(), IsClean(), and Print().

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

◆ CellsForLength()

static int v8::internal::Bitmap::CellsForLength ( int  length)
inlinestatic

Definition at line 158 of file spaces.h.

158  {
159  return (length + kBitsPerCell - 1) >> kBitsPerCellLog2;
160  }
static const uint32_t kBitsPerCellLog2
Definition: spaces.h:147
static const uint32_t kBitsPerCell
Definition: spaces.h:146

References kBitsPerCell, and kBitsPerCellLog2.

Referenced by CellsCount().

+ Here is the caller graph for this function:

◆ Clear()

void v8::internal::Bitmap::Clear ( MemoryChunk chunk)
inlinestatic

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

21  {
22  Bitmap* bitmap = chunk->markbits();
23  for (int i = 0; i < bitmap->CellsCount(); i++) bitmap->cells()[i] = 0;
24  chunk->ResetLiveBytes();
25 }

References CellsCount(), v8::internal::MemoryChunk::markbits(), and v8::internal::MemoryChunk::ResetLiveBytes().

Referenced by v8::internal::ClearMarkbitsInNewSpace(), v8::internal::ClearMarkbitsInPagedSpace(), v8::internal::SemiSpace::GrowTo(), v8::internal::MemoryChunk::Initialize(), v8::internal::IncrementalMarking::PrepareForScavenge(), and v8::internal::NewSpace::ResetAllocationInfo().

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

◆ INLINE() [1/6]

v8::internal::Bitmap::INLINE ( Address   address())
inline

Definition at line 184 of file spaces.h.

184 { return reinterpret_cast<Address>(this); }
byte * Address
Definition: globals.h:101

◆ INLINE() [2/6]

v8::internal::Bitmap::INLINE ( MarkBit::CellType cells())
inline

Definition at line 180 of file spaces.h.

180  {
181  return reinterpret_cast<MarkBit::CellType*>(this);
182  }
uint32_t CellType
Definition: spaces.h:103

◆ INLINE() [3/6]

v8::internal::Bitmap::INLINE ( static Bitmap FromAddressAddress addr)
inline

Definition at line 186 of file spaces.h.

186  {
187  return reinterpret_cast<Bitmap*>(addr);
188  }

◆ INLINE() [4/6]

v8::internal::Bitmap::INLINE ( static uint32_t   CellAlignIndexuint32_t index)
inline

Definition at line 176 of file spaces.h.

176  {
177  return (index + kBitIndexMask) & ~kBitIndexMask;
178  }
static const uint32_t kBitIndexMask
Definition: spaces.h:148

References kBitIndexMask.

◆ INLINE() [5/6]

v8::internal::Bitmap::INLINE ( static uint32_t   CellToIndexuint32_t index)
inline

Definition at line 172 of file spaces.h.

172  {
173  return index << kBitsPerCellLog2;
174  }

References kBitsPerCellLog2.

◆ INLINE() [6/6]

v8::internal::Bitmap::INLINE ( static uint32_t   IndexToCelluint32_t index)
inline

Definition at line 168 of file spaces.h.

168  {
169  return index >> kBitsPerCellLog2;
170  }

References kBitsPerCellLog2.

◆ IsClean()

bool v8::internal::Bitmap::IsClean ( )
inline

Definition at line 255 of file spaces.h.

255  {
256  for (int i = 0; i < CellsCount(); i++) {
257  if (cells()[i] != 0) {
258  return false;
259  }
260  }
261  return true;
262  }

References CellsCount().

+ Here is the call graph for this function:

◆ MarkBitFromIndex()

MarkBit v8::internal::Bitmap::MarkBitFromIndex ( uint32_t  index,
bool  data_only = false 
)
inline

Definition at line 190 of file spaces.h.

190  {
191  MarkBit::CellType mask = 1 << (index & kBitIndexMask);
192  MarkBit::CellType* cell = this->cells() + (index >> kBitsPerCellLog2);
193  return MarkBit(cell, mask, data_only);
194  }

References kBitIndexMask, and kBitsPerCellLog2.

Referenced by v8::internal::IsOnInvalidatedCodeObject(), and v8::internal::SetMarkBitsUnderInvalidatedCode().

+ Here is the caller graph for this function:

◆ Print()

void v8::internal::Bitmap::Print ( )
inline

Definition at line 246 of file spaces.h.

246  {
247  CellPrinter printer;
248  for (int i = 0; i < CellsCount(); i++) {
249  printer.Print(i, cells()[i]);
250  }
251  printer.Flush();
252  PrintF("\n");
253  }
void PrintF(const char *format,...)
Definition: utils.cc:80

References CellsCount(), v8::internal::Bitmap::CellPrinter::Flush(), v8::internal::Bitmap::CellPrinter::Print(), and v8::internal::PrintF().

Referenced by v8::internal::MemoryChunk::PrintMarkbits().

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

◆ PrintWord()

static void v8::internal::Bitmap::PrintWord ( uint32_t  word,
uint32_t  himask = 0 
)
inlinestatic

Definition at line 198 of file spaces.h.

198  {
199  for (uint32_t mask = 1; mask != 0; mask <<= 1) {
200  if ((mask & himask) != 0) PrintF("[");
201  PrintF((mask & word) ? "1" : "0");
202  if ((mask & himask) != 0) PrintF("]");
203  }
204  }

References v8::internal::PrintF().

Referenced by v8::internal::Bitmap::CellPrinter::Print().

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

◆ SizeFor()

static int v8::internal::Bitmap::SizeFor ( int  cells_count)
inlinestatic

Definition at line 164 of file spaces.h.

164  {
165  return sizeof(MarkBit::CellType) * cells_count;
166  }

Member Data Documentation

◆ kBitIndexMask

const uint32_t v8::internal::Bitmap::kBitIndexMask = kBitsPerCell - 1
static

Definition at line 148 of file spaces.h.

Referenced by INLINE(), and MarkBitFromIndex().

◆ kBitsPerCell

const uint32_t v8::internal::Bitmap::kBitsPerCell = 32
static

◆ kBitsPerCellLog2

const uint32_t v8::internal::Bitmap::kBitsPerCellLog2 = 5
static

Definition at line 147 of file spaces.h.

Referenced by CellsForLength(), INLINE(), and MarkBitFromIndex().

◆ kBytesPerCell

const uint32_t v8::internal::Bitmap::kBytesPerCell = kBitsPerCell / kBitsPerByte
static

Definition at line 149 of file spaces.h.

◆ kBytesPerCellLog2

const uint32_t v8::internal::Bitmap::kBytesPerCellLog2 = kBitsPerCellLog2 - kBitsPerByteLog2
static

Definition at line 150 of file spaces.h.

◆ kLength

const size_t v8::internal::Bitmap::kLength = (1 << kPageSizeBits) >> (kPointerSizeLog2)
static

Definition at line 152 of file spaces.h.

Referenced by CellsCount().

◆ kSize

const size_t v8::internal::Bitmap::kSize
static
Initial value:
=
const int kPageSizeBits
Definition: build_config.h:159
const int kPointerSizeLog2
Definition: globals.h:147
const int kBitsPerByteLog2
Definition: globals.h:163

Definition at line 154 of file spaces.h.


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