V8 Project
v8::internal::V8HeapExplorer Class Reference

#include <heap-snapshot-generator.h>

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

Public Member Functions

 V8HeapExplorer (HeapSnapshot *snapshot, SnapshottingProgressReportingInterface *progress, v8::HeapProfiler::ObjectNameResolver *resolver)
 
virtual ~V8HeapExplorer ()
 
virtual HeapEntry * AllocateEntry (HeapThing ptr)
 
void AddRootEntries (SnapshotFiller *filler)
 
int EstimateObjectsCount (HeapIterator *iterator)
 
bool IterateAndExtractReferences (SnapshotFiller *filler)
 
void TagGlobalObjects ()
 
void TagCodeObject (Code *code)
 
void TagBuiltinCodeObject (Code *code, const char *name)
 
HeapEntry * AddEntry (Address address, HeapEntry::Type type, const char *name, size_t size)
 
- Public Member Functions inherited from v8::internal::HeapEntriesAllocator
virtual ~HeapEntriesAllocator ()
 

Static Public Member Functions

static StringGetConstructorName (JSObject *object)
 

Private Types

typedef bool(V8HeapExplorer::* ExtractReferencesMethod) (int entry, HeapObject *object)
 

Private Member Functions

HeapEntry * AddEntry (HeapObject *object)
 
HeapEntry * AddEntry (HeapObject *object, HeapEntry::Type type, const char *name)
 
const char * GetSystemEntryName (HeapObject *object)
 
template<V8HeapExplorer::ExtractReferencesMethod extractor>
bool IterateAndExtractSinglePass ()
 
bool ExtractReferencesPass1 (int entry, HeapObject *obj)
 
bool ExtractReferencesPass2 (int entry, HeapObject *obj)
 
void ExtractJSGlobalProxyReferences (int entry, JSGlobalProxy *proxy)
 
void ExtractJSObjectReferences (int entry, JSObject *js_obj)
 
void ExtractStringReferences (int entry, String *obj)
 
void ExtractSymbolReferences (int entry, Symbol *symbol)
 
void ExtractJSCollectionReferences (int entry, JSCollection *collection)
 
void ExtractJSWeakCollectionReferences (int entry, JSWeakCollection *collection)
 
void ExtractContextReferences (int entry, Context *context)
 
void ExtractMapReferences (int entry, Map *map)
 
void ExtractSharedFunctionInfoReferences (int entry, SharedFunctionInfo *shared)
 
void ExtractScriptReferences (int entry, Script *script)
 
void ExtractAccessorInfoReferences (int entry, AccessorInfo *accessor_info)
 
void ExtractAccessorPairReferences (int entry, AccessorPair *accessors)
 
void ExtractCodeCacheReferences (int entry, CodeCache *code_cache)
 
void ExtractCodeReferences (int entry, Code *code)
 
void ExtractBoxReferences (int entry, Box *box)
 
void ExtractCellReferences (int entry, Cell *cell)
 
void ExtractPropertyCellReferences (int entry, PropertyCell *cell)
 
void ExtractAllocationSiteReferences (int entry, AllocationSite *site)
 
void ExtractJSArrayBufferReferences (int entry, JSArrayBuffer *buffer)
 
void ExtractFixedArrayReferences (int entry, FixedArray *array)
 
void ExtractClosureReferences (JSObject *js_obj, int entry)
 
void ExtractPropertyReferences (JSObject *js_obj, int entry)
 
bool ExtractAccessorPairProperty (JSObject *js_obj, int entry, Object *key, Object *callback_obj)
 
void ExtractElementReferences (JSObject *js_obj, int entry)
 
void ExtractInternalReferences (JSObject *js_obj, int entry)
 
bool IsEssentialObject (Object *object)
 
void SetContextReference (HeapObject *parent_obj, int parent, String *reference_name, Object *child, int field_offset)
 
void SetNativeBindReference (HeapObject *parent_obj, int parent, const char *reference_name, Object *child)
 
void SetElementReference (HeapObject *parent_obj, int parent, int index, Object *child)
 
void SetInternalReference (HeapObject *parent_obj, int parent, const char *reference_name, Object *child, int field_offset=-1)
 
void SetInternalReference (HeapObject *parent_obj, int parent, int index, Object *child, int field_offset=-1)
 
void SetHiddenReference (HeapObject *parent_obj, int parent, int index, Object *child)
 
void SetWeakReference (HeapObject *parent_obj, int parent, const char *reference_name, Object *child_obj, int field_offset)
 
void SetWeakReference (HeapObject *parent_obj, int parent, int index, Object *child_obj, int field_offset)
 
void SetPropertyReference (HeapObject *parent_obj, int parent, Name *reference_name, Object *child, const char *name_format_string=NULL, int field_offset=-1)
 
void SetUserGlobalReference (Object *user_global)
 
void SetRootGcRootsReference ()
 
void SetGcRootsReference (VisitorSynchronization::SyncTag tag)
 
void SetGcSubrootReference (VisitorSynchronization::SyncTag tag, bool is_weak, Object *child)
 
const char * GetStrongGcSubrootName (Object *object)
 
void TagObject (Object *obj, const char *tag)
 
void MarkAsWeakContainer (Object *object)
 
HeapEntry * GetEntry (Object *obj)
 
 DISALLOW_COPY_AND_ASSIGN (V8HeapExplorer)
 

Private Attributes

Heapheap_
 
HeapSnapshotsnapshot_
 
StringsStoragenames_
 
HeapObjectsMapheap_object_map_
 
SnapshottingProgressReportingInterfaceprogress_
 
SnapshotFillerfiller_
 
HeapObjectsSet objects_tags_
 
HeapObjectsSet strong_gc_subroot_names_
 
HeapObjectsSet user_roots_
 
HeapObjectsSet weak_containers_
 
v8::HeapProfiler::ObjectNameResolverglobal_object_name_resolver_
 

Friends

class IndexedReferencesExtractor
 
class RootsReferencesExtractor
 

Detailed Description

Definition at line 328 of file heap-snapshot-generator.h.

Member Typedef Documentation

◆ ExtractReferencesMethod

typedef bool(V8HeapExplorer::* v8::internal::V8HeapExplorer::ExtractReferencesMethod) (int entry, HeapObject *object)
private

Definition at line 349 of file heap-snapshot-generator.h.

Constructor & Destructor Documentation

◆ V8HeapExplorer()

v8::internal::V8HeapExplorer::V8HeapExplorer ( HeapSnapshot snapshot,
SnapshottingProgressReportingInterface progress,
v8::HeapProfiler::ObjectNameResolver resolver 
)

Definition at line 781 of file heap-snapshot-generator.cc.

785  : heap_(snapshot->profiler()->heap_object_map()->heap()),
789  progress_(progress),
790  filler_(NULL),
791  global_object_name_resolver_(resolver) {
792 }
StringsStorage * names() const
Definition: heap-profiler.h:39
HeapObjectsMap * heap_object_map() const
Definition: heap-profiler.h:38
SnapshottingProgressReportingInterface * progress_
v8::HeapProfiler::ObjectNameResolver * global_object_name_resolver_
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 snapshot(mksnapshot only)") DEFINE_STRING(raw_file
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

◆ ~V8HeapExplorer()

v8::internal::V8HeapExplorer::~V8HeapExplorer ( )
virtual

Definition at line 795 of file heap-snapshot-generator.cc.

795  {
796 }

Member Function Documentation

◆ AddEntry() [1/3]

HeapEntry * v8::internal::V8HeapExplorer::AddEntry ( Address  address,
HeapEntry::Type  type,
const char *  name,
size_t  size 
)

Definition at line 878 of file heap-snapshot-generator.cc.

881  {
883  address, static_cast<unsigned int>(size));
884  unsigned trace_node_id = 0;
885  if (AllocationTracker* allocation_tracker =
887  trace_node_id =
888  allocation_tracker->address_to_trace()->GetTraceNodeId(address);
889  }
890  return snapshot_->AddEntry(type, name, object_id, size, trace_node_id);
891 }
SnapshotObjectId FindOrAddEntry(Address addr, unsigned int size, bool accessed=true)
AllocationTracker * allocation_tracker() const
Definition: heap-profiler.h:35
HeapEntry * AddEntry(HeapEntry::Type type, const char *name, SnapshotObjectId id, size_t size, unsigned trace_node_id)
enable harmony numeric enable harmony object literal extensions Optimize object size
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
uint32_t SnapshotObjectId
Definition: v8-profiler.h:16

References v8::internal::HeapSnapshot::AddEntry(), v8::internal::HeapProfiler::allocation_tracker(), v8::internal::HeapObjectsMap::FindOrAddEntry(), heap_object_map_, name, v8::internal::HeapSnapshot::profiler(), size, and snapshot_.

Referenced by AddEntry(), v8::internal::JSArrayBufferDataEntryAllocator::AllocateEntry(), and AllocateEntry().

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

◆ AddEntry() [2/3]

HeapEntry * v8::internal::V8HeapExplorer::AddEntry ( HeapObject object)
private

Definition at line 804 of file heap-snapshot-generator.cc.

804  {
805  if (object->IsJSFunction()) {
806  JSFunction* func = JSFunction::cast(object);
807  SharedFunctionInfo* shared = func->shared();
808  const char* name = shared->bound() ? "native_bind" :
809  names_->GetName(String::cast(shared->name()));
810  return AddEntry(object, HeapEntry::kClosure, name);
811  } else if (object->IsJSRegExp()) {
812  JSRegExp* re = JSRegExp::cast(object);
813  return AddEntry(object,
814  HeapEntry::kRegExp,
815  names_->GetName(re->Pattern()));
816  } else if (object->IsJSObject()) {
817  const char* name = names_->GetName(
818  GetConstructorName(JSObject::cast(object)));
819  if (object->IsJSGlobalObject()) {
820  const char* tag = objects_tags_.GetTag(object);
821  if (tag != NULL) {
822  name = names_->GetFormatted("%s / %s", name, tag);
823  }
824  }
825  return AddEntry(object, HeapEntry::kObject, name);
826  } else if (object->IsString()) {
827  String* string = String::cast(object);
828  if (string->IsConsString())
829  return AddEntry(object,
830  HeapEntry::kConsString,
831  "(concatenated string)");
832  if (string->IsSlicedString())
833  return AddEntry(object,
834  HeapEntry::kSlicedString,
835  "(sliced string)");
836  return AddEntry(object,
837  HeapEntry::kString,
838  names_->GetName(String::cast(object)));
839  } else if (object->IsSymbol()) {
840  return AddEntry(object, HeapEntry::kSymbol, "symbol");
841  } else if (object->IsCode()) {
842  return AddEntry(object, HeapEntry::kCode, "");
843  } else if (object->IsSharedFunctionInfo()) {
844  String* name = String::cast(SharedFunctionInfo::cast(object)->name());
845  return AddEntry(object,
846  HeapEntry::kCode,
847  names_->GetName(name));
848  } else if (object->IsScript()) {
849  Object* name = Script::cast(object)->name();
850  return AddEntry(object,
851  HeapEntry::kCode,
852  name->IsString()
853  ? names_->GetName(String::cast(name))
854  : "");
855  } else if (object->IsNativeContext()) {
856  return AddEntry(object, HeapEntry::kHidden, "system / NativeContext");
857  } else if (object->IsContext()) {
858  return AddEntry(object, HeapEntry::kObject, "system / Context");
859  } else if (object->IsFixedArray() ||
860  object->IsFixedDoubleArray() ||
861  object->IsByteArray() ||
862  object->IsExternalArray()) {
863  return AddEntry(object, HeapEntry::kArray, "");
864  } else if (object->IsHeapNumber()) {
865  return AddEntry(object, HeapEntry::kHeapNumber, "number");
866  }
867  return AddEntry(object, HeapEntry::kHidden, GetSystemEntryName(object));
868 }
const char * GetTag(Object *obj)
const char * GetName(Name *name)
const char * GetFormatted(const char *format,...)
static String * GetConstructorName(JSObject *object)
const char * GetSystemEntryName(HeapObject *object)
HeapEntry * AddEntry(Address address, HeapEntry::Type type, const char *name, size_t size)
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References AddEntry(), GetConstructorName(), v8::internal::StringsStorage::GetFormatted(), v8::internal::StringsStorage::GetName(), GetSystemEntryName(), v8::internal::HeapObjectsSet::GetTag(), name, names_, NULL, objects_tags_, and v8::internal::JSRegExp::Pattern().

