5 #ifndef V8_HEAP_SNAPSHOT_GENERATOR_H_
6 #define V8_HEAP_SNAPSHOT_GENERATOR_H_
13 class AllocationTracker;
14 class AllocationTraceNode;
38 DCHECK(type_ == kElement || type_ == kHidden);
42 DCHECK(type_ == kContextVariable
50 HeapEntry*
to()
const {
return to_entry_; }
97 unsigned trace_node_id);
101 const char*
name() {
return name_; }
108 INLINE(
int set_children_index(
int index));
110 children_arr()[children_count_++] = edge;
121 const char* prefix,
const char* edge_name,
int max_depth,
int indent);
172 unsigned trace_node_id);
178 void Print(
int max_depth);
213 bool accessed =
true);
359 template<V8HeapExplorer::ExtractReferencesMethod extractor>
401 const char* reference_name,
409 const char* reference_name,
411 int field_offset = -1);
416 int field_offset = -1);
423 const char* reference_name,
433 Name* reference_name,
435 const char* name_format_string =
NULL,
436 int field_offset = -1);
495 return key1 == key2 ||
499 INLINE(
static bool StringsMatch(
void* key1,
void* key2)) {
500 return strcmp(
reinterpret_cast<char*
>(key1),
501 reinterpret_cast<char*
>(key2)) == 0;
570 INLINE(
static bool StringsMatch(
void* key1,
void* key2)) {
571 return strcmp(
reinterpret_cast<char*
>(key1),
572 reinterpret_cast<char*
>(key2)) == 0;
576 const char* s =
reinterpret_cast<const char*
>(string);
577 int len =
static_cast<int>(strlen(s));
An interface for reporting progress and controlling long-running activities.
HeapSnapshotEdge represents a directed connection between heap graph nodes: from retainers to retaine...
Callback interface for retrieving user friendly names of global objects.
An interface for exporting data from V8, using "push" model.
Interface for providing information about embedder's objects held by global handles.
virtual intptr_t GetHash()=0
Returns hash value for the instance.
INLINE(HeapSnapshot *snapshot() const)
INLINE(int index() const)
int children_count() const
HeapSnapshot * snapshot()
INLINE(HeapGraphEdge **children_arr())
INLINE(int set_children_index(int index))
void ReplaceToIndexWithEntry(HeapSnapshot *snapshot)
HeapGraphEdge(Type type, int index, int from, int to)
void Print(const char *prefix, const char *edge_name, int max_depth, int indent)
void SetIndexedReference(HeapGraphEdge::Type type, int index, HeapEntry *entry)
void add_child(HeapGraphEdge *edge)
INLINE(HeapEntry *from() const)
void set_name(const char *name)
void SetNamedReference(HeapGraphEdge::Type type, const char *name, HeapEntry *entry)
HeapGraphEdge(Type type, const char *name, int from, int to)
Vector< HeapGraphEdge * > children()
static const int kNoEntry
const char * name() const
const char * TypeAsString()
HeapEntry(HeapSnapshot *snapshot, Type type, const char *name, SnapshotObjectId id, size_t self_size, unsigned trace_node_id)
unsigned trace_node_id() const
virtual HeapEntry * AllocateEntry(HeapThing ptr)=0
virtual ~HeapEntriesAllocator()
void Pair(HeapThing thing, int entry)
static uint32_t Hash(HeapThing thing)
DISALLOW_COPY_AND_ASSIGN(HeapEntriesMap)
static const SnapshotObjectId kFirstAvailableObjectId
static const SnapshotObjectId kInternalRootObjectId
SnapshotObjectId FindOrAddEntry(Address addr, unsigned int size, bool accessed=true)
static const int kObjectIdStep
static const SnapshotObjectId kGcRootsFirstSubrootId
void UpdateObjectSize(Address addr, int size)
SnapshotObjectId GenerateId(v8::RetainedObjectInfo *info)
List< TimeInterval > time_intervals_
bool MoveObject(Address from, Address to, int size)
SnapshotObjectId last_assigned_id() const
int FindUntrackedObjects()
void StopHeapObjectsTracking()
size_t GetUsedMemorySize() const
SnapshotObjectId next_id_
SnapshotObjectId FindEntry(Address addr)
DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap)
static const SnapshotObjectId kGcRootsObjectId
List< EntryInfo > entries_
HeapObjectsMap(Heap *heap)
SnapshotObjectId PushHeapObjectsStats(OutputStream *stream)
void UpdateHeapObjectsMap()
bool Contains(Object *object)
void SetTag(Object *obj, const char *tag)
DISALLOW_COPY_AND_ASSIGN(HeapObjectsSet)
const char * GetTag(Object *obj)
HeapSnapshotGenerator(HeapSnapshot *snapshot, v8::ActivityControl *control, v8::HeapProfiler::ObjectNameResolver *resolver, Heap *heap)
NativeObjectsExplorer dom_explorer_
void SetProgressTotal(int iterations_count)
bool ProgressReport(bool force=false)
DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator)
V8HeapExplorer v8_heap_explorer_
v8::ActivityControl * control_
void SerializeTraceNode(AllocationTraceNode *node)
void Serialize(v8::OutputStream *stream)
void SerializeTraceNodeInfos()
void SerializeTraceTree()
void SerializeNode(HeapEntry *entry)
INLINE(static bool StringsMatch(void *key1, void *key2))
void SerializeEdge(HeapGraphEdge *edge, bool first_edge)
INLINE(static uint32_t StringHash(const void *string))
int entry_index(HeapEntry *e)
OutputStreamWriter * writer_
friend class HeapSnapshotJSONSerializerIterator
static const int kEdgeFieldsCount
friend class HeapSnapshotJSONSerializerEnumerator
static const int kNodeFieldsCount
void SerializeString(const unsigned char *s)
HeapSnapshotJSONSerializer(HeapSnapshot *snapshot)
int GetStringId(const char *s)
DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer)
List< HeapGraphEdge * > children_
void AddSyntheticRootEntries()
HeapEntry * AddGcRootsEntry()
HeapProfiler * profiler()
int gc_subroot_indexes_[VisitorSynchronization::kNumberOfSyncTags]
SnapshotObjectId max_snapshot_js_object_id_
SnapshotObjectId max_snapshot_js_object_id() const
void Print(int max_depth)
size_t RawSnapshotSize() const
List< HeapEntry > & entries()
List< HeapGraphEdge * > & children()
HeapEntry * AddRootEntry()
DISALLOW_COPY_AND_ASSIGN(HeapSnapshot)
void RememberLastJSObjectId()
List< HeapEntry * > sorted_entries_
List< HeapEntry * > * GetSortedEntriesList()
HeapEntry * AddEntry(HeapEntry::Type type, const char *name, SnapshotObjectId id, size_t size, unsigned trace_node_id)
List< HeapGraphEdge > & edges()
HeapEntry * GetEntryById(SnapshotObjectId id)
friend class HeapSnapshotTester
List< HeapGraphEdge > edges_
List< HeapEntry > entries_
HeapSnapshot(HeapProfiler *profiler, const char *title, unsigned uid)
HeapEntry * gc_subroot(int index)
HeapEntry * AddGcSubrootEntry(int tag, SnapshotObjectId id)
bool IterateAndExtractReferences(SnapshotFiller *filler)
static uint32_t InfoHash(v8::RetainedObjectInfo *info)
HeapObjectsSet in_groups_
void SetNativeRootReference(v8::RetainedObjectInfo *info)
void SetRootNativeRootsReference()
HeapEntriesAllocator * synthetic_entries_allocator_
void FillImplicitReferences()
static bool RetainedInfosMatch(void *key1, void *key2)
static HeapThing const kNativesRootObject
int EstimateObjectsCount()
SnapshottingProgressReportingInterface * progress_
INLINE(static bool StringsMatch(void *key1, void *key2))
NativeObjectsExplorer(HeapSnapshot *snapshot, SnapshottingProgressReportingInterface *progress)
HeapEntriesAllocator * native_entries_allocator_
NativeGroupRetainedObjectInfo * FindOrAddGroupInfo(const char *label)
void SetWrapperNativeReferences(HeapObject *wrapper, v8::RetainedObjectInfo *info)
void AddRootEntries(SnapshotFiller *filler)
void VisitSubtreeWrapper(Object **p, uint16_t class_id)
DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer)
List< HeapObject * > * GetListMaybeDisposeInfo(v8::RetainedObjectInfo *info)
void FillRetainedObjects()
virtual ~NativeObjectsExplorer()
virtual bool ProgressReport(bool force)=0
virtual ~SnapshottingProgressReportingInterface()
virtual void ProgressStep()=0
static uint32_t HashSequentialString(const schar *chars, int length, uint32_t seed)
uint32_t occupancy() const
void TagCodeObject(Code *code)
virtual HeapEntry * AllocateEntry(HeapThing ptr)
void SetContextReference(HeapObject *parent_obj, int parent, String *reference_name, Object *child, int field_offset)
void ExtractFixedArrayReferences(int entry, FixedArray *array)
HeapObjectsMap * heap_object_map_
void ExtractBoxReferences(int entry, Box *box)
void ExtractMapReferences(int entry, Map *map)
void AddRootEntries(SnapshotFiller *filler)
bool IterateAndExtractReferences(SnapshotFiller *filler)
void SetNativeBindReference(HeapObject *parent_obj, int parent, const char *reference_name, Object *child)
void SetGcSubrootReference(VisitorSynchronization::SyncTag tag, bool is_weak, Object *child)
const char * GetStrongGcSubrootName(Object *object)
HeapObjectsSet weak_containers_
V8HeapExplorer(HeapSnapshot *snapshot, SnapshottingProgressReportingInterface *progress, v8::HeapProfiler::ObjectNameResolver *resolver)
HeapObjectsSet objects_tags_
void SetInternalReference(HeapObject *parent_obj, int parent, const char *reference_name, Object *child, int field_offset=-1)
void SetWeakReference(HeapObject *parent_obj, int parent, const char *reference_name, Object *child_obj, int field_offset)
SnapshottingProgressReportingInterface * progress_
void ExtractJSObjectReferences(int entry, JSObject *js_obj)
void SetGcRootsReference(VisitorSynchronization::SyncTag tag)
void SetElementReference(HeapObject *parent_obj, int parent, int index, Object *child)
void SetPropertyReference(HeapObject *parent_obj, int parent, Name *reference_name, Object *child, const char *name_format_string=NULL, int field_offset=-1)
HeapEntry * GetEntry(Object *obj)
bool IterateAndExtractSinglePass()
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 MarkAsWeakContainer(Object *object)
void ExtractJSArrayBufferReferences(int entry, JSArrayBuffer *buffer)
bool ExtractReferencesPass2(int entry, HeapObject *obj)
void ExtractCodeCacheReferences(int entry, CodeCache *code_cache)
bool ExtractReferencesPass1(int entry, HeapObject *obj)
static String * GetConstructorName(JSObject *object)
virtual ~V8HeapExplorer()
void ExtractStringReferences(int entry, String *obj)
void ExtractCellReferences(int entry, Cell *cell)
void ExtractClosureReferences(JSObject *js_obj, int entry)
v8::HeapProfiler::ObjectNameResolver * global_object_name_resolver_
void ExtractScriptReferences(int entry, Script *script)
bool ExtractAccessorPairProperty(JSObject *js_obj, int entry, Object *key, Object *callback_obj)
const char * GetSystemEntryName(HeapObject *object)
bool(V8HeapExplorer::* ExtractReferencesMethod)(int entry, HeapObject *object)
void SetRootGcRootsReference()
void ExtractSymbolReferences(int entry, Symbol *symbol)
void SetHiddenReference(HeapObject *parent_obj, int parent, int index, Object *child)
void SetUserGlobalReference(Object *user_global)
void ExtractElementReferences(JSObject *js_obj, int entry)
void ExtractContextReferences(int entry, Context *context)
void ExtractInternalReferences(JSObject *js_obj, int entry)
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)
HeapEntry * AddEntry(Address address, HeapEntry::Type type, const char *name, size_t size)
DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer)
HeapObjectsSet user_roots_
void TagBuiltinCodeObject(Code *code, const char *name)
void ExtractPropertyCellReferences(int entry, PropertyCell *cell)
void ExtractPropertyReferences(JSObject *js_obj, int entry)
void TagObject(Object *obj, const char *tag)
bool IsEssentialObject(Object *object)
int EstimateObjectsCount(HeapIterator *iterator)
HeapObjectsSet strong_gc_subroot_names_
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object 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 A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
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
enable harmony numeric enable harmony object literal extensions true
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
#define DCHECK(condition)
TypeImpl< ZoneTypeConfig > Type
static const uint32_t kZeroHashSeed
uint32_t ComputeIntegerHash(uint32_t key, uint32_t seed)
Debugger support for the V8 JavaScript engine.
EntryInfo(SnapshotObjectId id, Address addr, unsigned int size, bool accessed)
EntryInfo(SnapshotObjectId id, Address addr, unsigned int size)
TimeInterval(SnapshotObjectId id)