V8 Project
v8::internal::EternalHandles Class Reference

#include <global-handles.h>

+ Collaboration diagram for v8::internal::EternalHandles:

Public Types

enum  SingletonHandle { I18N_TEMPLATE_ONE , I18N_TEMPLATE_TWO , DATE_CACHE_VERSION , NUMBER_OF_SINGLETON_HANDLES }
 

Public Member Functions

 EternalHandles ()
 
 ~EternalHandles ()
 
int NumberOfHandles ()
 
void Create (Isolate *isolate, Object *object, int *index)
 
Handle< ObjectGet (int index)
 
Handle< ObjectGetSingleton (SingletonHandle singleton)
 
bool Exists (SingletonHandle singleton)
 
Handle< ObjectCreateSingleton (Isolate *isolate, Object *object, SingletonHandle singleton)
 
void IterateAllRoots (ObjectVisitor *visitor)
 
void IterateNewSpaceRoots (ObjectVisitor *visitor)
 
void PostGarbageCollectionProcessing (Heap *heap)
 

Private Member Functions

Object ** GetLocation (int index)
 
 DISALLOW_COPY_AND_ASSIGN (EternalHandles)
 

Private Attributes

int size_
 
List< Object ** > blocks_
 
List< intnew_space_indices_
 
int singleton_handles_ [NUMBER_OF_SINGLETON_HANDLES]
 

Static Private Attributes

static const int kInvalidIndex = -1
 
static const int kShift = 8
 
static const int kSize = 1 << kShift
 
static const int kMask = 0xff
 

Detailed Description

Definition at line 306 of file global-handles.h.

Member Enumeration Documentation

◆ SingletonHandle

Enumerator
I18N_TEMPLATE_ONE 
I18N_TEMPLATE_TWO 
DATE_CACHE_VERSION 
NUMBER_OF_SINGLETON_HANDLES 

Definition at line 308 of file global-handles.h.

Constructor & Destructor Documentation

◆ EternalHandles()

v8::internal::EternalHandles::EternalHandles ( )

Definition at line 992 of file global-handles.cc.

992  : size_(0) {
993  for (unsigned i = 0; i < arraysize(singleton_handles_); i++) {
995  }
996 }
static const int kInvalidIndex
int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]
#define arraysize(array)
Definition: macros.h:86

References arraysize, kInvalidIndex, and singleton_handles_.

◆ ~EternalHandles()

v8::internal::EternalHandles::~EternalHandles ( )

Definition at line 999 of file global-handles.cc.

999  {
1000  for (int i = 0; i < blocks_.length(); i++) delete[] blocks_[i];
1001 }

References blocks_.

Member Function Documentation

◆ Create()

void v8::internal::EternalHandles::Create ( Isolate isolate,
Object object,
int index 
)

Definition at line 1034 of file global-handles.cc.

1034  {
1035  DCHECK_EQ(kInvalidIndex, *index);
1036  if (object == NULL) return;
1037  DCHECK_NE(isolate->heap()->the_hole_value(), object);
1038  int block = size_ >> kShift;
1039  int offset = size_ & kMask;
1040  // need to resize
1041  if (offset == 0) {
1042  Object** next_block = new Object*[kSize];
1043  Object* the_hole = isolate->heap()->the_hole_value();
1044  MemsetPointer(next_block, the_hole, kSize);
1045  blocks_.Add(next_block);
1046  }
1047  DCHECK_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]);
1048  blocks_[block][offset] = object;
1049  if (isolate->heap()->InNewSpace(object)) {
1051  }
1052  *index = size_++;
1053 }
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
Definition: list-inl.h:17
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_NE(v1, v2)
Definition: logging.h:207
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
void MemsetPointer(T **dest, U *value, int counter)
Definition: utils.h:1183
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References v8::internal::List< T, AllocationPolicy >::Add(), blocks_, DCHECK_EQ, DCHECK_NE, v8::internal::Isolate::heap(), v8::internal::Heap::InNewSpace(), kInvalidIndex, kMask, kShift, kSize, v8::internal::MemsetPointer(), new_space_indices_, NULL, and size_.

Referenced by CreateSingleton(), and v8::V8::Eternalize().

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

◆ CreateSingleton()

Handle<Object> v8::internal::EternalHandles::CreateSingleton ( Isolate isolate,
Object object,
SingletonHandle  singleton 
)
inline

Definition at line 341 of file global-handles.h.

343  {
344  Create(isolate, object, &singleton_handles_[singleton]);
345  return Get(singleton_handles_[singleton]);
346  }
Handle< Object > Get(int index)
void Create(Isolate *isolate, Object *object, int *index)

References Create(), Get(), and singleton_handles_.

Referenced by v8::internal::anonymous_namespace{i18n.cc}::GetEternal().

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

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::EternalHandles::DISALLOW_COPY_AND_ASSIGN ( EternalHandles  )
private

◆ Exists()

bool v8::internal::EternalHandles::Exists ( SingletonHandle  singleton)
inline

Definition at line 336 of file global-handles.h.

336  {
337  return singleton_handles_[singleton] != kInvalidIndex;
338  }

References kInvalidIndex, and singleton_handles_.

