V8 Project
heap.cc File Reference
+ Include dependency graph for heap.cc:

Go to the source code of this file.

Classes

class  v8::internal::ScavengeVisitor
 
class  v8::internal::ScavengeWeakObjectRetainer
 
class  v8::internal::NewSpaceScavenger
 
class  v8::internal::ScavengingVisitor< marks_handling, logging_and_profiling_mode >
 
class  v8::internal::ScavengingVisitor< marks_handling, logging_and_profiling_mode >::ObjectEvacuationStrategy< object_contents >
 
class  v8::internal::HeapObjectsFilter
 
class  v8::internal::UnreachableObjectsFilter
 
class  v8::internal::UnreachableObjectsFilter::MarkingVisitor
 

Namespaces

 v8
 Debugger support for the V8 JavaScript engine.
 
 v8::internal
 

Macros

#define UPDATE_COUNTERS_FOR_SPACE(space)
 
#define UPDATE_FRAGMENTATION_FOR_SPACE(space)
 
#define UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(space)
 
#define STRING_TYPE_ELEMENT(type, size, name, camel_name)
 
#define CONSTANT_STRING_ELEMENT(name, contents)
 
#define STRUCT_TABLE_ELEMENT(NAME, Name, name)
 
#define ALLOCATE_PARTIAL_MAP(instance_type, size, field_name)
 
#define ALLOCATE_MAP(instance_type, size, field_name)
 
#define ALLOCATE_VARSIZE_MAP(instance_type, field_name)    ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name)
 
#define ALLOCATE_EXTERNAL_ARRAY_MAP(Type, type, TYPE, ctype, size)
 
#define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size)    ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array)
 
#define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size)
 
#define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size)
 
#define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size)
 
#define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size)
 
#define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size)
 
#define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size)
 
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size)
 
#define MAKE_CASE(NAME, Name, name)
 
#define ADJUST_LAST_TIME_OBJECT_COUNT(name)
 
#define ADJUST_LAST_TIME_OBJECT_COUNT(name)
 
#define ADJUST_LAST_TIME_OBJECT_COUNT(name)
 
#define ADJUST_LAST_TIME_OBJECT_COUNT(name)
 

Enumerations

enum  v8::internal::LoggingAndProfiling { v8::internal::LOGGING_AND_PROFILING_ENABLED , v8::internal::LOGGING_AND_PROFILING_DISABLED }
 
enum  v8::internal::MarksHandling { v8::internal::TRANSFER_MARKS , v8::internal::IGNORE_MARKS }
 

Functions

static bool v8::internal::AbortIncrementalMarkingAndCollectGarbage (Heap *heap, AllocationSpace space, const char *gc_reason=NULL)
 
static bool v8::internal::IsUnscavengedHeapObject (Heap *heap, Object **p)
 
 v8::internal::STATIC_ASSERT ((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
 
 v8::internal::STATIC_ASSERT ((ConstantPoolArray::kFirstEntryOffset &kDoubleAlignmentMask)==0)
 
 v8::internal::STATIC_ASSERT ((ConstantPoolArray::kExtendedFirstOffset &kDoubleAlignmentMask)==0)
 
 v8::internal::INLINE (static HeapObject *EnsureDoubleAligned(Heap *heap, HeapObject *object, int size))
 
static HeapObject * v8::internal::EnsureDoubleAligned (Heap *heap, HeapObject *object, int size)
 
static void v8::internal::InitializeScavengingVisitorsTables ()
 
template void v8::internal::Heap::RightTrimFixedArray< Heap::FROM_GC > (FixedArrayBase *, int)
 
template void v8::internal::Heap::RightTrimFixedArray< Heap::FROM_MUTATOR > (FixedArrayBase *, int)
 
static void v8::internal::ForFixedTypedArray (ExternalArrayType array_type, int *element_size, ElementsKind *element_kind)
 
static void v8::internal::WriteOneByteData (Vector< const char > vector, uint8_t *chars, int len)
 
static void v8::internal::WriteTwoByteData (Vector< const char > vector, uint16_t *chars, int len)
 
static void v8::internal::WriteOneByteData (String *s, uint8_t *chars, int len)
 
static void v8::internal::WriteTwoByteData (String *s, uint16_t *chars, int len)
 
 v8::internal::V8_DECLARE_ONCE (initialize_gc_once)
 
static void v8::internal::InitializeGCOnce ()
 

Variables

static base::LazyMutex v8::internal::checkpoint_object_stats_mutex = LAZY_MUTEX_INITIALIZER
 

Macro Definition Documentation

◆ ADJUST_LAST_TIME_OBJECT_COUNT [1/4]

#define ADJUST_LAST_TIME_OBJECT_COUNT (   name)
Value:
counters->count_of_##name()->Increment( \
static_cast<int>(object_counts_[name])); \
counters->count_of_##name()->Decrement( \
static_cast<int>(object_counts_last_time_[name])); \
counters->size_of_##name()->Increment( \
static_cast<int>(object_sizes_[name])); \
counters->size_of_##name()->Decrement( \
static_cast<int>(object_sizes_last_time_[name]));
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 name