+ Here is the call graph for this function:

◆ AddEntry() [3/3]

HeapEntry * v8::internal::V8HeapExplorer::AddEntry ( HeapObject object,
HeapEntry::Type  type,
const char *  name 
)
private

Definition at line 871 of file heap-snapshot-generator.cc.

873  {
874  return AddEntry(object->address(), type, name, object->Size());
875 }

References AddEntry(), v8::internal::HeapObject::address(), name, and v8::internal::HeapObject::Size().

+ Here is the call graph for this function:

◆ AddRootEntries()

void v8::internal::V8HeapExplorer::AddRootEntries ( SnapshotFiller filler)

◆ AllocateEntry()

HeapEntry * v8::internal::V8HeapExplorer::AllocateEntry ( HeapThing  ptr)
virtual

Implements v8::internal::HeapEntriesAllocator.

Definition at line 799 of file heap-snapshot-generator.cc.

799  {
800  return AddEntry(reinterpret_cast<HeapObject*>(ptr));
801 }

References AddEntry().

+ Here is the call graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::V8HeapExplorer::DISALLOW_COPY_AND_ASSIGN ( V8HeapExplorer  )
private

◆ EstimateObjectsCount()

int v8::internal::V8HeapExplorer::EstimateObjectsCount ( HeapIterator *  iterator)

Definition at line 975 of file heap-snapshot-generator.cc.

975  {
976  int objects_count = 0;
977  for (HeapObject* obj = iterator->next();
978  obj != NULL;
979  obj = iterator->next()) {
980  objects_count++;
981  }
982  return objects_count;
983 }

References NULL.

Referenced by v8::internal::HeapSnapshotGenerator::SetProgressTotal().

+ Here is the caller graph for this function:

◆ ExtractAccessorInfoReferences()

void v8::internal::V8HeapExplorer::ExtractAccessorInfoReferences ( int  entry,
AccessorInfo accessor_info 
)
private

Definition at line 1423 of file heap-snapshot-generator.cc.

