V8 Project
v8::internal::Marking Class Reference

#include <mark-compact.h>

+ Collaboration diagram for v8::internal::Marking:

Public Member Functions

 Marking (Heap *heap)
 
 INLINE (static MarkBit MarkBitFrom(Address addr))
 
 INLINE (static MarkBit MarkBitFrom(HeapObject *obj))
 
 INLINE (static bool IsImpossible(MarkBit mark_bit))
 
 INLINE (static bool IsBlack(MarkBit mark_bit))
 
 INLINE (static bool IsWhite(MarkBit mark_bit))
 
 INLINE (static bool IsGrey(MarkBit mark_bit))
 
 INLINE (static void MarkBlack(MarkBit mark_bit))
 
 INLINE (static void BlackToGrey(MarkBit markbit))
 
 INLINE (static void WhiteToGrey(MarkBit markbit))
 
 INLINE (static void GreyToBlack(MarkBit markbit))
 
 INLINE (static void BlackToGrey(HeapObject *obj))
 
 INLINE (static void AnyToGrey(MarkBit markbit))
 
void TransferMark (Address old_start, Address new_start)
 
 INLINE (static bool TransferColor(HeapObject *from, HeapObject *to))
 

Static Public Attributes

static const char * kImpossibleBitPattern = "01"
 
static const char * kBlackBitPattern = "10"
 
static const char * kWhiteBitPattern = "00"
 
static const char * kGreyBitPattern = "11"
 

Private Attributes

Heapheap_
 

Detailed Description

Definition at line 26 of file mark-compact.h.

Constructor & Destructor Documentation

◆ Marking()

v8::internal::Marking::Marking ( Heap heap)
inlineexplicit

Definition at line 28 of file mark-compact.h.

28 : heap_(heap) {}

Member Function Documentation

◆ INLINE() [1/13]

v8::internal::Marking::INLINE ( static bool   IsBlackMarkBit mark_bit)
inline

Definition at line 44 of file mark-compact.h.

44  {
45  return mark_bit.Get() && !mark_bit.Next().Get();
46  }

References v8::internal::MarkBit::Get(), and v8::internal::MarkBit::Next().

+ Here is the call graph for this function:

◆ INLINE() [2/13]

v8::internal::Marking::INLINE ( static bool   IsGreyMarkBit mark_bit)
inline

Definition at line 54 of file mark-compact.h.

54  {
55  return mark_bit.Get() && mark_bit.Next().Get();
56  }

References v8::internal::MarkBit::Get(), and v8::internal::MarkBit::Next().

+ Here is the call graph for this function:

◆ INLINE() [3/13]

v8::internal::Marking::INLINE ( static bool   IsImpossibleMarkBit mark_bit)
inline

Definition at line 38 of file mark-compact.h.

38  {
39  return !mark_bit.Get() && mark_bit.Next().Get();
40  }

References v8::internal::MarkBit::Get(), and v8::internal::MarkBit::Next().

+ Here is the call graph for this function:

◆ INLINE() [4/13]

v8::internal::Marking::INLINE ( static bool   IsWhiteMarkBit mark_bit)
inline

Definition at line 50 of file mark-compact.h.

50 { return !mark_bit.Get(); }

References v8::internal::MarkBit::Get().

+ Here is the call graph for this function:

◆ INLINE() [5/13]

v8::internal::Marking::INLINE ( static bool   TransferColorHeapObject *from, HeapObject *to)
inline

Definition at line 119 of file mark-compact.h.

119  {
120  MarkBit from_mark_bit = MarkBitFrom(from);
121  MarkBit to_mark_bit = MarkBitFrom(to);
122  bool is_black = false;
123  if (from_mark_bit.Get()) {
124  to_mark_bit.Set();
125  is_black = true; // Looks black so far.
126  }
127  if (from_mark_bit.Next().Get()) {
128  to_mark_bit.Next().Set();
129  is_black = false; // Was actually gray.
130  }
131  return is_black;
132  }
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 the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file

References v8::internal::MarkBit::Get(), v8::internal::MarkBit::Next(), v8::internal::MarkBit::Set(), and to().

+ Here is the call graph for this function:

◆ INLINE() [6/13]

v8::internal::Marking::INLINE ( static MarkBit   MarkBitFromAddress addr)

◆ INLINE() [7/13]

v8::internal::Marking::INLINE ( static MarkBit   MarkBitFromHeapObject *obj)
inline

Definition at line 32 of file mark-compact.h.

32  {
33  return MarkBitFrom(reinterpret_cast<Address>(obj));
34  }
byte * Address
Definition: globals.h:101

◆ INLINE() [8/13]

v8::internal::Marking::INLINE ( static void   AnyToGreyMarkBit markbit)
inline

Definition at line 76 of file mark-compact.h.

76  {
77  markbit.Set();
78  markbit.Next().Set();
79  }