◆ ADJUST_LAST_TIME_OBJECT_COUNT [2/4]

#define ADJUST_LAST_TIME_OBJECT_COUNT (   name)
Value:
index = FIRST_CODE_KIND_SUB_TYPE + Code::name; \
counters->count_of_CODE_TYPE_##name()->Increment( \
static_cast<int>(object_counts_[index])); \
counters->count_of_CODE_TYPE_##name()->Decrement( \
static_cast<int>(object_counts_last_time_[index])); \
counters->size_of_CODE_TYPE_##name()->Increment( \
static_cast<int>(object_sizes_[index])); \
counters->size_of_CODE_TYPE_##name()->Decrement( \
static_cast<int>(object_sizes_last_time_[index]));

◆ ADJUST_LAST_TIME_OBJECT_COUNT [3/4]

#define ADJUST_LAST_TIME_OBJECT_COUNT (   name)
Value:
index = FIRST_FIXED_ARRAY_SUB_TYPE + name; \
counters->count_of_FIXED_ARRAY_##name()->Increment( \
static_cast<int>(object_counts_[index])); \
counters->count_of_FIXED_ARRAY_##name()->Decrement( \
static_cast<int>(object_counts_last_time_[index])); \
counters->size_of_FIXED_ARRAY_##name()->Increment( \
static_cast<int>(object_sizes_[index])); \
counters->size_of_FIXED_ARRAY_##name()->Decrement( \
static_cast<int>(object_sizes_last_time_[index]));

◆ ADJUST_LAST_TIME_OBJECT_COUNT [4/4]

#define ADJUST_LAST_TIME_OBJECT_COUNT (   name)
Value:
index = \
FIRST_CODE_AGE_SUB_TYPE + Code::k##name##CodeAge - Code::kFirstCodeAge; \
counters->count_of_CODE_AGE_##name()->Increment( \
static_cast<int>(object_counts_[index])); \
counters->count_of_CODE_AGE_##name()->Decrement( \
static_cast<int>(object_counts_last_time_[index])); \
counters->size_of_CODE_AGE_##name()->Increment( \
static_cast<int>(object_sizes_[index])); \
counters->size_of_CODE_AGE_##name()->Decrement( \
static_cast<int>(object_sizes_last_time_[index]));

◆ ALLOCATE_EMPTY_EXTERNAL_ARRAY

#define ALLOCATE_EMPTY_EXTERNAL_ARRAY (   Type,
  type,
  TYPE,
  ctype,
  size 
)
Value:
{ \
ExternalArray* obj; \
if (!AllocateEmptyExternalArray(kExternal##Type##Array).To(&obj)) \
return false; \
set_empty_external_##type##_array(obj); \
}
TypeImpl< ZoneTypeConfig > Type

◆ ALLOCATE_EMPTY_FIXED_TYPED_ARRAY

#define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY (   Type,
  type,
  TYPE,
  ctype,
  size 
)
Value:
{ \
FixedTypedArrayBase* obj; \
if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \
return false; \
set_empty_fixed_##type##_array(obj); \
}

◆ ALLOCATE_EXTERNAL_ARRAY_MAP

#define ALLOCATE_EXTERNAL_ARRAY_MAP (   Type,
  type,
  TYPE,
  ctype,
  size 
)
Value:
ALLOCATE_MAP(EXTERNAL_##TYPE##_ARRAY_TYPE, ExternalArray::kAlignedSize, \
external_##type##_array)
#define ALLOCATE_MAP(instance_type, size, field_name)

◆ ALLOCATE_FIXED_TYPED_ARRAY_MAP

#define ALLOCATE_FIXED_TYPED_ARRAY_MAP (   Type,
  type,
  TYPE,
  ctype,
  size 
)     ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array)