1424  {
1425  SetInternalReference(accessor_info, entry, "name", accessor_info->name(),
1427  SetInternalReference(accessor_info, entry, "expected_receiver_type",
1428  accessor_info->expected_receiver_type(),
1430  if (accessor_info->IsDeclaredAccessorInfo()) {
1431  DeclaredAccessorInfo* declared_accessor_info =
1432  DeclaredAccessorInfo::cast(accessor_info);
1433  SetInternalReference(declared_accessor_info, entry, "descriptor",
1434  declared_accessor_info->descriptor(),
1436  } else if (accessor_info->IsExecutableAccessorInfo()) {
1437  ExecutableAccessorInfo* executable_accessor_info =
1438  ExecutableAccessorInfo::cast(accessor_info);
1439  SetInternalReference(executable_accessor_info, entry, "getter",
1440  executable_accessor_info->getter(),
1442  SetInternalReference(executable_accessor_info, entry, "setter",
1443  executable_accessor_info->setter(),
1445  SetInternalReference(executable_accessor_info, entry, "data",
1446  executable_accessor_info->data(),
1448  }
1449 }
static const int kExpectedReceiverTypeOffset
Definition: objects.h:10138
static const int kNameOffset
Definition: objects.h:10136
static const int kDescriptorOffset
Definition: objects.h:10255
void SetInternalReference(HeapObject *parent_obj, int parent, const char *reference_name, Object *child, int field_offset=-1)

References v8::internal::ExecutableAccessorInfo::kDataOffset, v8::internal::DeclaredAccessorInfo::kDescriptorOffset, v8::internal::AccessorInfo::kExpectedReceiverTypeOffset, v8::internal::ExecutableAccessorInfo::kGetterOffset, v8::internal::AccessorInfo::kNameOffset, v8::internal::ExecutableAccessorInfo::kSetterOffset, and SetInternalReference().

Referenced by ExtractReferencesPass1().

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

◆ ExtractAccessorPairProperty()

bool v8::internal::V8HeapExplorer::ExtractAccessorPairProperty ( JSObject js_obj,
int  entry,
Object key,
Object callback_obj 
)
private

Definition at line 1708 of file heap-snapshot-generator.cc.

1709  {
1710  if (!callback_obj->IsAccessorPair()) return false;
1711  AccessorPair* accessors = AccessorPair::cast(callback_obj);
1712  Object* getter = accessors->getter();
1713  if (!getter->IsOddball()) {
1714  SetPropertyReference(js_obj, entry, String::cast(key), getter, "get %s");
1715  }
1716  Object* setter = accessors->setter();
1717  if (!setter->IsOddball()) {
1718  SetPropertyReference(js_obj, entry, String::cast(key), setter, "set %s");
1719  }
1720  return true;
1721 }
void SetPropertyReference(HeapObject *parent_obj, int parent, Name *reference_name, Object *child, const char *name_format_string=NULL, int field_offset=-1)

References SetPropertyReference().

Referenced by ExtractPropertyReferences().

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

◆ ExtractAccessorPairReferences()

void v8::internal::V8HeapExplorer::ExtractAccessorPairReferences ( int  entry,
AccessorPair accessors 
)
private

Definition at line 1452 of file heap-snapshot-generator.cc.

1453  {
1454  SetInternalReference(accessors, entry, "getter", accessors->getter(),
1456  SetInternalReference(accessors, entry, "setter", accessors->setter(),
1458 }
static const int kGetterOffset
Definition: objects.h:10340
static const int kSetterOffset
Definition: objects.h:10341

References v8::internal::AccessorPair::kGetterOffset, v8::internal::AccessorPair::kSetterOffset, and SetInternalReference().

Referenced by ExtractReferencesPass1().

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

◆ ExtractAllocationSiteReferences()

void v8::internal::V8HeapExplorer::ExtractAllocationSiteReferences ( int  entry,
AllocationSite site 
)
private

Definition at line 1541 of file heap-snapshot-generator.cc.

1542  {
1543  SetInternalReference(site, entry, "transition_info", site->transition_info(),
1545  SetInternalReference(site, entry, "nested_site", site->nested_site(),
1547  MarkAsWeakContainer(site->dependent_code());
1548  SetInternalReference(site, entry, "dependent_code", site->dependent_code(),
1550  // Do not visit weak_next as it is not visited by the StaticVisitor,
1551  // and we're not very interested in weak_next field here.
1554 }
static const int kWeakNextOffset
Definition: objects.h:8261
static const int kDependentCodeOffset
Definition: objects.h:8259
static const int kTransitionInfoOffset
Definition: objects.h:8254
static const int kNestedSiteOffset
Definition: objects.h:8255
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))

References v8::internal::AllocationSite::kDependentCodeOffset, v8::internal::FixedBodyDescriptor< start_offset, end_offset, size >::kEndOffset, v8::internal::AllocationSite::kNestedSiteOffset, v8::internal::AllocationSite::kTransitionInfoOffset, v8::internal::AllocationSite::kWeakNextOffset, MarkAsWeakContainer(), SetInternalReference(), and v8::internal::STATIC_ASSERT().

Referenced by ExtractReferencesPass1().

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

◆ ExtractBoxReferences()

void v8::internal::V8HeapExplorer::ExtractBoxReferences ( int  entry,
Box box 
)
private

Definition at line 1520 of file heap-snapshot-generator.cc.

1520  {
1521  SetInternalReference(box, entry, "value", box->value(), Box::kValueOffset);
1522 }
static const int kValueOffset
Definition: objects.h:6385

References v8::internal::Box::kValueOffset, and SetInternalReference().

Referenced by ExtractReferencesPass1().

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

◆ ExtractCellReferences()

void v8::internal::V8HeapExplorer::ExtractCellReferences ( int  entry,
Cell cell 
)
private

Definition at line 1525 of file heap-snapshot-generator.cc.

1525  {
1526  SetInternalReference(cell, entry, "value", cell->value(), Cell::kValueOffset);
1527 }
static const int kValueOffset
Definition: objects.h:9446

References v8::internal::Cell::kValueOffset, and SetInternalReference().

Referenced by ExtractPropertyCellReferences(), and ExtractReferencesPass1().

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

◆ ExtractClosureReferences()

void v8::internal::V8HeapExplorer::ExtractClosureReferences ( JSObject js_obj,
int  entry 
)
private

Definition at line 1607 of file heap-snapshot-generator.cc.

1607  {
1608  if (!js_obj->IsJSFunction()) return;
1609 
1610  JSFunction* func = JSFunction::cast(js_obj);
1611  if (func->shared()->bound()) {
1612  FixedArray* bindings = func->function_bindings();
1613  SetNativeBindReference(js_obj, entry, "bound_this",
1614  bindings->get(JSFunction::kBoundThisIndex));
1615  SetNativeBindReference(js_obj, entry, "bound_function",
1616  bindings->get(JSFunction::kBoundFunctionIndex));
1618  i < bindings->length(); i++) {
1619  const char* reference_name = names_->GetFormatted(
1620  "bound_argument_%d",
1622  SetNativeBindReference(js_obj, entry, reference_name,
1623  bindings->get(i));
1624  }
1625  }
1626 }
static const int kBoundFunctionIndex
Definition: objects.h:7392
static const int kBoundThisIndex
Definition: objects.h:7393
static const int kBoundArgumentsStartIndex
Definition: objects.h:7394
void SetNativeBindReference(HeapObject *parent_obj, int parent, const char *reference_name, Object *child)

References v8::internal::JSFunction::function_bindings(), v8::internal::FixedArray::get(), v8::internal::StringsStorage::GetFormatted(), v8::internal::JSFunction::kBoundArgumentsStartIndex, v8::internal::JSFunction::kBoundFunctionIndex, v8::internal::JSFunction::kBoundThisIndex, v8::internal::FixedArrayBase::length(), names_, and SetNativeBindReference().

Referenced by ExtractJSObjectReferences().

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

◆ ExtractCodeCacheReferences()

void v8::internal::V8HeapExplorer::ExtractCodeCacheReferences ( int  entry,
CodeCache code_cache 
)
private

Definition at line 1461 of file heap-snapshot-generator.cc.

1462  {
1463  TagObject(code_cache->default_cache(), "(default code cache)");
1464  SetInternalReference(code_cache, entry,
1465  "default_cache", code_cache->default_cache(),
1467  TagObject(code_cache->normal_type_cache(), "(code type cache)");
1468  SetInternalReference(code_cache, entry,
1469  "type_cache", code_cache->normal_type_cache(),
1471 }
static const int kDefaultCacheOffset
Definition: objects.h:7919
static const int kNormalTypeCacheOffset
Definition: objects.h:7920
void TagObject(Object *obj, const char *tag)

References v8::internal::CodeCache::kDefaultCacheOffset, v8::internal::CodeCache::kNormalTypeCacheOffset, SetInternalReference(), and TagObject().

Referenced by ExtractReferencesPass1().

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

◆ ExtractCodeReferences()

void v8::internal::V8HeapExplorer::ExtractCodeReferences ( int  entry,
Code code 
)
private

Definition at line 1488 of file heap-snapshot-generator.cc.

1488  {
1489  TagCodeObject(code);
1490  TagObject(code->relocation_info(), "(code relocation info)");
1491  SetInternalReference(code, entry,
1492  "relocation_info", code->relocation_info(),
1494  SetInternalReference(code, entry,
1495  "handler_table", code->handler_table(),
1497  TagObject(code->deoptimization_data(), "(code deopt data)");
1498  SetInternalReference(code, entry,
1499  "deoptimization_data", code->deoptimization_data(),
1501  if (code->kind() == Code::FUNCTION) {
1502  SetInternalReference(code, entry,
1503  "type_feedback_info", code->type_feedback_info(),
1505  }
1506  SetInternalReference(code, entry,
1507  "gc_metadata", code->gc_metadata(),
1509  SetInternalReference(code, entry,
1510  "constant_pool", code->constant_pool(),
1512  if (code->kind() == Code::OPTIMIZED_FUNCTION) {
1513  SetWeakReference(code, entry,
1514  "next_code_link", code->next_code_link(),
1516  }
1517 }
static const int kNextCodeLinkOffset
Definition: objects.h:5357
static const int kConstantPoolOffset
Definition: objects.h:5367
static const int kTypeFeedbackInfoOffset
Definition: objects.h:5355
static const int kHandlerTableOffset
Definition: objects.h:5351
static const int kRelocationInfoOffset
Definition: objects.h:5350
static const int kDeoptimizationDataOffset
Definition: objects.h:5352
static const int kGCMetadataOffset
Definition: objects.h:5358
void SetWeakReference(HeapObject *parent_obj, int parent, const char *reference_name, Object *child_obj, int field_offset)

References v8::internal::Code::constant_pool(), v8::internal::Code::kConstantPoolOffset, v8::internal::Code::kDeoptimizationDataOffset, v8::internal::Code::kGCMetadataOffset, v8::internal::Code::kHandlerTableOffset, v8::internal::Code::kind(), v8::internal::Code::kNextCodeLinkOffset, v8::internal::Code::kRelocationInfoOffset, v8::internal::Code::kTypeFeedbackInfoOffset, SetInternalReference(), SetWeakReference(), TagCodeObject(), TagObject(), and v8::internal::Code::type_feedback_info().

Referenced by ExtractReferencesPass1().

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

◆ ExtractContextReferences()

void v8::internal::V8HeapExplorer::ExtractContextReferences ( int  entry,
Context context 
)
private

Definition at line 1235 of file heap-snapshot-generator.cc.

1235  {
1236  if (context == context->declaration_context()) {
1237  ScopeInfo* scope_info = context->closure()->shared()->scope_info();
1238  // Add context allocated locals.
1239  int context_locals = scope_info->ContextLocalCount();
1240  for (int i = 0; i < context_locals; ++i) {
1241  String* local_name = scope_info->ContextLocalName(i);
1242  int idx = Context::MIN_CONTEXT_SLOTS + i;
1243  SetContextReference(context, entry, local_name, context->get(idx),
1245  }
1246  if (scope_info->HasFunctionName()) {
1247  String* name = scope_info->FunctionName();
1249  int idx = scope_info->FunctionContextSlotIndex(name, &mode);
1250  if (idx >= 0) {
1251  SetContextReference(context, entry, name, context->get(idx),
1253  }
1254  }
1255  }
1256 
1257 #define EXTRACT_CONTEXT_FIELD(index, type, name) \
1258  if (Context::index < Context::FIRST_WEAK_SLOT || \
1259  Context::index == Context::MAP_CACHE_INDEX) { \
1260  SetInternalReference(context, entry, #name, context->get(Context::index), \
1261  FixedArray::OffsetOfElementAt(Context::index)); \
1262  } else { \
1263  SetWeakReference(context, entry, #name, context->get(Context::index), \
1264  FixedArray::OffsetOfElementAt(Context::index)); \
1265  }
1266  EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure);
1267  EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous);
1268  EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension);
1269  EXTRACT_CONTEXT_FIELD(GLOBAL_OBJECT_INDEX, GlobalObject, global);
1270  if (context->IsNativeContext()) {
1271  TagObject(context->jsfunction_result_caches(),
1272  "(context func. result caches)");
1273  TagObject(context->normalized_map_cache(), "(context norm. map cache)");
1274  TagObject(context->runtime_context(), "(runtime context)");
1275  TagObject(context->embedder_data(), "(context data)");
1277  EXTRACT_CONTEXT_FIELD(OPTIMIZED_FUNCTIONS_LIST, unused,
1278  optimized_functions_list);
1279  EXTRACT_CONTEXT_FIELD(OPTIMIZED_CODE_LIST, unused, optimized_code_list);
1280  EXTRACT_CONTEXT_FIELD(DEOPTIMIZED_CODE_LIST, unused, deoptimized_code_list);
1281  EXTRACT_CONTEXT_FIELD(NEXT_CONTEXT_LINK, unused, next_context_link);
1282 #undef EXTRACT_CONTEXT_FIELD
1289  }
1290 }
static int OffsetOfElementAt(int index)
Definition: objects.h:2455
void SetContextReference(HeapObject *parent_obj, int parent, String *reference_name, Object *child, int field_offset)
#define NATIVE_CONTEXT_FIELDS(V)
Definition: contexts.h:76
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
#define EXTRACT_CONTEXT_FIELD(index, type, name)

References v8::internal::Context::closure(), v8::internal::ScopeInfo::ContextLocalName(), v8::internal::Context::declaration_context(), EXTRACT_CONTEXT_FIELD, v8::internal::Context::FIRST_WEAK_SLOT, v8::internal::ScopeInfo::FunctionContextSlotIndex(), v8::internal::ScopeInfo::FunctionName(), v8::internal::FixedArray::get(), v8::internal::ScopeInfo::HasFunctionName(), v8::internal::Context::IsNativeContext(), v8::internal::Context::MIN_CONTEXT_SLOTS, mode(), name, NATIVE_CONTEXT_FIELDS, v8::internal::Context::NATIVE_CONTEXT_SLOTS, v8::internal::Context::NEXT_CONTEXT_LINK, v8::internal::FixedArray::OffsetOfElementAt(), v8::internal::Context::OPTIMIZED_FUNCTIONS_LIST, SetContextReference(), v8::internal::STATIC_ASSERT(), and TagObject().

Referenced by ExtractReferencesPass2().

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

◆ ExtractElementReferences()

void v8::internal::V8HeapExplorer::ExtractElementReferences ( JSObject js_obj,
int  entry 
)
private

Definition at line 1724 of file heap-snapshot-generator.cc.

1724  {
1725  if (js_obj->HasFastObjectElements()) {
1726  FixedArray* elements = FixedArray::cast(js_obj->elements());
1727  int length = js_obj->IsJSArray() ?
1728  Smi::cast(JSArray::cast(js_obj)->length())->value() :
1729  elements->length();
1730  for (int i = 0; i < length; ++i) {
1731  if (!elements->get(i)->IsTheHole()) {
1732  SetElementReference(js_obj, entry, i, elements->get(i));
1733  }
1734  }
1735  } else if (js_obj->HasDictionaryElements()) {
1736  SeededNumberDictionary* dictionary = js_obj->element_dictionary();
1737  int length = dictionary->Capacity();
1738  for (int i = 0; i < length; ++i) {
1739  Object* k = dictionary->KeyAt(i);
1740  if (dictionary->IsKey(k)) {
1741  DCHECK(k->IsNumber());
1742  uint32_t index = static_cast<uint32_t>(k->Number());
1743  SetElementReference(js_obj, entry, index, dictionary->ValueAt(i));
1744  }
1745  }
1746  }
1747 }
void SetElementReference(HeapObject *parent_obj, int parent, int index, Object *child)
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::HashTable< Derived, Shape, Key >::Capacity(), DCHECK, v8::internal::JSObject::element_dictionary(), v8::internal::FixedArray::get(), v8::internal::JSObject::HasDictionaryElements(), v8::internal::JSObject::HasFastObjectElements(), v8::internal::HashTable< Derived, Shape, Key >::IsKey(), v8::internal::HashTable< Derived, Shape, Key >::KeyAt(), v8::internal::FixedArrayBase::length(), v8::internal::Object::Number(), SetElementReference(), and v8::internal::Dictionary< Derived, Shape, Key >::ValueAt().

Referenced by ExtractJSObjectReferences().

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

◆ ExtractFixedArrayReferences()

void v8::internal::V8HeapExplorer::ExtractFixedArrayReferences ( int  entry,
FixedArray array 
)
private

Definition at line 1593 of file heap-snapshot-generator.cc.

1593  {
1594  bool is_weak = weak_containers_.Contains(array);
1595  for (int i = 0, l = array->length(); i < l; ++i) {
1596  if (is_weak) {
1597  SetWeakReference(array, entry,
1598  i, array->get(i), array->OffsetOfElementAt(i));
1599  } else {
1600  SetInternalReference(array, entry,
1601  i, array->get(i), array->OffsetOfElementAt(i));
1602  }
1603  }
1604 }

References v8::internal::HeapObjectsSet::Contains(), v8::internal::FixedArray::get(), v8::internal::FixedArrayBase::length(), v8::internal::FixedArray::OffsetOfElementAt(), SetInternalReference(), SetWeakReference(), and weak_containers_.

Referenced by ExtractReferencesPass2().

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

◆ ExtractInternalReferences()

void v8::internal::V8HeapExplorer::ExtractInternalReferences ( JSObject js_obj,
int  entry 
)
private

Definition at line 1750 of file heap-snapshot-generator.cc.

1750  {
1751  int length = js_obj->GetInternalFieldCount();
1752  for (int i = 0; i < length; ++i) {
1753  Object* o = js_obj->GetInternalField(i);
1755  js_obj, entry, i, o, js_obj->GetInternalFieldOffset(i));
1756  }
1757 }

References v8::internal::JSObject::GetInternalField(), v8::internal::JSObject::GetInternalFieldCount(), v8::internal::JSObject::GetInternalFieldOffset(), and SetInternalReference().

Referenced by ExtractJSObjectReferences().

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

◆ ExtractJSArrayBufferReferences()

void v8::internal::V8HeapExplorer::ExtractJSArrayBufferReferences ( int  entry,
JSArrayBuffer buffer 
)
private

Definition at line 1574 of file heap-snapshot-generator.cc.

1575  {
1576  SetWeakReference(buffer, entry, "weak_next", buffer->weak_next(),
1578  SetWeakReference(buffer, entry,
1579  "weak_first_view", buffer->weak_first_view(),
1581  // Setup a reference to a native memory backing_store object.
1582  if (!buffer->backing_store())
1583  return;
1584  size_t data_size = NumberToSize(heap_->isolate(), buffer->byte_length());
1585  JSArrayBufferDataEntryAllocator allocator(data_size, this);
1586  HeapEntry* data_entry =
1587  filler_->FindOrAddEntry(buffer->backing_store(), &allocator);
1589  entry, "backing_store", data_entry);
1590 }
Isolate * isolate()
Definition: heap-inl.h:589
static const int kWeakFirstViewOffset
Definition: objects.h:9880
static const int kWeakNextOffset
Definition: objects.h:9879
HeapEntry * FindOrAddEntry(HeapThing ptr, HeapEntriesAllocator *allocator)
void SetNamedReference(HeapGraphEdge::Type type, int parent, const char *reference_name, HeapEntry *child_entry)
size_t NumberToSize(Isolate *isolate, Object *number)
Definition: conversions.h:233

References filler_, v8::internal::SnapshotFiller::FindOrAddEntry(), heap_, v8::internal::Heap::isolate(), v8::HeapGraphEdge::kInternal, v8::internal::JSArrayBuffer::kWeakFirstViewOffset, v8::internal::JSArrayBuffer::kWeakNextOffset, v8::internal::NumberToSize(), v8::internal::SnapshotFiller::SetNamedReference(), and SetWeakReference().

Referenced by ExtractReferencesPass1().

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

◆ ExtractJSCollectionReferences()

void v8::internal::V8HeapExplorer::ExtractJSCollectionReferences ( int  entry,
JSCollection collection 
)
private

Definition at line 1219 of file heap-snapshot-generator.cc.

1220  {
1221  SetInternalReference(collection, entry, "table", collection->table(),
1223 }
static const int kTableOffset
Definition: objects.h:9656

References v8::internal::JSCollection::kTableOffset, and SetInternalReference().

Referenced by ExtractReferencesPass1().

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

◆ ExtractJSGlobalProxyReferences()

void v8::internal::V8HeapExplorer::ExtractJSGlobalProxyReferences ( int  entry,
JSGlobalProxy proxy 
)
private

Definition at line 1103 of file heap-snapshot-generator.cc.

1104  {
1105  SetInternalReference(proxy, entry,
1106  "native_context", proxy->native_context(),
1108 }
static const int kNativeContextOffset
Definition: objects.h:7427

References v8::internal::JSGlobalProxy::kNativeContextOffset, and SetInternalReference().

Referenced by ExtractReferencesPass1().

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

◆ ExtractJSObjectReferences()

void v8::internal::V8HeapExplorer::ExtractJSObjectReferences ( int  entry,
JSObject js_obj 
)
private

Definition at line 1111 of file heap-snapshot-generator.cc.

1112  {
1113  HeapObject* obj = js_obj;
1114  ExtractClosureReferences(js_obj, entry);
1115  ExtractPropertyReferences(js_obj, entry);
1116  ExtractElementReferences(js_obj, entry);
1117  ExtractInternalReferences(js_obj, entry);
1118  PrototypeIterator iter(heap_->isolate(), js_obj);
1119  SetPropertyReference(obj, entry, heap_->proto_string(), iter.GetCurrent());
1120  if (obj->IsJSFunction()) {
1121  JSFunction* js_fun = JSFunction::cast(js_obj);
1122  Object* proto_or_map = js_fun->prototype_or_initial_map();
1123  if (!proto_or_map->IsTheHole()) {
1124  if (!proto_or_map->IsMap()) {
1126  obj, entry,
1127  heap_->prototype_string(), proto_or_map,
1128  NULL,
1130  } else {
1132  obj, entry,
1133  heap_->prototype_string(), js_fun->prototype());
1135  obj, entry, "initial_map", proto_or_map,
1137  }
1138  }
1139  SharedFunctionInfo* shared_info = js_fun->shared();
1140  // JSFunction has either bindings or literals and never both.
1141  bool bound = shared_info->bound();
1142  TagObject(js_fun->literals_or_bindings(),
1143  bound ? "(function bindings)" : "(function literals)");
1144  SetInternalReference(js_fun, entry,
1145  bound ? "bindings" : "literals",
1146  js_fun->literals_or_bindings(),
1148  TagObject(shared_info, "(shared function info)");
1149  SetInternalReference(js_fun, entry,
1150  "shared", shared_info,
1152  TagObject(js_fun->context(), "(context)");
1153  SetInternalReference(js_fun, entry,
1154  "context", js_fun->context(),
1156  SetWeakReference(js_fun, entry,
1157  "next_function_link", js_fun->next_function_link(),
1162  == JSFunction::kSize);
1163  } else if (obj->IsGlobalObject()) {
1164  GlobalObject* global_obj = GlobalObject::cast(obj);
1165  SetInternalReference(global_obj, entry,
1166  "builtins", global_obj->builtins(),
1168  SetInternalReference(global_obj, entry,
1169  "native_context", global_obj->native_context(),
1171  SetInternalReference(global_obj, entry,
1172  "global_context", global_obj->global_context(),
1174  SetInternalReference(global_obj, entry,
1175  "global_proxy", global_obj->global_proxy(),
1178  4 * kPointerSize);
1179  } else if (obj->IsJSArrayBufferView()) {
1180  JSArrayBufferView* view = JSArrayBufferView::cast(obj);
1181  SetInternalReference(view, entry, "buffer", view->buffer(),
1183  SetWeakReference(view, entry, "weak_next", view->weak_next(),
1185  }
1186  TagObject(js_obj->properties(), "(object properties)");
1187  SetInternalReference(obj, entry,
1188  "properties", js_obj->properties(),
1190  TagObject(js_obj->elements(), "(object elements)");
1191  SetInternalReference(obj, entry,
1192  "elements", js_obj->elements(),
1194 }
static const int kBuiltinsOffset
Definition: objects.h:7458
static const int kGlobalContextOffset
Definition: objects.h:7460
static const int kNativeContextOffset
Definition: objects.h:7459
static const int kHeaderSize
Definition: objects.h:7462
static const int kGlobalProxyOffset
Definition: objects.h:7461
static const int kWeakNextOffset
Definition: objects.h:9916
static const int kBufferOffset
Definition: objects.h:9913
static const int kNextFunctionLinkOffset
Definition: objects.h:7384
static const int kSize
Definition: objects.h:7385
static const int kNonWeakFieldsEndOffset
Definition: objects.h:7383
static const int kSharedFunctionInfoOffset
Definition: objects.h:7379
static const int kContextOffset
Definition: objects.h:7381
static const int kLiteralsOffset
Definition: objects.h:7382
static const int kPrototypeOrInitialMapOffset
Definition: objects.h:7377
static const int kHeaderSize
Definition: objects.h:2195
static const int kPropertiesOffset
Definition: objects.h:2193
static const int kElementsOffset
Definition: objects.h:2194
void ExtractClosureReferences(JSObject *js_obj, int entry)
void ExtractElementReferences(JSObject *js_obj, int entry)
void ExtractInternalReferences(JSObject *js_obj, int entry)
void ExtractPropertyReferences(JSObject *js_obj, int entry)
const int kPointerSize
Definition: globals.h:129

References v8::internal::JSFunction::context(), ExtractClosureReferences(), ExtractElementReferences(), ExtractInternalReferences(), ExtractPropertyReferences(), v8::internal::PrototypeIterator::GetCurrent(), heap_, v8::internal::Heap::isolate(), v8::internal::JSArrayBufferView::kBufferOffset, v8::internal::GlobalObject::kBuiltinsOffset, v8::internal::JSFunction::kContextOffset, v8::internal::JSObject::kElementsOffset, v8::internal::GlobalObject::kGlobalContextOffset, v8::internal::GlobalObject::kGlobalProxyOffset, v8::internal::JSObject::kHeaderSize, v8::internal::GlobalObject::kHeaderSize, v8::internal::JSFunction::kLiteralsOffset, v8::internal::GlobalObject::kNativeContextOffset, v8::internal::JSFunction::kNextFunctionLinkOffset, v8::internal::JSFunction::kNonWeakFieldsEndOffset, v8::internal::kPointerSize, v8::internal::JSObject::kPropertiesOffset, v8::internal::JSFunction::kPrototypeOrInitialMapOffset, v8::internal::JSFunction::kSharedFunctionInfoOffset, v8::internal::JSFunction::kSize, v8::internal::JSArrayBufferView::kWeakNextOffset, NULL, v8::internal::JSFunction::prototype(), SetInternalReference(), SetPropertyReference(), SetWeakReference(), v8::internal::STATIC_ASSERT(), and TagObject().

Referenced by ExtractReferencesPass1().

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

◆ ExtractJSWeakCollectionReferences()

void v8::internal::V8HeapExplorer::ExtractJSWeakCollectionReferences ( int  entry,
JSWeakCollection collection 
)
private

Definition at line 1226 of file heap-snapshot-generator.cc.

1227  {
1228  MarkAsWeakContainer(collection->table());
1229  SetInternalReference(collection, entry,
1230  "table", collection->table(),
1232 }
static const int kTableOffset
Definition: objects.h:9807

References v8::internal::JSWeakCollection::kTableOffset, MarkAsWeakContainer(), and SetInternalReference().

Referenced by ExtractReferencesPass1().

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

◆ ExtractMapReferences()

void v8::internal::V8HeapExplorer::ExtractMapReferences ( int  entry,
Map map 
)
private

Definition at line 1293 of file heap-snapshot-generator.cc.

1293  {
1294  if (map->HasTransitionArray()) {
1295  TransitionArray* transitions = map->transitions();
1296  int transitions_entry = GetEntry(transitions)->index();
1297  Object* back_pointer = transitions->back_pointer_storage();
1298  TagObject(back_pointer, "(back pointer)");
1299  SetInternalReference(transitions, transitions_entry,
1300  "back_pointer", back_pointer);
1301 
1302  if (FLAG_collect_maps && map->CanTransition()) {
1303  if (!transitions->IsSimpleTransition()) {
1304  if (transitions->HasPrototypeTransitions()) {
1305  FixedArray* prototype_transitions =
1306  transitions->GetPrototypeTransitions();
1307  MarkAsWeakContainer(prototype_transitions);
1308  TagObject(prototype_transitions, "(prototype transitions");
1309  SetInternalReference(transitions, transitions_entry,
1310  "prototype_transitions", prototype_transitions);
1311  }
1312  // TODO(alph): transitions keys are strong links.
1313  MarkAsWeakContainer(transitions);
1314  }
1315  }
1316 
1317  TagObject(transitions, "(transition array)");
1318  SetInternalReference(map, entry,
1319  "transitions", transitions,
1321  } else {
1322  Object* back_pointer = map->GetBackPointer();
1323  TagObject(back_pointer, "(back pointer)");
1324  SetInternalReference(map, entry,
1325  "back_pointer", back_pointer,
1327  }
1328  DescriptorArray* descriptors = map->instance_descriptors();
1329  TagObject(descriptors, "(map descriptors)");
1330  SetInternalReference(map, entry,
1331  "descriptors", descriptors,
1333 
1334  MarkAsWeakContainer(map->code_cache());
1335  SetInternalReference(map, entry,
1336  "code_cache", map->code_cache(),
1338  SetInternalReference(map, entry,
1339  "prototype", map->prototype(), Map::kPrototypeOffset);
1340  SetInternalReference(map, entry,
1341  "constructor", map->constructor(),
1343  TagObject(map->dependent_code(), "(dependent code)");
1344  MarkAsWeakContainer(map->dependent_code());
1345  SetInternalReference(map, entry,
1346  "dependent_code", map->dependent_code(),
1348 }
static const int kDescriptorsOffset
Definition: objects.h:6198
static const int kDependentCodeOffset
Definition: objects.h:6201
static const int kTransitionsOrBackPointerOffset
Definition: objects.h:6196
static const int kCodeCacheOffset
Definition: objects.h:6200
static const int kConstructorOffset
Definition: objects.h:6191
static const int kPrototypeOffset
Definition: objects.h:6190
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

References v8::internal::TransitionArray::back_pointer_storage(), GetEntry(), v8::internal::TransitionArray::GetPrototypeTransitions(), v8::internal::TransitionArray::HasPrototypeTransitions(), v8::internal::TransitionArray::IsSimpleTransition(), v8::internal::Map::kCodeCacheOffset, v8::internal::Map::kConstructorOffset, v8::internal::Map::kDependentCodeOffset, v8::internal::Map::kDescriptorsOffset, v8::internal::Map::kPrototypeOffset, v8::internal::Map::kTransitionsOrBackPointerOffset, map, MarkAsWeakContainer(), SetInternalReference(), and TagObject().

Referenced by ExtractReferencesPass1().

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

◆ ExtractPropertyCellReferences()

void v8::internal::V8HeapExplorer::ExtractPropertyCellReferences ( int  entry,
PropertyCell cell 
)
private

Definition at line 1530 of file heap-snapshot-generator.cc.

1531  {
1532  ExtractCellReferences(entry, cell);
1533  SetInternalReference(cell, entry, "type", cell->type(),
1535  MarkAsWeakContainer(cell->dependent_code());
1536  SetInternalReference(cell, entry, "dependent_code", cell->dependent_code(),
1538 }
static const int kDependentCodeOffset
Definition: objects.h:9495
static const int kTypeOffset
Definition: objects.h:9494
void ExtractCellReferences(int entry, Cell *cell)

References ExtractCellReferences(), v8::internal::PropertyCell::kDependentCodeOffset, v8::internal::PropertyCell::kTypeOffset, MarkAsWeakContainer(), SetInternalReference(), and v8::internal::PropertyCell::type().

Referenced by ExtractReferencesPass1().

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

◆ ExtractPropertyReferences()

void v8::internal::V8HeapExplorer::ExtractPropertyReferences ( JSObject js_obj,
int  entry 
)
private

Definition at line 1629 of file heap-snapshot-generator.cc.

1629  {
1630  if (js_obj->HasFastProperties()) {
1631  DescriptorArray* descs = js_obj->map()->instance_descriptors();
1632  int real_size = js_obj->map()->NumberOfOwnDescriptors();
1633  for (int i = 0; i < real_size; i++) {
1634  switch (descs->GetType(i)) {
1635  case FIELD: {
1636  Representation r = descs->GetDetails(i).representation();
1637  if (r.IsSmi() || r.IsDouble()) break;
1638  int index = descs->GetFieldIndex(i);
1639 
1640  Name* k = descs->GetKey(i);
1641  if (index < js_obj->map()->inobject_properties()) {
1642  Object* value = js_obj->InObjectPropertyAt(index);
1643  if (k != heap_->hidden_string()) {
1645  js_obj, entry,
1646  k, value,
1647  NULL,
1648  js_obj->GetInObjectPropertyOffset(index));
1649  } else {
1650  TagObject(value, "(hidden properties)");
1652  js_obj, entry,
1653  "hidden_properties", value,
1654  js_obj->GetInObjectPropertyOffset(index));
1655  }
1656  } else {
1657  FieldIndex field_index =
1658  FieldIndex::ForDescriptor(js_obj->map(), i);
1659  Object* value = js_obj->RawFastPropertyAt(field_index);
1660  if (k != heap_->hidden_string()) {
1661  SetPropertyReference(js_obj, entry, k, value);
1662  } else {
1663  TagObject(value, "(hidden properties)");
1664  SetInternalReference(js_obj, entry, "hidden_properties", value);
1665  }
1666  }
1667  break;
1668  }
1669  case CONSTANT:
1671  js_obj, entry,
1672  descs->GetKey(i), descs->GetConstant(i));
1673  break;
1674  case CALLBACKS:
1676  js_obj, entry,
1677  descs->GetKey(i), descs->GetValue(i));
1678  break;
1679  case NORMAL: // only in slow mode
1680  UNREACHABLE();
1681  break;
1682  }
1683  }
1684  } else {
1685  NameDictionary* dictionary = js_obj->property_dictionary();
1686  int length = dictionary->Capacity();
1687  for (int i = 0; i < length; ++i) {
1688  Object* k = dictionary->KeyAt(i);
1689  if (dictionary->IsKey(k)) {
1690  Object* target = dictionary->ValueAt(i);
1691  // We assume that global objects can only have slow properties.
1692  Object* value = target->IsPropertyCell()
1693  ? PropertyCell::cast(target)->value()
1694  : target;
1695  if (k == heap_->hidden_string()) {
1696  TagObject(value, "(hidden properties)");
1697  SetInternalReference(js_obj, entry, "hidden_properties", value);
1698  continue;
1699  }
1700  if (ExtractAccessorPairProperty(js_obj, entry, k, value)) continue;
1701  SetPropertyReference(js_obj, entry, String::cast(k), value);
1702  }
1703  }
1704  }
1705 }
String * hidden_string()
Definition: heap.h:788
bool ExtractAccessorPairProperty(JSObject *js_obj, int entry, Object *key, Object *callback_obj)
#define UNREACHABLE()
Definition: logging.h:30

References v8::internal::CALLBACKS, v8::internal::HashTable< Derived, Shape, Key >::Capacity(), v8::internal::CONSTANT, ExtractAccessorPairProperty(), v8::internal::FIELD, v8::internal::DescriptorArray::GetConstant(), v8::internal::DescriptorArray::GetDetails(), v8::internal::DescriptorArray::GetFieldIndex(), v8::internal::JSObject::GetInObjectPropertyOffset(), v8::internal::DescriptorArray::GetKey(), v8::internal::DescriptorArray::GetType(), v8::internal::DescriptorArray::GetValue(), v8::internal::JSObject::HasFastProperties(), heap_, v8::internal::Heap::hidden_string(), v8::internal::JSObject::InObjectPropertyAt(), v8::internal::Representation::IsDouble(), v8::internal::HashTable< Derived, Shape, Key >::IsKey(), v8::internal::Representation::IsSmi(), v8::internal::HashTable< Derived, Shape, Key >::KeyAt(), map, v8::internal::HeapObject::map(), v8::internal::NORMAL, NULL, v8::internal::Map::NumberOfOwnDescriptors(), v8::internal::JSObject::property_dictionary(), v8::internal::JSObject::RawFastPropertyAt(), SetInternalReference(), SetPropertyReference(), TagObject(), UNREACHABLE, and v8::internal::Dictionary< Derived, Shape, Key >::ValueAt().

Referenced by ExtractJSObjectReferences().

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

◆ ExtractReferencesPass1()

bool v8::internal::V8HeapExplorer::ExtractReferencesPass1 ( int  entry,
HeapObject obj 
)
private

Definition at line 1042 of file heap-snapshot-generator.cc.

1042  {
1043  if (obj->IsFixedArray()) return false; // FixedArrays are processed on pass 2
1044 
1045  if (obj->IsJSGlobalProxy()) {
1046  ExtractJSGlobalProxyReferences(entry, JSGlobalProxy::cast(obj));
1047  } else if (obj->IsJSArrayBuffer()) {
1048  ExtractJSArrayBufferReferences(entry, JSArrayBuffer::cast(obj));
1049  } else if (obj->IsJSObject()) {
1050  if (obj->IsJSWeakSet()) {
1051  ExtractJSWeakCollectionReferences(entry, JSWeakSet::cast(obj));
1052  } else if (obj->IsJSWeakMap()) {
1053  ExtractJSWeakCollectionReferences(entry, JSWeakMap::cast(obj));
1054  } else if (obj->IsJSSet()) {
1055  ExtractJSCollectionReferences(entry, JSSet::cast(obj));
1056  } else if (obj->IsJSMap()) {
1057  ExtractJSCollectionReferences(entry, JSMap::cast(obj));
1058  }
1059  ExtractJSObjectReferences(entry, JSObject::cast(obj));
1060  } else if (obj->IsString()) {
1061  ExtractStringReferences(entry, String::cast(obj));
1062  } else if (obj->IsSymbol()) {
1063  ExtractSymbolReferences(entry, Symbol::cast(obj));
1064  } else if (obj->IsMap()) {
1065  ExtractMapReferences(entry, Map::cast(obj));
1066  } else if (obj->IsSharedFunctionInfo()) {
1067  ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj));
1068  } else if (obj->IsScript()) {
1069  ExtractScriptReferences(entry, Script::cast(obj));
1070  } else if (obj->IsAccessorInfo()) {
1071  ExtractAccessorInfoReferences(entry, AccessorInfo::cast(obj));
1072  } else if (obj->IsAccessorPair()) {
1073  ExtractAccessorPairReferences(entry, AccessorPair::cast(obj));
1074  } else if (obj->IsCodeCache()) {
1075  ExtractCodeCacheReferences(entry, CodeCache::cast(obj));
1076  } else if (obj->IsCode()) {
1077  ExtractCodeReferences(entry, Code::cast(obj));
1078  } else if (obj->IsBox()) {
1079  ExtractBoxReferences(entry, Box::cast(obj));
1080  } else if (obj->IsCell()) {
1081  ExtractCellReferences(entry, Cell::cast(obj));
1082  } else if (obj->IsPropertyCell()) {
1083  ExtractPropertyCellReferences(entry, PropertyCell::cast(obj));
1084  } else if (obj->IsAllocationSite()) {
1085  ExtractAllocationSiteReferences(entry, AllocationSite::cast(obj));
1086  }
1087  return true;
1088 }
void ExtractBoxReferences(int entry, Box *box)
void ExtractMapReferences(int entry, Map *map)
void ExtractJSObjectReferences(int entry, JSObject *js_obj)
void ExtractJSWeakCollectionReferences(int entry, JSWeakCollection *collection)
void ExtractSharedFunctionInfoReferences(int entry, SharedFunctionInfo *shared)
void ExtractJSCollectionReferences(int entry, JSCollection *collection)
void ExtractJSGlobalProxyReferences(int entry, JSGlobalProxy *proxy)
void ExtractJSArrayBufferReferences(int entry, JSArrayBuffer *buffer)
void ExtractCodeCacheReferences(int entry, CodeCache *code_cache)
void ExtractStringReferences(int entry, String *obj)
void ExtractScriptReferences(int entry, Script *script)
void ExtractSymbolReferences(int entry, Symbol *symbol)
void ExtractCodeReferences(int entry, Code *code)
void ExtractAccessorInfoReferences(int entry, AccessorInfo *accessor_info)
void ExtractAllocationSiteReferences(int entry, AllocationSite *site)
void ExtractAccessorPairReferences(int entry, AccessorPair *accessors)
void ExtractPropertyCellReferences(int entry, PropertyCell *cell)

References ExtractAccessorInfoReferences(), ExtractAccessorPairReferences(), ExtractAllocationSiteReferences(), ExtractBoxReferences(), ExtractCellReferences(), ExtractCodeCacheReferences(), ExtractCodeReferences(), ExtractJSArrayBufferReferences(), ExtractJSCollectionReferences(), ExtractJSGlobalProxyReferences(), ExtractJSObjectReferences(), ExtractJSWeakCollectionReferences(), ExtractMapReferences(), ExtractPropertyCellReferences(), ExtractScriptReferences(), ExtractSharedFunctionInfoReferences(), ExtractStringReferences(), and ExtractSymbolReferences().

+ Here is the call graph for this function:

◆ ExtractReferencesPass2()

bool v8::internal::V8HeapExplorer::ExtractReferencesPass2 ( int  entry,
HeapObject obj 
)
private

Definition at line 1091 of file heap-snapshot-generator.cc.

1091  {
1092  if (!obj->IsFixedArray()) return false;
1093 
1094  if (obj->IsContext()) {
1096  } else {
1097  ExtractFixedArrayReferences(entry, FixedArray::cast(obj));
1098  }
1099  return true;
1100 }
static Context * cast(Object *context)
Definition: contexts.h:255
void ExtractFixedArrayReferences(int entry, FixedArray *array)
void ExtractContextReferences(int entry, Context *context)

References v8::internal::Context::cast(), ExtractContextReferences(), and ExtractFixedArrayReferences().

+ Here is the call graph for this function:

◆ ExtractScriptReferences()

void v8::internal::V8HeapExplorer::ExtractScriptReferences ( int  entry,
Script script 
)
private

Definition at line 1405 of file heap-snapshot-generator.cc.

1405  {
1406  HeapObject* obj = script;
1407  SetInternalReference(obj, entry,
1408  "source", script->source(),
1410  SetInternalReference(obj, entry,
1411  "name", script->name(),
1413  SetInternalReference(obj, entry,
1414  "context_data", script->context_data(),
1416  TagObject(script->line_ends(), "(script line ends)");
1417  SetInternalReference(obj, entry,
1418  "line_ends", script->line_ends(),
1420 }
static const int kSourceOffset
Definition: objects.h:6503
static const int kNameOffset
Definition: objects.h:6504
static const int kLineEndsOffset
Definition: objects.h:6510
static const int kContextOffset
Definition: objects.h:6507

References v8::internal::Script::kContextOffset, v8::internal::Script::kLineEndsOffset, v8::internal::Script::kNameOffset, v8::internal::Script::kSourceOffset, SetInternalReference(), and TagObject().

Referenced by ExtractReferencesPass1().

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

◆ ExtractSharedFunctionInfoReferences()

void v8::internal::V8HeapExplorer::ExtractSharedFunctionInfoReferences ( int  entry,
SharedFunctionInfo shared 
)
private

Definition at line 1351 of file heap-snapshot-generator.cc.

1352  {
1353  HeapObject* obj = shared;
1354  String* shared_name = shared->DebugName();
1355  const char* name = NULL;
1356  if (shared_name != *heap_->isolate()->factory()->empty_string()) {
1357  name = names_->GetName(shared_name);
1358  TagObject(shared->code(), names_->GetFormatted("(code for %s)", name));
1359  } else {
1360  TagObject(shared->code(), names_->GetFormatted("(%s code)",
1361  Code::Kind2String(shared->code()->kind())));
1362  }
1363 
1364  SetInternalReference(obj, entry,
1365  "name", shared->name(),
1367  SetInternalReference(obj, entry,
1368  "code", shared->code(),
1370  TagObject(shared->scope_info(), "(function scope info)");
1371  SetInternalReference(obj, entry,
1372  "scope_info", shared->scope_info(),
1374  SetInternalReference(obj, entry,
1375  "instance_class_name", shared->instance_class_name(),
1377  SetInternalReference(obj, entry,
1378  "script", shared->script(),
1380  const char* construct_stub_name = name ?
1381  names_->GetFormatted("(construct stub code for %s)", name) :
1382  "(construct stub code)";
1383  TagObject(shared->construct_stub(), construct_stub_name);
1384  SetInternalReference(obj, entry,
1385  "construct_stub", shared->construct_stub(),
1387  SetInternalReference(obj, entry,
1388  "function_data", shared->function_data(),
1390  SetInternalReference(obj, entry,
1391  "debug_info", shared->debug_info(),
1393  SetInternalReference(obj, entry,
1394  "inferred_name", shared->inferred_name(),
1396  SetInternalReference(obj, entry,
1397  "optimized_code_map", shared->optimized_code_map(),
1399  SetInternalReference(obj, entry,
1400  "feedback_vector", shared->feedback_vector(),
1402 }
static const char * Kind2String(Kind kind)
Definition: objects.cc:10627
Factory * factory()
Definition: isolate.h:982
static const int kOptimizedCodeMapOffset
Definition: objects.h:6894
static const int kScriptOffset
Definition: objects.h:6901
static const int kConstructStubOffset
Definition: objects.h:6896
static const int kDebugInfoOffset
Definition: objects.h:6902
static const int kFeedbackVectorOffset
Definition: objects.h:6904
static const int kScopeInfoOffset
Definition: objects.h:6895
static const int kInferredNameOffset
Definition: objects.h:6903
static const int kNameOffset
Definition: objects.h:6892
static const int kInstanceClassNameOffset
Definition: objects.h:6897
static const int kCodeOffset
Definition: objects.h:6893
static const int kFunctionDataOffset
Definition: objects.h:6899

References v8::internal::SharedFunctionInfo::DebugName(), v8::internal::Isolate::factory(), v8::internal::StringsStorage::GetFormatted(), v8::internal::StringsStorage::GetName(), heap_, v8::internal::Heap::isolate(), v8::internal::SharedFunctionInfo::kCodeOffset, v8::internal::SharedFunctionInfo::kConstructStubOffset, v8::internal::SharedFunctionInfo::kDebugInfoOffset, v8::internal::SharedFunctionInfo::kFeedbackVectorOffset, v8::internal::SharedFunctionInfo::kFunctionDataOffset, v8::internal::SharedFunctionInfo::kind(), v8::internal::Code::Kind2String(), v8::internal::SharedFunctionInfo::kInferredNameOffset, v8::internal::SharedFunctionInfo::kInstanceClassNameOffset, v8::internal::SharedFunctionInfo::kNameOffset, v8::internal::SharedFunctionInfo::kOptimizedCodeMapOffset, v8::internal::SharedFunctionInfo::kScopeInfoOffset, v8::internal::SharedFunctionInfo::kScriptOffset, name, names_, NULL, SetInternalReference(), and TagObject().

Referenced by ExtractReferencesPass1().

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

◆ ExtractStringReferences()

void v8::internal::V8HeapExplorer::ExtractStringReferences ( int  entry,
String obj 
)
private

Definition at line 1197 of file heap-snapshot-generator.cc.

1197  {
1198  if (string->IsConsString()) {
1199  ConsString* cs = ConsString::cast(string);
1200  SetInternalReference(cs, entry, "first", cs->first(),
1202  SetInternalReference(cs, entry, "second", cs->second(),
1204  } else if (string->IsSlicedString()) {
1205  SlicedString* ss = SlicedString::cast(string);
1206  SetInternalReference(ss, entry, "parent", ss->parent(),
1208  }
1209 }
static const int kFirstOffset
Definition: objects.h:9061
static const int kSecondOffset
Definition: objects.h:9062
static const int kParentOffset
Definition: objects.h:9104

References v8::internal::cs, v8::internal::ConsString::kFirstOffset, v8::internal::SlicedString::kParentOffset, v8::internal::ConsString::kSecondOffset, v8::internal::SlicedString::parent(), and SetInternalReference().

Referenced by ExtractReferencesPass1().

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

◆ ExtractSymbolReferences()

void v8::internal::V8HeapExplorer::ExtractSymbolReferences ( int  entry,
Symbol symbol 
)
private

Definition at line 1212 of file heap-snapshot-generator.cc.

1212  {
1213  SetInternalReference(symbol, entry,
1214  "name", symbol->name(),
1216 }
static const int kNameOffset
Definition: objects.h:8567

References v8::internal::Symbol::kNameOffset, and SetInternalReference().

Referenced by ExtractReferencesPass1().

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

◆ GetConstructorName()

String * v8::internal::V8HeapExplorer::GetConstructorName ( JSObject object)
static

Definition at line 1760 of file heap-snapshot-generator.cc.

1760  {
1761  Heap* heap = object->GetHeap();
1762  if (object->IsJSFunction()) return heap->closure_string();
1763  String* constructor_name = object->constructor_name();
1764  if (constructor_name == heap->Object_string()) {
1765  // TODO(verwaest): Try to get object.constructor.name in this case.
1766  // This requires handlification of the V8HeapExplorer.
1767  }
1768  return object->constructor_name();
1769 }

Referenced by AddEntry().

+ Here is the caller graph for this function:

◆ GetEntry()

HeapEntry * v8::internal::V8HeapExplorer::GetEntry ( Object obj)
private

Definition at line 1772 of file heap-snapshot-generator.cc.

1772  {
1773  if (!obj->IsHeapObject()) return NULL;
1774  return filler_->FindOrAddEntry(obj, this);
1775 }

References filler_, v8::internal::SnapshotFiller::FindOrAddEntry(), and NULL.

Referenced by ExtractMapReferences(), IterateAndExtractSinglePass(), SetContextReference(), SetElementReference(), SetGcSubrootReference(), SetHiddenReference(), SetInternalReference(), SetNativeBindReference(), SetPropertyReference(), SetUserGlobalReference(), SetWeakReference(), and TagObject().

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

◆ GetStrongGcSubrootName()

const char * v8::internal::V8HeapExplorer::GetStrongGcSubrootName ( Object object)
private

Definition at line 2155 of file heap-snapshot-generator.cc.

2155  {
2157 #define NAME_ENTRY(name) strong_gc_subroot_names_.SetTag(heap_->name(), #name);
2158 #define ROOT_NAME(type, name, camel_name) NAME_ENTRY(name)
2160 #undef ROOT_NAME
2161 #define STRUCT_MAP_NAME(NAME, Name, name) NAME_ENTRY(name##_map)
2163 #undef STRUCT_MAP_NAME
2164 #define STRING_NAME(name, str) NAME_ENTRY(name)
2166 #undef STRING_NAME
2167 #undef NAME_ENTRY
2169  }
2170  return strong_gc_subroot_names_.GetTag(object);
2171 }
#define STRING_NAME(name, str)
#define ROOT_NAME(type, name, camel_name)
#define STRUCT_MAP_NAME(NAME, Name, name)
#define STRONG_ROOT_LIST(V)
Definition: heap.h:28
#define INTERNALIZED_STRING_LIST(V)
Definition: heap.h:262
#define CHECK(condition)
Definition: logging.h:36
#define STRUCT_LIST(V)
Definition: objects.h:515

References CHECK, v8::internal::HeapObjectsSet::GetTag(), INTERNALIZED_STRING_LIST, v8::internal::HeapObjectsSet::is_empty(), ROOT_NAME, STRING_NAME, strong_gc_subroot_names_, STRONG_ROOT_LIST, STRUCT_LIST, and STRUCT_MAP_NAME.

Referenced by SetGcSubrootReference().

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

◆ GetSystemEntryName()

const char * v8::internal::V8HeapExplorer::GetSystemEntryName ( HeapObject object)
private

Definition at line 952 of file heap-snapshot-generator.cc.

952  {
953  switch (object->map()->instance_type()) {
954  case MAP_TYPE:
955  switch (Map::cast(object)->instance_type()) {
956 #define MAKE_STRING_MAP_CASE(instance_type, size, name, Name) \
957  case instance_type: return "system / Map (" #Name ")";
959 #undef MAKE_STRING_MAP_CASE
960  default: return "system / Map";
961  }
962  case CELL_TYPE: return "system / Cell";
963  case PROPERTY_CELL_TYPE: return "system / PropertyCell";
964  case FOREIGN_TYPE: return "system / Foreign";
965  case ODDBALL_TYPE: return "system / Oddball";
966 #define MAKE_STRUCT_CASE(NAME, Name, name) \
967  case NAME##_TYPE: return "system / "#Name;
969 #undef MAKE_STRUCT_CASE
970  default: return "system";
971  }
972 }
#define MAKE_STRING_MAP_CASE(instance_type, size, name, Name)
#define MAKE_STRUCT_CASE(NAME, Name, name)
@ PROPERTY_CELL_TYPE
Definition: objects.h:665
@ ODDBALL_TYPE
Definition: objects.h:663
@ FOREIGN_TYPE
Definition: objects.h:671
#define STRING_TYPE_LIST(V)
Definition: objects.h:457

References v8::internal::CELL_TYPE, v8::internal::FOREIGN_TYPE, v8::internal::Map::instance_type(), MAKE_STRING_MAP_CASE, MAKE_STRUCT_CASE, v8::internal::HeapObject::map(), v8::internal::MAP_TYPE, v8::internal::ODDBALL_TYPE, v8::internal::PROPERTY_CELL_TYPE, STRING_TYPE_LIST, and STRUCT_LIST.

Referenced by AddEntry().

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

◆ IsEssentialObject()

bool v8::internal::V8HeapExplorer::IsEssentialObject ( Object object)
private

Definition at line 1909 of file heap-snapshot-generator.cc.

1909  {
1910  return object->IsHeapObject()
1911  && !object->IsOddball()
1912  && object != heap_->empty_byte_array()
1913  && object != heap_->empty_fixed_array()
1914  && object != heap_->empty_descriptor_array()
1915  && object != heap_->fixed_array_map()
1916  && object != heap_->cell_map()
1917  && object != heap_->global_property_cell_map()
1918  && object != heap_->shared_function_info_map()
1919  && object != heap_->free_space_map()
1920  && object != heap_->one_pointer_filler_map()
1921  && object != heap_->two_pointer_filler_map();
1922 }

References heap_.

Referenced by MarkAsWeakContainer(), SetHiddenReference(), SetInternalReference(), SetWeakReference(), and TagObject().

+ Here is the caller graph for this function:

◆ IterateAndExtractReferences()

bool v8::internal::V8HeapExplorer::IterateAndExtractReferences ( SnapshotFiller filler)

Definition at line 1845 of file heap-snapshot-generator.cc.

1846  {
1847  filler_ = filler;
1848 
1849  // Create references to the synthetic roots.
1851  for (int tag = 0; tag < VisitorSynchronization::kNumberOfSyncTags; tag++) {
1853  }
1854 
1855  // Make sure builtin code objects get their builtin tags
1856  // first. Otherwise a particular JSFunction object could set
1857  // its custom name to a generic builtin.
1858  RootsReferencesExtractor extractor(heap_);
1859  heap_->IterateRoots(&extractor, VISIT_ONLY_STRONG);
1860  extractor.SetCollectingAllReferences();
1861  heap_->IterateRoots(&extractor, VISIT_ALL);
1862  extractor.FillReferences(this);
1863 
1864  // We have to do two passes as sometimes FixedArrays are used
1865  // to weakly hold their items, and it's impossible to distinguish
1866  // between these cases without processing the array owner first.
1867  bool interrupted =
1868  IterateAndExtractSinglePass<&V8HeapExplorer::ExtractReferencesPass1>() ||
1869  IterateAndExtractSinglePass<&V8HeapExplorer::ExtractReferencesPass2>();
1870 
1871  if (interrupted) {
1872  filler_ = NULL;
1873  return false;
1874  }
1875 
1876  filler_ = NULL;
1877  return progress_->ProgressReport(true);
1878 }
void IterateRoots(ObjectVisitor *v, VisitMode mode)
Definition: heap.cc:4722
void SetGcRootsReference(VisitorSynchronization::SyncTag tag)
@ VISIT_ONLY_STRONG
Definition: globals.h:397

References filler_, v8::internal::RootsReferencesExtractor::FillReferences(), heap_, v8::internal::Heap::IterateRoots(), v8::internal::VisitorSynchronization::kNumberOfSyncTags, NULL, progress_, v8::internal::SnapshottingProgressReportingInterface::ProgressReport(), v8::internal::RootsReferencesExtractor::SetCollectingAllReferences(), SetGcRootsReference(), SetRootGcRootsReference(), v8::internal::VISIT_ALL, and v8::internal::VISIT_ONLY_STRONG.

Referenced by v8::internal::HeapSnapshotGenerator::FillReferences().

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

◆ IterateAndExtractSinglePass()

template<V8HeapExplorer::ExtractReferencesMethod extractor>
bool v8::internal::V8HeapExplorer::IterateAndExtractSinglePass
private

Definition at line 1882 of file heap-snapshot-generator.cc.

1882  {
1883  // Now iterate the whole heap.
1884  bool interrupted = false;
1885  HeapIterator iterator(heap_, HeapIterator::kFilterUnreachable);
1886  // Heap iteration with filtering must be finished in any case.
1887  for (HeapObject* obj = iterator.next();
1888  obj != NULL;
1889  obj = iterator.next(), progress_->ProgressStep()) {
1890  if (interrupted) continue;
1891 
1892  HeapEntry* heap_entry = GetEntry(obj);
1893  int entry = heap_entry->index();
1894  if ((this->*extractor)(entry, obj)) {
1895  SetInternalReference(obj, entry,
1896  "map", obj->map(), HeapObject::kMapOffset);
1897  // Extract unvisited fields as hidden references and restore tags
1898  // of visited fields.
1899  IndexedReferencesExtractor refs_extractor(this, obj, entry);
1900  obj->Iterate(&refs_extractor);
1901  }
1902 
1903  if (!progress_->ProgressReport(false)) interrupted = true;
1904  }
1905  return interrupted;
1906 }
static const int kMapOffset
Definition: objects.h:1427

References GetEntry(), heap_, v8::internal::HeapObject::kMapOffset, NULL, progress_, v8::internal::SnapshottingProgressReportingInterface::ProgressReport(), v8::internal::SnapshottingProgressReportingInterface::ProgressStep(), and SetInternalReference().

+ Here is the call graph for this function:

◆ MarkAsWeakContainer()

void v8::internal::V8HeapExplorer::MarkAsWeakContainer ( Object object)
private

Definition at line 2184 of file heap-snapshot-generator.cc.

2184  {
2185  if (IsEssentialObject(object) && object->IsFixedArray()) {
2186  weak_containers_.Insert(object);
2187  }
2188 }

References v8::internal::HeapObjectsSet::Insert(), IsEssentialObject(), and weak_containers_.

Referenced by ExtractAllocationSiteReferences(), ExtractJSWeakCollectionReferences(), ExtractMapReferences(), and ExtractPropertyCellReferences().

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

◆ SetContextReference()

void v8::internal::V8HeapExplorer::SetContextReference ( HeapObject parent_obj,
int  parent,
String reference_name,
Object child,
int  field_offset 
)
private

Definition at line 1925 of file heap-snapshot-generator.cc.

1929  {
1930  DCHECK(parent_entry == GetEntry(parent_obj)->index());
1931  HeapEntry* child_entry = GetEntry(child_obj);
1932  if (child_entry != NULL) {
1934  parent_entry,
1935  names_->GetName(reference_name),
1936  child_entry);
1937  IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
1938  }
1939 }
static void MarkVisitedField(HeapObject *obj, int offset)

References DCHECK, filler_, GetEntry(), v8::internal::StringsStorage::GetName(), v8::HeapGraphEdge::kContextVariable, v8::internal::IndexedReferencesExtractor::MarkVisitedField(), names_, NULL, and v8::internal::SnapshotFiller::SetNamedReference().

Referenced by ExtractContextReferences().

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

◆ SetElementReference()

void v8::internal::V8HeapExplorer::SetElementReference ( HeapObject parent_obj,
int  parent,
int  index,
Object child 
)
private

Definition at line 1957 of file heap-snapshot-generator.cc.

1960  {
1961  DCHECK(parent_entry == GetEntry(parent_obj)->index());
1962  HeapEntry* child_entry = GetEntry(child_obj);
1963  if (child_entry != NULL) {
1965  parent_entry,
1966  index,
1967  child_entry);
1968  }
1969 }
void SetIndexedReference(HeapGraphEdge::Type type, int parent, int index, HeapEntry *child_entry)

References DCHECK, filler_, GetEntry(), v8::HeapGraphEdge::kElement, NULL, and v8::internal::SnapshotFiller::SetIndexedReference().

Referenced by ExtractElementReferences().

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

◆ SetGcRootsReference()

void v8::internal::V8HeapExplorer::SetGcRootsReference ( VisitorSynchronization::SyncTag  tag)
private

Definition at line 2105 of file heap-snapshot-generator.cc.

2105  {
2108  snapshot_->gc_roots()->index(),
2109  snapshot_->gc_subroot(tag));
2110 }
HeapEntry * gc_subroot(int index)
void SetIndexedAutoIndexReference(HeapGraphEdge::Type type, int parent, HeapEntry *child_entry)

References filler_, v8::internal::HeapSnapshot::gc_roots(), v8::internal::HeapSnapshot::gc_subroot(), v8::HeapGraphEdge::kElement, v8::internal::SnapshotFiller::SetIndexedAutoIndexReference(), and snapshot_.

Referenced by IterateAndExtractReferences().

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

◆ SetGcSubrootReference()

void v8::internal::V8HeapExplorer::SetGcSubrootReference ( VisitorSynchronization::SyncTag  tag,
bool  is_weak,
Object child 
)
private

Definition at line 2113 of file heap-snapshot-generator.cc.

2114  {
2115  HeapEntry* child_entry = GetEntry(child_obj);
2116  if (child_entry != NULL) {
2117  const char* name = GetStrongGcSubrootName(child_obj);
2118  if (name != NULL) {
2121  snapshot_->gc_subroot(tag)->index(),
2122  name,
2123  child_entry);
2124  } else {
2125  if (is_weak) {
2128  snapshot_->gc_subroot(tag)->index(),
2129  child_entry);
2130  } else {
2133  snapshot_->gc_subroot(tag)->index(),
2134  child_entry);
2135  }
2136  }
2137 
2138  // Add a shortcut to JS global object reference at snapshot root.
2139  if (child_obj->IsNativeContext()) {
2140  Context* context = Context::cast(child_obj);
2141  GlobalObject* global = context->global_object();
2142  if (global->IsJSGlobalObject()) {
2143  bool is_debug_object = false;
2144  is_debug_object = heap_->isolate()->debug()->IsDebugGlobal(global);
2145  if (!is_debug_object && !user_roots_.Contains(global)) {
2146  user_roots_.Insert(global);
2147  SetUserGlobalReference(global);
2148  }
2149  }
2150  }
2151  }
2152 }
bool IsDebugGlobal(GlobalObject *global)
Definition: debug.cc:2384
void SetNamedAutoIndexReference(HeapGraphEdge::Type type, int parent, HeapEntry *child_entry)
const char * GetStrongGcSubrootName(Object *object)
void SetUserGlobalReference(Object *user_global)

References v8::internal::Context::cast(), v8::internal::HeapObjectsSet::Contains(), v8::internal::Isolate::debug(), filler_, v8::internal::HeapSnapshot::gc_subroot(), GetEntry(), GetStrongGcSubrootName(), v8::internal::Context::global_object(), heap_, v8::internal::HeapObjectsSet::Insert(), v8::internal::Debug::IsDebugGlobal(), v8::internal::Heap::isolate(), v8::HeapGraphEdge::kElement, v8::HeapGraphEdge::kInternal, v8::HeapGraphEdge::kWeak, name, NULL, v8::internal::SnapshotFiller::SetIndexedAutoIndexReference(), v8::internal::SnapshotFiller::SetNamedAutoIndexReference(), v8::internal::SnapshotFiller::SetNamedReference(), SetUserGlobalReference(), snapshot_, and user_roots_.

Referenced by v8::internal::RootsReferencesExtractor::FillReferences().

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

◆ SetHiddenReference()

void v8::internal::V8HeapExplorer::SetHiddenReference ( HeapObject parent_obj,
int  parent,
int  index,
Object child 
)
private

Definition at line 2008 of file heap-snapshot-generator.cc.

2011  {
2012  DCHECK(parent_entry == GetEntry(parent_obj)->index());
2013  HeapEntry* child_entry = GetEntry(child_obj);
2014  if (child_entry != NULL && IsEssentialObject(child_obj)) {
2016  parent_entry,
2017  index,
2018  child_entry);
2019  }
2020 }

References DCHECK, filler_, GetEntry(), IsEssentialObject(), v8::HeapGraphEdge::kHidden, NULL, and v8::internal::SnapshotFiller::SetIndexedReference().

Referenced by v8::internal::IndexedReferencesExtractor::VisitPointers().

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

◆ SetInternalReference() [1/2]

void v8::internal::V8HeapExplorer::SetInternalReference ( HeapObject parent_obj,
int  parent,
const char *  reference_name,
Object child,
int  field_offset = -1 
)
private

Definition at line 1972 of file heap-snapshot-generator.cc.

1976  {
1977  DCHECK(parent_entry == GetEntry(parent_obj)->index());
1978  HeapEntry* child_entry = GetEntry(child_obj);
1979  if (child_entry == NULL) return;
1980  if (IsEssentialObject(child_obj)) {
1982  parent_entry,
1983  reference_name,
1984  child_entry);
1985  }
1986  IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
1987 }

References DCHECK, filler_, GetEntry(), IsEssentialObject(), v8::HeapGraphEdge::kInternal, v8::internal::IndexedReferencesExtractor::MarkVisitedField(), NULL, and v8::internal::SnapshotFiller::SetNamedReference().

Referenced by ExtractAccessorInfoReferences(), ExtractAccessorPairReferences(), ExtractAllocationSiteReferences(), ExtractBoxReferences(), ExtractCellReferences(), ExtractCodeCacheReferences(), ExtractCodeReferences(), ExtractFixedArrayReferences(), ExtractInternalReferences(), ExtractJSCollectionReferences(), ExtractJSGlobalProxyReferences(), ExtractJSObjectReferences(), ExtractJSWeakCollectionReferences(), ExtractMapReferences(), ExtractPropertyCellReferences(), ExtractPropertyReferences(), ExtractScriptReferences(), ExtractSharedFunctionInfoReferences(), ExtractStringReferences(), ExtractSymbolReferences(), IterateAndExtractSinglePass(), and v8::internal::IndexedReferencesExtractor::VisitCodeEntry().

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

◆ SetInternalReference() [2/2]

void v8::internal::V8HeapExplorer::SetInternalReference ( HeapObject parent_obj,
int  parent,
int  index,
Object child,
int  field_offset = -1 
)
private

Definition at line 1990 of file heap-snapshot-generator.cc.

1994  {
1995  DCHECK(parent_entry == GetEntry(parent_obj)->index());
1996  HeapEntry* child_entry = GetEntry(child_obj);
1997  if (child_entry == NULL) return;
1998  if (IsEssentialObject(child_obj)) {
2000  parent_entry,
2001  names_->GetName(index),
2002  child_entry);
2003  }
2004  IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
2005 }

References DCHECK, filler_, GetEntry(), v8::internal::StringsStorage::GetName(), IsEssentialObject(), v8::HeapGraphEdge::kInternal, v8::internal::IndexedReferencesExtractor::MarkVisitedField(), names_, NULL, and v8::internal::SnapshotFiller::SetNamedReference().

+ Here is the call graph for this function:

◆ SetNativeBindReference()

void v8::internal::V8HeapExplorer::SetNativeBindReference ( HeapObject parent_obj,
int  parent,
const char *  reference_name,
Object child 
)
private

Definition at line 1942 of file heap-snapshot-generator.cc.

1945  {
1946  DCHECK(parent_entry == GetEntry(parent_obj)->index());
1947  HeapEntry* child_entry = GetEntry(child_obj);
1948  if (child_entry != NULL) {
1950  parent_entry,
1951  reference_name,
1952  child_entry);
1953  }
1954 }

References DCHECK, filler_, GetEntry(), v8::HeapGraphEdge::kShortcut, NULL, and v8::internal::SnapshotFiller::SetNamedReference().

Referenced by ExtractClosureReferences().

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

◆ SetPropertyReference()

void v8::internal::V8HeapExplorer::SetPropertyReference ( HeapObject parent_obj,
int  parent,
Name reference_name,
Object child,
const char *  name_format_string = NULL,
int  field_offset = -1 
)
private

Definition at line 2059 of file heap-snapshot-generator.cc.

2064  {
2065  DCHECK(parent_entry == GetEntry(parent_obj)->index());
2066  HeapEntry* child_entry = GetEntry(child_obj);
2067  if (child_entry != NULL) {
2068  HeapGraphEdge::Type type =
2069  reference_name->IsSymbol() || String::cast(reference_name)->length() > 0
2071  const char* name = name_format_string != NULL && reference_name->IsString()
2072  ? names_->GetFormatted(
2073  name_format_string,
2074  String::cast(reference_name)->ToCString(
2076  names_->GetName(reference_name);
2077 
2078  filler_->SetNamedReference(type,
2079  parent_entry,
2080  name,
2081  child_entry);
2082  IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
2083  }
2084 }
@ DISALLOW_NULLS
Definition: objects.h:8337
@ ROBUST_STRING_TRAVERSAL
Definition: objects.h:8338

References DCHECK, v8::internal::DISALLOW_NULLS, filler_, GetEntry(), v8::internal::StringsStorage::GetFormatted(), v8::internal::StringsStorage::GetName(), v8::HeapGraphEdge::kInternal, v8::HeapGraphEdge::kProperty, v8::internal::IndexedReferencesExtractor::MarkVisitedField(), name, names_, NULL, v8::internal::ROBUST_STRING_TRAVERSAL, and v8::internal::SnapshotFiller::SetNamedReference().

Referenced by ExtractAccessorPairProperty(), ExtractJSObjectReferences(), and ExtractPropertyReferences().

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

◆ SetRootGcRootsReference()

void v8::internal::V8HeapExplorer::SetRootGcRootsReference ( )
private

Definition at line 2087 of file heap-snapshot-generator.cc.

2087  {
2090  snapshot_->root()->index(),
2091  snapshot_->gc_roots());
2092 }

References filler_, v8::internal::HeapSnapshot::gc_roots(), v8::HeapGraphEdge::kElement, v8::internal::HeapSnapshot::root(), v8::internal::SnapshotFiller::SetIndexedAutoIndexReference(), and snapshot_.

Referenced by IterateAndExtractReferences().

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

◆ SetUserGlobalReference()

void v8::internal::V8HeapExplorer::SetUserGlobalReference ( Object user_global)
private

Definition at line 2095 of file heap-snapshot-generator.cc.

2095  {
2096  HeapEntry* child_entry = GetEntry(child_obj);
2097  DCHECK(child_entry != NULL);
2100  snapshot_->root()->index(),
2101  child_entry);
2102 }

References DCHECK, filler_, GetEntry(), v8::HeapGraphEdge::kShortcut, NULL, v8::internal::HeapSnapshot::root(), v8::internal::SnapshotFiller::SetNamedAutoIndexReference(), and snapshot_.

Referenced by SetGcSubrootReference().

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

◆ SetWeakReference() [1/2]

void v8::internal::V8HeapExplorer::SetWeakReference ( HeapObject parent_obj,
int  parent,
const char *  reference_name,
Object child_obj,
int  field_offset 
)
private

Definition at line 2023 of file heap-snapshot-generator.cc.

2027  {
2028  DCHECK(parent_entry == GetEntry(parent_obj)->index());
2029  HeapEntry* child_entry = GetEntry(child_obj);
2030  if (child_entry == NULL) return;
2031  if (IsEssentialObject(child_obj)) {
2033  parent_entry,
2034  reference_name,
2035  child_entry);
2036  }
2037  IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
2038 }

References DCHECK, filler_, GetEntry(), IsEssentialObject(), v8::HeapGraphEdge::kWeak, v8::internal::IndexedReferencesExtractor::MarkVisitedField(), NULL, and v8::internal::SnapshotFiller::SetNamedReference().

Referenced by ExtractCodeReferences(), ExtractFixedArrayReferences(), ExtractJSArrayBufferReferences(), and ExtractJSObjectReferences().

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

◆ SetWeakReference() [2/2]

void v8::internal::V8HeapExplorer::SetWeakReference ( HeapObject parent_obj,
int  parent,
int  index,
Object child_obj,
int  field_offset 
)
private

Definition at line 2041 of file heap-snapshot-generator.cc.

2045  {
2046  DCHECK(parent_entry == GetEntry(parent_obj)->index());
2047  HeapEntry* child_entry = GetEntry(child_obj);
2048  if (child_entry == NULL) return;
2049  if (IsEssentialObject(child_obj)) {
2051  parent_entry,
2052  names_->GetFormatted("%d", index),
2053  child_entry);
2054  }
2055  IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
2056 }

References DCHECK, filler_, GetEntry(), v8::internal::StringsStorage::GetFormatted(), IsEssentialObject(), v8::HeapGraphEdge::kWeak, v8::internal::IndexedReferencesExtractor::MarkVisitedField(), names_, NULL, and v8::internal::SnapshotFiller::SetNamedReference().

+ Here is the call graph for this function:

◆ TagBuiltinCodeObject()

void v8::internal::V8HeapExplorer::TagBuiltinCodeObject ( Code code,
const char *  name 
)

Definition at line 1474 of file heap-snapshot-generator.cc.

1474  {
1475  TagObject(code, names_->GetFormatted("(%s builtin)", name));
1476 }

References v8::internal::StringsStorage::GetFormatted(), name, names_, and TagObject().

Referenced by v8::internal::RootsReferencesExtractor::FillReferences().

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

◆ TagCodeObject()

void v8::internal::V8HeapExplorer::TagCodeObject ( Code code)

Definition at line 1479 of file heap-snapshot-generator.cc.

1479  {
1480  if (code->kind() == Code::STUB) {
1481  TagObject(code, names_->GetFormatted(
1482  "(%s code)", CodeStub::MajorName(
1483  CodeStub::GetMajorKey(code), true)));
1484  }
1485 }

References v8::internal::StringsStorage::GetFormatted(), v8::internal::Code::kind(), names_, v8::internal::STUB, and TagObject().

Referenced by ExtractCodeReferences(), and v8::internal::IndexedReferencesExtractor::VisitCodeEntry().

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

◆ TagGlobalObjects()

void v8::internal::V8HeapExplorer::TagGlobalObjects ( )

Definition at line 2216 of file heap-snapshot-generator.cc.

2216  {
2217  Isolate* isolate = heap_->isolate();
2218  HandleScope scope(isolate);
2219  GlobalObjectsEnumerator enumerator;
2220  isolate->global_handles()->IterateAllRoots(&enumerator);
2221  const char** urls = NewArray<const char*>(enumerator.count());
2222  for (int i = 0, l = enumerator.count(); i < l; ++i) {
2224  HandleScope scope(isolate);
2225  Handle<JSGlobalObject> global_obj = enumerator.at(i);
2227  Utils::ToLocal(Handle<JSObject>::cast(global_obj)));
2228  } else {
2229  urls[i] = NULL;
2230  }
2231  }
2232 
2233  DisallowHeapAllocation no_allocation;
2234  for (int i = 0, l = enumerator.count(); i < l; ++i) {
2235  objects_tags_.SetTag(*enumerator.at(i), urls[i]);
2236  }
2237 
2238  DeleteArray(urls);
2239 }
virtual const char * GetName(Handle< Object > object)=0
Returns name to be used in the heap snapshot for given node.
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
void SetTag(Object *obj, const char *tag)
void DeleteArray(T *array)
Definition: allocation.h:68
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110

References v8::internal::GlobalObjectsEnumerator::at(), v8::internal::GlobalObjectsEnumerator::count(), v8::internal::DeleteArray(), v8::HeapProfiler::ObjectNameResolver::GetName(), v8::internal::Isolate::global_handles(), global_object_name_resolver_, heap_, v8::internal::Heap::isolate(), v8::internal::GlobalHandles::IterateAllRoots(), NULL, objects_tags_, v8::internal::HeapObjectsSet::SetTag(), and v8::Utils::ToLocal().

Referenced by v8::internal::HeapSnapshotGenerator::GenerateSnapshot().

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

◆ TagObject()

void v8::internal::V8HeapExplorer::TagObject ( Object obj,
const char *  tag 
)
private

Definition at line 2174 of file heap-snapshot-generator.cc.

2174  {
2175  if (IsEssentialObject(obj)) {
2176  HeapEntry* entry = GetEntry(obj);
2177  if (entry->name()[0] == '\0') {
2178  entry->set_name(tag);
2179  }
2180  }
2181 }

References GetEntry(), and IsEssentialObject().

Referenced by ExtractCodeCacheReferences(), ExtractCodeReferences(), ExtractContextReferences(), ExtractJSObjectReferences(), ExtractMapReferences(), ExtractPropertyReferences(), ExtractScriptReferences(), ExtractSharedFunctionInfoReferences(), TagBuiltinCodeObject(), and TagCodeObject().

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

Friends And Related Function Documentation

◆ IndexedReferencesExtractor

friend class IndexedReferencesExtractor
friend

Definition at line 460 of file heap-snapshot-generator.h.

◆ RootsReferencesExtractor

friend class RootsReferencesExtractor
friend

Definition at line 461 of file heap-snapshot-generator.h.

Member Data Documentation

◆ filler_

◆ global_object_name_resolver_

v8::HeapProfiler::ObjectNameResolver* v8::internal::V8HeapExplorer::global_object_name_resolver_
private

Definition at line 458 of file heap-snapshot-generator.h.

Referenced by TagGlobalObjects().

◆ heap_

◆ heap_object_map_

HeapObjectsMap* v8::internal::V8HeapExplorer::heap_object_map_
private

Definition at line 451 of file heap-snapshot-generator.h.

Referenced by AddEntry().

◆ names_

◆ objects_tags_

HeapObjectsSet v8::internal::V8HeapExplorer::objects_tags_
private

Definition at line 454 of file heap-snapshot-generator.h.

Referenced by AddEntry(), and TagGlobalObjects().

◆ progress_

SnapshottingProgressReportingInterface* v8::internal::V8HeapExplorer::progress_
private

◆ snapshot_

HeapSnapshot* v8::internal::V8HeapExplorer::snapshot_
private

◆ strong_gc_subroot_names_

HeapObjectsSet v8::internal::V8HeapExplorer::strong_gc_subroot_names_
private

Definition at line 455 of file heap-snapshot-generator.h.

Referenced by GetStrongGcSubrootName().

◆ user_roots_

HeapObjectsSet v8::internal::V8HeapExplorer::user_roots_
private

Definition at line 456 of file heap-snapshot-generator.h.

Referenced by SetGcSubrootReference().

◆ weak_containers_

HeapObjectsSet v8::internal::V8HeapExplorer::weak_containers_
private

Definition at line 457 of file heap-snapshot-generator.h.

Referenced by ExtractFixedArrayReferences(), and MarkAsWeakContainer().


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