V8 Project
v8::internal::FreeListNode Class Reference

#include <spaces.h>

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

Public Member Functions

void set_size (Heap *heap, int size_in_bytes)
 
FreeListNodenext ()
 
FreeListNode ** next_address ()
 
void set_next (FreeListNode *next)
 
void Zap ()
 
- Public Member Functions inherited from v8::internal::HeapObject
Mapmap () const
 
void set_map (Map *value)
 
void set_map_no_write_barrier (Map *value)
 
Mapsynchronized_map ()
 
MapWord synchronized_map_word () const
 
void synchronized_set_map (Map *value)
 
void synchronized_set_map_no_write_barrier (Map *value)
 
void synchronized_set_map_word (MapWord map_word)
 
MapWord map_word () const
 
void set_map_word (MapWord map_word)
 
HeapGetHeap () const
 
IsolateGetIsolate () const
 
Address address ()
 
void Iterate (ObjectVisitor *v)
 
void IterateBody (InstanceType type, int object_size, ObjectVisitor *v)
 
int Size ()
 
bool MayContainRawValues ()
 
int SizeFromMap (Map *map)
 
WriteBarrierMode GetWriteBarrierMode (const DisallowHeapAllocation &promise)
 
void HeapObjectShortPrint (OStream &os)
 
 STATIC_ASSERT (kMapOffset==Internals::kHeapObjectMapOffset)
 
- Public Member Functions inherited from v8::internal::Object
bool IsObject () const
 
 INLINE (bool IsFixedArrayBase() const)
 
 INLINE (bool IsExternal() const)
 
 INLINE (bool IsAccessorInfo() const)
 
 INLINE (bool IsStruct() const)
 
 INLINE (bool IsSpecObject()) const
 
 INLINE (bool IsSpecFunction()) const
 
 INLINE (bool IsTemplateInfo()) const
 
 INLINE (bool IsNameDictionary() const)
 
 INLINE (bool IsSeededNumberDictionary() const)
 
 INLINE (bool IsUnseededNumberDictionary() const)
 
 INLINE (bool IsOrderedHashSet() const)
 
 INLINE (bool IsOrderedHashMap() const)
 
bool IsCallable () const
 
 INLINE (bool IsUndefined() const)
 
 INLINE (bool IsNull() const)
 
 INLINE (bool IsTheHole() const)
 
 INLINE (bool IsException() const)
 
 INLINE (bool IsUninitialized() const)
 
 INLINE (bool IsTrue() const)
 
 INLINE (bool IsFalse() const)
 
 INLINE (bool IsArgumentsMarker() const)
 
 INLINE (bool IsFiller() const)
 
double Number ()
 
 INLINE (bool IsNaN() const)
 
 INLINE (bool IsMinusZero() const)
 
bool ToInt32 (int32_t *value)
 
bool ToUint32 (uint32_t *value)
 
Representation OptimalRepresentation ()
 
bool FitsRepresentation (Representation representation)
 
Handle< HeapTypeOptimalType (Isolate *isolate, Representation representation)
 
bool HasValidElements ()
 
bool HasSpecificClassOf (String *name)
 
bool BooleanValue ()
 
ObjectGetHash ()
 
bool SameValue (Object *other)
 
bool SameValueZero (Object *other)
 
bool ToArrayIndex (uint32_t *index)
 
bool IsStringObjectWithCharacterAt (uint32_t index)
 
void VerifyApiCallResultType ()
 
void ShortPrint (FILE *out=stdout)
 
void ShortPrint (StringStream *accumulator)
 

Static Public Member Functions

static FreeListNodeFromAddress (Address address)
 
static bool IsFreeListNode (HeapObject *object)
 
static FreeListNodecast (Object *object)
 
- Static Public Member Functions inherited from v8::internal::HeapObject
static HeapObjectFromAddress (Address address)
 
static Object ** RawField (HeapObject *obj, int offset)
 
static void UpdateMapCodeCache (Handle< HeapObject > object, Handle< Name > name, Handle< Code > code)
 
- Static Public Member Functions inherited from v8::internal::Object
static Handle< ObjectNewStorageFor (Isolate *isolate, Handle< Object > object, Representation representation)
 
static Handle< ObjectWrapForRead (Isolate *isolate, Handle< Object > object, Representation representation)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object, Handle< Context > context)
 
static MUST_USE_RESULT MaybeHandle< SmiToSmi (Isolate *isolate, Handle< Object > object)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (LookupIterator *it)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode, StorePropertyMode data_store_mode=NORMAL_PROPERTY)
 
static MUST_USE_RESULT MaybeHandle< ObjectWriteToReadOnlyProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
 
