V8 Project
v8::internal::SlotsBuffer Class Reference

#include <mark-compact.h>

+ Collaboration diagram for v8::internal::SlotsBuffer:

Public Types

enum  SlotType {
  EMBEDDED_OBJECT_SLOT , RELOCATED_CODE_OBJECT , CODE_TARGET_SLOT , CODE_ENTRY_SLOT ,
  DEBUG_TARGET_SLOT , JS_RETURN_SLOT , NUMBER_OF_SLOT_TYPES
}
 
enum  AdditionMode { FAIL_ON_OVERFLOW , IGNORE_OVERFLOW }
 
typedef Object ** ObjectSlot
 

Public Member Functions

 SlotsBuffer (SlotsBuffer *next_buffer)
 
 ~SlotsBuffer ()
 
void Add (ObjectSlot slot)
 
void UpdateSlots (Heap *heap)
 
void UpdateSlotsWithFilter (Heap *heap)
 
SlotsBuffernext ()
 
bool IsFull ()
 
bool HasSpaceForTypedSlot ()
 
 INLINE (static bool AddTo(SlotsBufferAllocator *allocator, SlotsBuffer **buffer_address, ObjectSlot slot, AdditionMode mode))
 

Static Public Member Functions

static const char * SlotTypeToString (SlotType type)
 
static int SizeOfChain (SlotsBuffer *buffer)
 
static void UpdateSlotsRecordedIn (Heap *heap, SlotsBuffer *buffer, bool code_slots_filtering_required)
 
static bool ChainLengthThresholdReached (SlotsBuffer *buffer)
 
static bool IsTypedSlot (ObjectSlot slot)
 
static bool AddTo (SlotsBufferAllocator *allocator, SlotsBuffer **buffer_address, SlotType type, Address addr, AdditionMode mode)
 

Static Public Attributes

static const int kNumberOfElements = 1021
 

Private Attributes

intptr_t idx_
 
intptr_t chain_length_
 
SlotsBuffernext_
 
ObjectSlot slots_ [kNumberOfElements]
 

Static Private Attributes

static const int kChainLengthThreshold = 15
 

Detailed Description

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

Member Typedef Documentation

◆ ObjectSlot

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

Member Enumeration Documentation

◆ AdditionMode

Enumerator
FAIL_ON_OVERFLOW 
IGNORE_OVERFLOW 

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

◆ SlotType

Enumerator
EMBEDDED_OBJECT_SLOT 
RELOCATED_CODE_OBJECT 
CODE_TARGET_SLOT 
CODE_ENTRY_SLOT 
DEBUG_TARGET_SLOT 
JS_RETURN_SLOT 
NUMBER_OF_SLOT_TYPES 

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

Constructor & Destructor Documentation

◆ SlotsBuffer()

v8::internal::SlotsBuffer::SlotsBuffer ( SlotsBuffer next_buffer)
inlineexplicit

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

255  : idx_(0), chain_length_(1), next_(next_buffer) {
256  if (next_ != NULL) {
258  }
259  }
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 chain_length_, next_, and NULL.

◆ ~SlotsBuffer()

v8::internal::SlotsBuffer::~SlotsBuffer ( )
inline

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

261 {}

Member Function Documentation

◆ Add()

void v8::internal::SlotsBuffer::Add ( ObjectSlot  slot)
inline

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

263  {
264  DCHECK(0 <= idx_ && idx_ < kNumberOfElements);
265  slots_[idx_++] = slot;
266  }
static const int kNumberOfElements
Definition: mark-compact.h:354
ObjectSlot slots_[kNumberOfElements]
Definition: mark-compact.h:362
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, idx_, kNumberOfElements, and slots_.

Referenced by AddTo(), and INLINE().

+ Here is the caller graph for this function:

◆ AddTo()

bool v8::internal::SlotsBuffer::AddTo ( SlotsBufferAllocator allocator,
SlotsBuffer **  buffer_address,
SlotType  type,
Address  addr,
AdditionMode  mode 
)
static

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

4405  {
4406  SlotsBuffer* buffer = *buffer_address;
4407  if (buffer == NULL || !buffer->HasSpaceForTypedSlot()) {
4409  allocator->DeallocateChain(buffer_address);
4410  return false;
4411  }
4412  buffer = allocator->AllocateBuffer(buffer);
4413  *buffer_address = buffer;
4414  }
4415  DCHECK(buffer->HasSpaceForTypedSlot());
4416  buffer->Add(reinterpret_cast<ObjectSlot>(type));
4417  buffer->Add(reinterpret_cast<ObjectSlot>(addr));
4418  return true;
4419 }
static bool ChainLengthThresholdReached(SlotsBuffer *buffer)
Definition: mark-compact.h:328
SlotsBuffer(SlotsBuffer *next_buffer)
Definition: mark-compact.h:254
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 Add(), v8::internal::SlotsBufferAllocator::AllocateBuffer(), ChainLengthThresholdReached(), DCHECK, v8::internal::SlotsBufferAllocator::DeallocateChain(), FAIL_ON_OVERFLOW, HasSpaceForTypedSlot(), mode(), and NULL.