◆ ALLOCATE_MAP

#define ALLOCATE_MAP (   instance_type,
  size,
  field_name 
)
Value:
{ \
Map* map; \
if (!AllocateMap((instance_type), size).To(&map)) return false; \
set_##field_name##_map(map); \
}
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 map
enable harmony numeric enable harmony object literal extensions Optimize object size

◆ ALLOCATE_PARTIAL_MAP

#define ALLOCATE_PARTIAL_MAP (   instance_type,
  size,
  field_name 
)
Value:
{ \
Map* map; \
if (!AllocatePartialMap((instance_type), (size)).To(&map)) return false; \
set_##field_name##_map(map); \
}

◆ ALLOCATE_VARSIZE_MAP

#define ALLOCATE_VARSIZE_MAP (   instance_type,
  field_name 
)     ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name)

◆ ARRAY_TYPE_TO_ROOT_INDEX [1/2]

#define ARRAY_TYPE_TO_ROOT_INDEX (   Type,
  type,
  TYPE,
  ctype,
  size 
)
Value:
case kExternal##Type##Array: \
return kExternal##Type##ArrayMapRootIndex;

◆ ARRAY_TYPE_TO_ROOT_INDEX [2/2]

#define ARRAY_TYPE_TO_ROOT_INDEX (   Type,
  type,
  TYPE,
  ctype,
  size 
)
Value:
case kExternal##Type##Array: \
return kFixed##Type##ArrayMapRootIndex;

◆ CONSTANT_STRING_ELEMENT

#define CONSTANT_STRING_ELEMENT (   name,
  contents 
)
Value:
{ contents, k##name##RootIndex } \
,

◆ ELEMENT_KIND_TO_ROOT_INDEX [1/2]

#define ELEMENT_KIND_TO_ROOT_INDEX (   Type,
  type,
  TYPE,
  ctype,
  size 
)
Value:
case EXTERNAL_##TYPE##_ELEMENTS: \
return kEmptyExternal##Type##ArrayRootIndex;

◆ ELEMENT_KIND_TO_ROOT_INDEX [2/2]

#define ELEMENT_KIND_TO_ROOT_INDEX (   Type,
  type,
  TYPE,
  ctype,
  size 
)
Value:
case TYPE##_ELEMENTS: \
return kEmptyFixed##Type##ArrayRootIndex;

◆ MAKE_CASE

#define MAKE_CASE (   NAME,
  Name,
  name 
)
Value:
case NAME##_TYPE: \
map = name##_map(); \
break;

◆ STRING_TYPE_ELEMENT

#define STRING_TYPE_ELEMENT (   type,
  size,
  name,
  camel_name 
)
Value:
{ type, size, k##camel_name##MapRootIndex } \
,

◆ STRUCT_TABLE_ELEMENT

#define STRUCT_TABLE_ELEMENT (   NAME,
  Name,
  name 
)
Value:
{ NAME##_TYPE, Name::kSize, k##Name##MapRootIndex } \
,

◆ TYPED_ARRAY_CASE

#define TYPED_ARRAY_CASE (   Type,
  type,
  TYPE,
  ctype,
  size 
)
Value:
case kExternal##Type##Array: \
*element_size = size; \
*element_kind = TYPE##_ELEMENTS; \
return;

◆ UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE

#define UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE (   space)
Value:
UPDATE_FRAGMENTATION_FOR_SPACE(space)
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 space(in MBytes)
#define UPDATE_COUNTERS_FOR_SPACE(space)

◆ UPDATE_COUNTERS_FOR_SPACE

#define UPDATE_COUNTERS_FOR_SPACE (   space)
Value:
isolate_->counters()->space##_bytes_available()->Set( \
static_cast<int>(space()->Available())); \
isolate_->counters()->space##_bytes_committed()->Set( \
static_cast<int>(space()->CommittedMemory())); \
isolate_->counters()->space##_bytes_used()->Set( \
static_cast<int>(space()->SizeOfObjects()));

◆ UPDATE_FRAGMENTATION_FOR_SPACE

#define UPDATE_FRAGMENTATION_FOR_SPACE (   space)
Value:
if (space()->CommittedMemory() > 0) { \
isolate_->counters()->external_fragmentation_##space()->AddSample( \
static_cast<int>(100 - \
(space()->SizeOfObjects() * 100.0) / \
space()->CommittedMemory())); \
}