static Handle< ObjectSetDataProperty (LookupIterator *it, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectAddDataProperty (LookupIterator *it, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyOrElement (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Isolate *isolate, Handle< Object > object, const char *key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< JSObject > holder, Handle< Object > structure)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< Object > value, Handle< JSObject > holder, Handle< Object > structure, StrictMode strict_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithDefinedGetter (Handle< Object > receiver, Handle< JSReceiver > getter)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithDefinedSetter (Handle< Object > receiver, Handle< JSReceiver > setter, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElement (Isolate *isolate, Handle< Object > object, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElementWithReceiver (Isolate *isolate, Handle< Object > object, Handle< Object > receiver, uint32_t index)
 
static Handle< SmiGetOrCreateHash (Isolate *isolate, Handle< Object > object)
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (FreeListNode)
 

Static Private Attributes

static const int kNextOffset = POINTER_SIZE_ALIGN(FreeSpace::kHeaderSize)
 

Additional Inherited Members

- Public Types inherited from v8::internal::Object
enum  StoreFromKeyed { MAY_BE_STORE_FROM_KEYED , CERTAINLY_NOT_STORE_FROM_KEYED }
 
enum  StorePropertyMode { NORMAL_PROPERTY , SUPER_PROPERTY }
 
- Static Public Attributes inherited from v8::internal::HeapObject
static const int kMapOffset = Object::kHeaderSize
 
static const int kHeaderSize = kMapOffset + kPointerSize
 
- Static Public Attributes inherited from v8::internal::Object
static const int kHeaderSize = 0
 
- Protected Member Functions inherited from v8::internal::HeapObject
void IteratePointers (ObjectVisitor *v, int start, int end)
 
void IteratePointer (ObjectVisitor *v, int offset)
 
void IterateNextCodeLink (ObjectVisitor *v, int offset)
 

Detailed Description

Definition at line 1401 of file spaces.h.

Member Function Documentation

◆ cast()

static FreeListNode* v8::internal::FreeListNode::cast ( Object object)
inlinestatic

Definition at line 1425 of file spaces.h.

1425  {
1426  return reinterpret_cast<FreeListNode*>(object);
1427  }

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::FreeListNode::DISALLOW_IMPLICIT_CONSTRUCTORS ( FreeListNode  )
private

◆ FromAddress()

static FreeListNode* v8::internal::FreeListNode::FromAddress ( Address  address)
inlinestatic

Definition at line 1406 of file spaces.h.

1406  {
1407  return reinterpret_cast<FreeListNode*>(HeapObject::FromAddress(address));
1408  }
static HeapObject * FromAddress(Address address)
Definition: objects-inl.h:1464

References v8::internal::HeapObject::address(), and v8::internal::HeapObject::FromAddress().

Referenced by v8::internal::AllocationTracker::AllocationEvent(), and v8::internal::FreeList::Free().

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

◆ IsFreeListNode()

bool v8::internal::FreeListNode::IsFreeListNode ( HeapObject object)
inlinestatic

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

303  {
304  Map* map = object->map();
305  Heap* heap = object->GetHeap();
306  return map == heap->raw_unchecked_free_space_map() ||
307  map == heap->raw_unchecked_one_pointer_filler_map() ||
308  map == heap->raw_unchecked_two_pointer_filler_map();
309 }
Heap * GetHeap() const
Definition: objects-inl.h:1379

References v8::internal::HeapObject::map().

Referenced by v8::internal::AllocationTracker::AllocationEvent(), next(), next_address(), and set_next().

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

◆ next()

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

Definition at line 1986 of file spaces.cc.

1986  {
1987  DCHECK(IsFreeListNode(this));
1988  if (map() == GetHeap()->raw_unchecked_free_space_map()) {
1989  DCHECK(map() == NULL || Size() >= kNextOffset + kPointerSize);
1990  return reinterpret_cast<FreeListNode*>(
1992  } else {
1993  return reinterpret_cast<FreeListNode*>(
1995  }
1996 }
static bool IsFreeListNode(HeapObject *object)
Definition: spaces-inl.h:303
static const int kNextOffset
Definition: spaces.h:1430
static Address & Address_at(Address addr)
Definition: v8memory.h:56
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
#define DCHECK(condition)
Definition: logging.h:205
const int kPointerSize
Definition: globals.h:129

References v8::internal::HeapObject::address(), v8::internal::Memory::Address_at(), DCHECK, v8::internal::HeapObject::GetHeap(), IsFreeListNode(), kNextOffset, v8::internal::kPointerSize, v8::internal::HeapObject::map(), NULL, and v8::internal::HeapObject::Size().

Referenced by v8::internal::FreeListCategory::ContainsPageFreeListItemsInList(), v8::internal::FreeListCategory::EvictFreeListItemsInList(), v8::internal::FreeList::FindNodeFor(), v8::internal::FreeListCategory::PickNodeFromList(), v8::internal::FreeListCategory::RepairFreeList(), and set_next().

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

◆ next_address()

FreeListNode ** v8::internal::FreeListNode::next_address ( )
inline

Definition at line 1999 of file spaces.cc.

1999  {
2000  DCHECK(IsFreeListNode(this));
2001  if (map() == GetHeap()->raw_unchecked_free_space_map()) {
2003  return reinterpret_cast<FreeListNode**>(address() + kNextOffset);
2004  } else {
2005  return reinterpret_cast<FreeListNode**>(address() + kPointerSize);
2006  }
2007 }

References v8::internal::HeapObject::address(), DCHECK, v8::internal::HeapObject::GetHeap(), IsFreeListNode(), kNextOffset, v8::internal::kPointerSize, v8::internal::HeapObject::map(), and v8::internal::HeapObject::Size().

Referenced by v8::internal::FreeListCategory::EvictFreeListItemsInList().

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

◆ set_next()

void v8::internal::FreeListNode::set_next ( FreeListNode next)
inline

Definition at line 2010 of file spaces.cc.

2010  {
2011  DCHECK(IsFreeListNode(this));
2012  // While we are booting the VM the free space map will actually be null. So
2013  // we have to make sure that we don't try to use it for anything at that
2014  // stage.
2015  if (map() == GetHeap()->raw_unchecked_free_space_map()) {
2016  DCHECK(map() == NULL || Size() >= kNextOffset + kPointerSize);
2018  reinterpret_cast<base::AtomicWord*>(address() + kNextOffset),
2019  reinterpret_cast<base::AtomicWord>(next));
2020  } else {
2022  reinterpret_cast<base::AtomicWord*>(address() + kPointerSize),
2023  reinterpret_cast<base::AtomicWord>(next));
2024  }
2025 }
FreeListNode * next()
Definition: spaces.cc:1986
intptr_t AtomicWord
Definition: atomicops.h:57
void NoBarrier_Store(volatile Atomic8 *ptr, Atomic8 value)

References v8::internal::HeapObject::address(), DCHECK, v8::internal::HeapObject::GetHeap(), IsFreeListNode(), kNextOffset, v8::internal::kPointerSize, v8::internal::HeapObject::map(), next(), v8::base::NoBarrier_Store(), NULL, and v8::internal::HeapObject::Size().

Referenced by v8::internal::FreeListCategory::Concatenate(), and v8::internal::FreeListCategory::Free().

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

◆ set_size()

void v8::internal::FreeListNode::set_size ( Heap heap,
int  size_in_bytes 
)

Definition at line 1955 of file spaces.cc.

1955  {
1956  DCHECK(size_in_bytes > 0);
1957  DCHECK(IsAligned(size_in_bytes, kPointerSize));
1958 
1959  // We write a map and possibly size information to the block. If the block
1960  // is big enough to be a FreeSpace with at least one extra word (the next
1961  // pointer), we set its map to be the free space map and its size to an
1962  // appropriate array length for the desired size from HeapObject::Size().
1963  // If the block is too small (eg, one or two words), to hold both a size
1964  // field and a next pointer, we give it a filler map that gives it the
1965  // correct size.
1966  if (size_in_bytes > FreeSpace::kHeaderSize) {
1967  // Can't use FreeSpace::cast because it fails during deserialization.
1968  // We have to set the size first with a release store before we store
1969  // the map because a concurrent store buffer scan on scavenge must not
1970  // observe a map with an invalid size.
1971  FreeSpace* this_as_free_space = reinterpret_cast<FreeSpace*>(this);
1972  this_as_free_space->nobarrier_set_size(size_in_bytes);
1973  synchronized_set_map_no_write_barrier(heap->raw_unchecked_free_space_map());
1974  } else if (size_in_bytes == kPointerSize) {
1975  set_map_no_write_barrier(heap->raw_unchecked_one_pointer_filler_map());
1976  } else if (size_in_bytes == 2 * kPointerSize) {
1977  set_map_no_write_barrier(heap->raw_unchecked_two_pointer_filler_map());
1978  } else {
1979  UNREACHABLE();
1980  }
1981  // We would like to DCHECK(Size() == size_in_bytes) but this would fail during
1982  // deserialization because the free space map is not done yet.
1983 }
static const int kHeaderSize
Definition: objects.h:4423
void synchronized_set_map_no_write_barrier(Map *value)
Definition: objects-inl.h:1429
void set_map_no_write_barrier(Map *value)
Definition: objects-inl.h:1435
#define UNREACHABLE()
Definition: logging.h:30
bool IsAligned(T value, U alignment)
Definition: utils.h:123

References DCHECK, v8::internal::IsAligned(), v8::internal::FreeSpace::kHeaderSize, v8::internal::kPointerSize, v8::internal::FreeSpace::nobarrier_set_size(), v8::internal::HeapObject::set_map_no_write_barrier(), v8::internal::HeapObject::synchronized_set_map_no_write_barrier(), and UNREACHABLE.

Referenced by v8::internal::AllocationTracker::AllocationEvent(), v8::internal::FreeList::Free(), and v8::internal::Heap::ReserveSpace().

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

◆ Zap()

void v8::internal::FreeListNode::Zap ( )
inline

Member Data Documentation

◆ kNextOffset

const int v8::internal::FreeListNode::kNextOffset = POINTER_SIZE_ALIGN(FreeSpace::kHeaderSize)
staticprivate

Definition at line 1430 of file spaces.h.

Referenced by next(), next_address(), and set_next().


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