Referenced by v8::internal::MarkCompactCollector::MigrateObject(), v8::internal::MarkCompactCollector::RecordCodeEntrySlot(), v8::internal::MarkCompactCollector::RecordMigratedSlot(), and v8::internal::MarkCompactCollector::RecordRelocSlot().

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

◆ ChainLengthThresholdReached()

static bool v8::internal::SlotsBuffer::ChainLengthThresholdReached ( SlotsBuffer buffer)
inlinestatic

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

328  {
329  return buffer != NULL && buffer->chain_length_ >= kChainLengthThreshold;
330  }
static const int kChainLengthThreshold
Definition: mark-compact.h:357

References chain_length_, kChainLengthThreshold, and NULL.

Referenced by AddTo(), and INLINE().

+ Here is the caller graph for this function:

◆ HasSpaceForTypedSlot()

bool v8::internal::SlotsBuffer::HasSpaceForTypedSlot ( )
inline

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

312 { return idx_ < kNumberOfElements - 1; }

References idx_, and kNumberOfElements.

Referenced by AddTo().

+ Here is the caller graph for this function:

◆ INLINE()

v8::internal::SlotsBuffer::INLINE ( static bool   AddToSlotsBufferAllocator *allocator, SlotsBuffer **buffer_address, ObjectSlot slot, AdditionMode mode)
inline

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

334  {
335  SlotsBuffer* buffer = *buffer_address;
336  if (buffer == NULL || buffer->IsFull()) {
338  allocator->DeallocateChain(buffer_address);
339  return false;
340  }
341  buffer = allocator->AllocateBuffer(buffer);
342  *buffer_address = buffer;
343  }
344  buffer->Add(slot);
345  return true;
346  }

References Add(), v8::internal::SlotsBufferAllocator::AllocateBuffer(), ChainLengthThresholdReached(), v8::internal::SlotsBufferAllocator::DeallocateChain(), FAIL_ON_OVERFLOW, IsFull(), mode(), and NULL.

+ Here is the call graph for this function:

◆ IsFull()

bool v8::internal::SlotsBuffer::IsFull ( )
inline

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

310 { return idx_ == kNumberOfElements; }

References idx_, and kNumberOfElements.

Referenced by INLINE().

+ Here is the caller graph for this function:

◆ IsTypedSlot()

bool v8::internal::SlotsBuffer::IsTypedSlot ( ObjectSlot  slot)
static

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

4398  {
4399  return reinterpret_cast<uintptr_t>(slot) < NUMBER_OF_SLOT_TYPES;
4400 }

References NUMBER_OF_SLOT_TYPES.

Referenced by UpdateSlots(), and UpdateSlotsWithFilter().

+ Here is the caller graph for this function:

◆ next()

SlotsBuffer* v8::internal::SlotsBuffer::next ( )
inline

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

302 { return next_; }

References next_.

Referenced by v8::internal::SlotsBufferAllocator::DeallocateChain(), and UpdateSlotsRecordedIn().

+ Here is the caller graph for this function:

◆ SizeOfChain()

static int v8::internal::SlotsBuffer::SizeOfChain ( SlotsBuffer buffer)
inlinestatic

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

304  {
305  if (buffer == NULL) return 0;
306  return static_cast<int>(buffer->idx_ +
307  (buffer->chain_length_ - 1) * kNumberOfElements);
308  }

References chain_length_, idx_, kNumberOfElements, and NULL.

Referenced by v8::internal::MarkCompactCollector::EvacuateNewSpaceAndCandidates().

+ Here is the caller graph for this function:

◆ SlotTypeToString()

static const char* v8::internal::SlotsBuffer::SlotTypeToString ( SlotType  type)
inlinestatic

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

278  {
279  switch (type) {
281  return "EMBEDDED_OBJECT_SLOT";
283  return "RELOCATED_CODE_OBJECT";
284  case CODE_TARGET_SLOT:
285  return "CODE_TARGET_SLOT";
286  case CODE_ENTRY_SLOT:
287  return "CODE_ENTRY_SLOT";
288  case DEBUG_TARGET_SLOT:
289  return "DEBUG_TARGET_SLOT";
290  case JS_RETURN_SLOT:
291  return "JS_RETURN_SLOT";
293  return "NUMBER_OF_SLOT_TYPES";
294  }
295  return "UNKNOWN SlotType";
296  }