References v8::internal::MarkBit::Next(), and v8::internal::MarkBit::Set().

+ Here is the call graph for this function:

◆ INLINE() [9/13]

v8::internal::Marking::INLINE ( static void   BlackToGreyHeapObject *obj)
inline

Definition at line 72 of file mark-compact.h.

72  {
73  BlackToGrey(MarkBitFrom(obj));
74  }

◆ INLINE() [10/13]

v8::internal::Marking::INLINE ( static void   BlackToGreyMarkBit markbit)
inline

Definition at line 63 of file mark-compact.h.

63 { markbit.Next().Set(); }

References v8::internal::MarkBit::Next(), and v8::internal::MarkBit::Set().

+ Here is the call graph for this function:

◆ INLINE() [11/13]

v8::internal::Marking::INLINE ( static void   GreyToBlackMarkBit markbit)
inline

Definition at line 70 of file mark-compact.h.

70 { markbit.Next().Clear(); }

References v8::internal::MarkBit::Clear(), and v8::internal::MarkBit::Next().

+ Here is the call graph for this function:

◆ INLINE() [12/13]

v8::internal::Marking::INLINE ( static void   MarkBlackMarkBit mark_bit)
inline

Definition at line 58 of file mark-compact.h.

58  {
59  mark_bit.Set();
60  mark_bit.Next().Clear();
61  }

References v8::internal::MarkBit::Clear(), v8::internal::MarkBit::Next(), and v8::internal::MarkBit::Set().

+ Here is the call graph for this function:

◆ INLINE() [13/13]

v8::internal::Marking::INLINE ( static void   WhiteToGreyMarkBit markbit)
inline

Definition at line 65 of file mark-compact.h.

65  {
66  markbit.Set();
67  markbit.Next().Set();
68  }

References v8::internal::MarkBit::Next(), and v8::internal::MarkBit::Set().

+ Here is the call graph for this function:

◆ TransferMark()

void v8::internal::Marking::TransferMark ( Address  old_start,
Address  new_start 
)

Definition at line 651 of file mark-compact.cc.

651  {
652  // This is only used when resizing an object.
653  DCHECK(MemoryChunk::FromAddress(old_start) ==
654  MemoryChunk::FromAddress(new_start));
655 
656  if (!heap_->incremental_marking()->IsMarking()) return;
657 
658  // If the mark doesn't move, we don't check the color of the object.
659  // It doesn't matter whether the object is black, since it hasn't changed
660  // size, so the adjustment to the live data count will be zero anyway.
661  if (old_start == new_start) return;
662 
663  MarkBit new_mark_bit = MarkBitFrom(new_start);
664  MarkBit old_mark_bit = MarkBitFrom(old_start);
665 
666 #ifdef DEBUG
667  ObjectColor old_color = Color(old_mark_bit);
668 #endif
669 
670  if (Marking::IsBlack(old_mark_bit)) {
671  old_mark_bit.Clear();
672  DCHECK(IsWhite(old_mark_bit));
673  Marking::MarkBlack(new_mark_bit);
674  return;
675  } else if (Marking::IsGrey(old_mark_bit)) {
676  old_mark_bit.Clear();
677  old_mark_bit.Next().Clear();
678  DCHECK(IsWhite(old_mark_bit));
680  HeapObject::FromAddress(new_start), new_mark_bit);
682  }
683 
684 #ifdef DEBUG
685  ObjectColor new_color = Color(new_mark_bit);
686  DCHECK(new_color == old_color);
687 #endif
688 }
static HeapObject * FromAddress(Address address)
Definition: objects-inl.h:1464
IncrementalMarking * incremental_marking()
Definition: heap.h:1205
void WhiteToGreyAndPush(HeapObject *obj, MarkBit mark_bit)
static MemoryChunk * FromAddress(Address a)
Definition: spaces.h:276
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::MarkBit::Clear(), DCHECK, v8::internal::MemoryChunk::FromAddress(), v8::internal::HeapObject::FromAddress(), heap_, v8::internal::Heap::incremental_marking(), v8::internal::MarkBit::Next(), v8::internal::IncrementalMarking::RestartIfNotMarking(), and v8::internal::IncrementalMarking::WhiteToGreyAndPush().

Referenced by v8::internal::Heap::LeftTrimFixedArray().

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

Member Data Documentation

◆ heap_

Heap* v8::internal::Marking::heap_
private

Definition at line 135 of file mark-compact.h.

Referenced by TransferMark().

◆ kBlackBitPattern

const char * v8::internal::Marking::kBlackBitPattern = "10"
static

◆ kGreyBitPattern

const char * v8::internal::Marking::kGreyBitPattern = "11"
static

◆ kImpossibleBitPattern

const char * v8::internal::Marking::kImpossibleBitPattern = "01"
static

◆ kWhiteBitPattern

const char * v8::internal::Marking::kWhiteBitPattern = "00"
static

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