V8 Project
heap-profiler.h
Go to the documentation of this file.
1 // Copyright 2009-2010 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_HEAP_PROFILER_H_
6 #define V8_HEAP_PROFILER_H_
7 
9 #include "src/isolate.h"
10 #include "src/smart-pointers.h"
11 
12 namespace v8 {
13 namespace internal {
14 
15 class HeapSnapshot;
16 
17 class HeapProfiler {
18  public:
19  explicit HeapProfiler(Heap* heap);
20  ~HeapProfiler();
21 
23 
25  const char* name,
26  v8::ActivityControl* control,
29  String* name,
30  v8::ActivityControl* control,
32 
33  void StartHeapObjectsTracking(bool track_allocations);
36  return allocation_tracker_.get();
37  }
38  HeapObjectsMap* heap_object_map() const { return ids_.get(); }
39  StringsStorage* names() const { return names_.get(); }
40 
42  int GetSnapshotsCount();
43  HeapSnapshot* GetSnapshot(int index);
45  void DeleteAllSnapshots();
47 
48  void ObjectMoveEvent(Address from, Address to, int size);
49 
50  void AllocationEvent(Address addr, int size);
51 
52  void UpdateObjectSizeEvent(Address addr, int size);
53 
54  void DefineWrapperClass(
56 
58  Object** wrapper);
60 
62  bool is_tracking_allocations() const {
63  return !allocation_tracker_.is_empty();
64  }
65 
67  void ClearHeapObjectMap();
68 
69  private:
70  Heap* heap() const { return ids_->heap(); }
71 
72  // Mapping from HeapObject addresses to objects' uids.
80 };
81 
82 } } // namespace v8::internal
83 
84 #endif // V8_HEAP_PROFILER_H_
An interface for reporting progress and controlling long-running activities.
Definition: v8-profiler.h:371
Callback interface for retrieving user friendly names of global objects.
Definition: v8-profiler.h:436
RetainedObjectInfo *(* WrapperInfoCallback)(uint16_t class_id, Handle< Value > wrapper)
Callback function invoked for obtaining RetainedObjectInfo for the given JavaScript wrapper object.
Definition: v8-profiler.h:399
An interface for exporting data from V8, using "push" model.
Definition: v8-profiler.h:272
Interface for providing information about embedder's objects held by global handles.
Definition: v8-profiler.h:545
General purpose unique identifier.
Definition: v8.h:144
HeapSnapshot * TakeSnapshot(const char *name, v8::ActivityControl *control, v8::HeapProfiler::ObjectNameResolver *resolver)
SmartPointer< HeapObjectsMap > ids_
Definition: heap-profiler.h:73
SmartPointer< StringsStorage > names_
Definition: heap-profiler.h:75
StringsStorage * names() const
Definition: heap-profiler.h:39
v8::RetainedObjectInfo * ExecuteWrapperClassCallback(uint16_t class_id, Object **wrapper)
List< v8::HeapProfiler::WrapperInfoCallback > wrapper_callbacks_
Definition: heap-profiler.h:77
SmartPointer< AllocationTracker > allocation_tracker_
Definition: heap-profiler.h:78
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo *info)
void DefineWrapperClass(uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback)
void AllocationEvent(Address addr, int size)
HeapObjectsMap * heap_object_map() const
Definition: heap-profiler.h:38
HeapSnapshot * GetSnapshot(int index)
void StartHeapObjectsTracking(bool track_allocations)
SnapshotObjectId PushHeapObjectsStats(OutputStream *stream)
void RemoveSnapshot(HeapSnapshot *snapshot)
Handle< HeapObject > FindHeapObjectById(SnapshotObjectId id)
bool is_tracking_object_moves() const
Definition: heap-profiler.h:61
SnapshotObjectId GetSnapshotObjectId(Handle< Object > obj)
void ObjectMoveEvent(Address from, Address to, int size)
AllocationTracker * allocation_tracker() const
Definition: heap-profiler.h:35
bool is_tracking_allocations() const
Definition: heap-profiler.h:62
List< HeapSnapshot * > snapshots_
Definition: heap-profiler.h:74
void UpdateObjectSizeEvent(Address addr, int 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 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 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
unsigned short uint16_t
Definition: unicode.cc:23
byte * Address
Definition: globals.h:101
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20