References CODE_ENTRY_SLOT, CODE_TARGET_SLOT, DEBUG_TARGET_SLOT, EMBEDDED_OBJECT_SLOT, JS_RETURN_SLOT, NUMBER_OF_SLOT_TYPES, and RELOCATED_CODE_OBJECT.

◆ UpdateSlots()

void v8::internal::SlotsBuffer::UpdateSlots ( Heap heap)

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

4503  {
4504  PointersUpdatingVisitor v(heap);
4505 
4506  for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) {
4507  ObjectSlot slot = slots_[slot_idx];
4508  if (!IsTypedSlot(slot)) {
4510  } else {
4511  ++slot_idx;
4512  DCHECK(slot_idx < idx_);
4513  UpdateSlot(heap->isolate(), &v, DecodeSlotType(slot),
4514  reinterpret_cast<Address>(slots_[slot_idx]));
4515  }
4516  }
4517 }
static void UpdateSlot(Heap *heap, Object **slot)
static bool IsTypedSlot(ObjectSlot slot)
static SlotsBuffer::SlotType DecodeSlotType(SlotsBuffer::ObjectSlot slot)
static void UpdateSlot(Isolate *isolate, ObjectVisitor *v, SlotsBuffer::SlotType slot_type, Address addr)
byte * Address
Definition: globals.h:101

References DCHECK, v8::internal::DecodeSlotType(), idx_, v8::internal::Heap::isolate(), IsTypedSlot(), slots_, v8::internal::PointersUpdatingVisitor::UpdateSlot(), and v8::internal::UpdateSlot().

Referenced by UpdateSlotsRecordedIn().

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

◆ UpdateSlotsRecordedIn()

static void v8::internal::SlotsBuffer::UpdateSlotsRecordedIn ( Heap heap,
SlotsBuffer buffer,
bool  code_slots_filtering_required 
)
inlinestatic

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

315  {
316  while (buffer != NULL) {
317  if (code_slots_filtering_required) {
318  buffer->UpdateSlotsWithFilter(heap);
319  } else {
320  buffer->UpdateSlots(heap);
321  }
322  buffer = buffer->next();
323  }
324  }

References next(), NULL, UpdateSlots(), and UpdateSlotsWithFilter().

Referenced by v8::internal::MarkCompactCollector::EvacuateNewSpaceAndCandidates().

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

◆ UpdateSlotsWithFilter()

void v8::internal::SlotsBuffer::UpdateSlotsWithFilter ( Heap heap)

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

4520  {
4521  PointersUpdatingVisitor v(heap);
4522 
4523  for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) {
4524  ObjectSlot slot = slots_[slot_idx];
4525  if (!IsTypedSlot(slot)) {
4526  if (!IsOnInvalidatedCodeObject(reinterpret_cast<Address>(slot))) {
4528  }
4529  } else {
4530  ++slot_idx;
4531  DCHECK(slot_idx < idx_);
4532  Address pc = reinterpret_cast<Address>(slots_[slot_idx]);
4533  if (!IsOnInvalidatedCodeObject(pc)) {
4534  UpdateSlot(heap->isolate(), &v, DecodeSlotType(slot),
4535  reinterpret_cast<Address>(slots_[slot_idx]));
4536  }
4537  }
4538  }
4539 }
static bool IsOnInvalidatedCodeObject(Address addr)
const Register pc

References DCHECK, v8::internal::DecodeSlotType(), idx_, v8::internal::Heap::isolate(), v8::internal::IsOnInvalidatedCodeObject(), IsTypedSlot(), v8::internal::pc, slots_, v8::internal::PointersUpdatingVisitor::UpdateSlot(), and v8::internal::UpdateSlot().

Referenced by UpdateSlotsRecordedIn().

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

Member Data Documentation

◆ chain_length_

intptr_t v8::internal::SlotsBuffer::chain_length_
private

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

Referenced by ChainLengthThresholdReached(), SizeOfChain(), and SlotsBuffer().

◆ idx_

intptr_t v8::internal::SlotsBuffer::idx_
private

◆ kChainLengthThreshold

const int v8::internal::SlotsBuffer::kChainLengthThreshold = 15
staticprivate

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

Referenced by ChainLengthThresholdReached().

◆ kNumberOfElements

const int v8::internal::SlotsBuffer::kNumberOfElements = 1021
static

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

Referenced by Add(), HasSpaceForTypedSlot(), IsFull(), and SizeOfChain().

◆ next_

SlotsBuffer* v8::internal::SlotsBuffer::next_
private

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

Referenced by next(), and SlotsBuffer().

◆ slots_

ObjectSlot v8::internal::SlotsBuffer::slots_[kNumberOfElements]
private

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

Referenced by Add(), UpdateSlots(), and UpdateSlotsWithFilter().


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