Referenced by v8::Date::DateTimeConfigurationChangeNotification(), v8::internal::anonymous_namespace{i18n.cc}::GetEternal(), and GetSingleton().

+ Here is the caller graph for this function:

◆ Get()

Handle<Object> v8::internal::EternalHandles::Get ( int  index)
inline

Definition at line 325 of file global-handles.h.

325  {
326  return Handle<Object>(GetLocation(index));
327  }
Object ** GetLocation(int index)

References GetLocation().

Referenced by CreateSingleton(), v8::V8::GetEternal(), and GetSingleton().

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

◆ GetLocation()

Object** v8::internal::EternalHandles::GetLocation ( int  index)
inlineprivate

Definition at line 362 of file global-handles.h.

362  {
363  DCHECK(index >= 0 && index < size_);
364  return &blocks_[index >> kShift][index & kMask];
365  }
#define DCHECK(condition)
Definition: logging.h:205

References blocks_, DCHECK, kMask, kShift, and size_.

Referenced by Get(), IterateNewSpaceRoots(), and PostGarbageCollectionProcessing().

+ Here is the caller graph for this function:

◆ GetSingleton()

Handle<Object> v8::internal::EternalHandles::GetSingleton ( SingletonHandle  singleton)
inline

Definition at line 330 of file global-handles.h.

330  {
331  DCHECK(Exists(singleton));
332  return Get(singleton_handles_[singleton]);
333  }
bool Exists(SingletonHandle singleton)

References DCHECK, Exists(), Get(), and singleton_handles_.

Referenced by v8::Date::DateTimeConfigurationChangeNotification(), and v8::internal::anonymous_namespace{i18n.cc}::GetEternal().

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

◆ IterateAllRoots()

void v8::internal::EternalHandles::IterateAllRoots ( ObjectVisitor visitor)

Definition at line 1004 of file global-handles.cc.

1004  {
1005  int limit = size_;
1006  for (int i = 0; i < blocks_.length(); i++) {
1007  DCHECK(limit > 0);
1008  Object** block = blocks_[i];
1009  visitor->VisitPointers(block, block + Min(limit, kSize));
1010  limit -= kSize;
1011  }
1012 }
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)

References blocks_, DCHECK, kSize, v8::internal::Min(), and size_.

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

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

◆ IterateNewSpaceRoots()

void v8::internal::EternalHandles::IterateNewSpaceRoots ( ObjectVisitor visitor)

Definition at line 1015 of file global-handles.cc.

1015  {
1016  for (int i = 0; i < new_space_indices_.length(); i++) {
1017  visitor->VisitPointer(GetLocation(new_space_indices_[i]));
1018  }
1019 }

References GetLocation(), and new_space_indices_.

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

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

◆ NumberOfHandles()

int v8::internal::EternalHandles::NumberOfHandles ( )
inline

Definition at line 319 of file global-handles.h.

319 { return size_; }

References size_.

Referenced by v8::internal::StartupSerializer::SerializeStrongReferences().

+ Here is the caller graph for this function:

◆ PostGarbageCollectionProcessing()

void v8::internal::EternalHandles::PostGarbageCollectionProcessing ( Heap heap)

Definition at line 1022 of file global-handles.cc.

1022  {
1023  int last = 0;
1024  for (int i = 0; i < new_space_indices_.length(); i++) {
1025  int index = new_space_indices_[i];
1026  if (heap->InNewSpace(*GetLocation(index))) {
1027  new_space_indices_[last++] = index;
1028  }
1029  }
1030  new_space_indices_.Rewind(last);
1031 }

References GetLocation(), v8::internal::Heap::InNewSpace(), and new_space_indices_.

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

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

Member Data Documentation

◆ blocks_

List<Object**> v8::internal::EternalHandles::blocks_
private

Definition at line 368 of file global-handles.h.

Referenced by Create(), GetLocation(), IterateAllRoots(), and ~EternalHandles().

◆ kInvalidIndex

const int v8::internal::EternalHandles::kInvalidIndex = -1
staticprivate

Definition at line 356 of file global-handles.h.

Referenced by Create(), EternalHandles(), and Exists().

◆ kMask

const int v8::internal::EternalHandles::kMask = 0xff
staticprivate

Definition at line 359 of file global-handles.h.

Referenced by Create(), and GetLocation().

◆ kShift

const int v8::internal::EternalHandles::kShift = 8
staticprivate

Definition at line 357 of file global-handles.h.

Referenced by Create(), and GetLocation().

◆ kSize

const int v8::internal::EternalHandles::kSize = 1 << kShift
staticprivate

Definition at line 358 of file global-handles.h.

Referenced by Create(), and IterateAllRoots().

◆ new_space_indices_

List<int> v8::internal::EternalHandles::new_space_indices_
private

Definition at line 369 of file global-handles.h.

Referenced by Create(), IterateNewSpaceRoots(), and PostGarbageCollectionProcessing().

◆ singleton_handles_

int v8::internal::EternalHandles::singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]
private

Definition at line 370 of file global-handles.h.

Referenced by CreateSingleton(), EternalHandles(), Exists(), and GetSingleton().

◆ size_

int v8::internal::EternalHandles::size_
private

Definition at line 367 of file global-handles.h.

Referenced by Create(), GetLocation(), IterateAllRoots(), and NumberOfHandles().


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