v8-profiler.h | v8-profiler.h | |||
---|---|---|---|---|
skipping to change at line 316 | skipping to change at line 316 | |||
}; | }; | |||
/** | /** | |||
* HeapSnapshots record the state of the JS heap at some moment. | * HeapSnapshots record the state of the JS heap at some moment. | |||
*/ | */ | |||
class V8EXPORT HeapSnapshot { | class V8EXPORT HeapSnapshot { | |||
public: | public: | |||
enum Type { | enum Type { | |||
kFull = 0, // Heap snapshot with all instances and references. | kFull = 0, // Heap snapshot with all instances and references. | |||
kAggregated = 1 // Snapshot doesn't contain individual heap entries, | kAggregated = 1 // Snapshot doesn't contain individual heap entries, | |||
//instead they are grouped by constructor name. | // instead they are grouped by constructor name. | |||
}; | ||||
enum SerializationFormat { | ||||
kJSON = 0 // See format description near 'Serialize' method. | ||||
}; | }; | |||
/** Returns heap snapshot type. */ | /** Returns heap snapshot type. */ | |||
Type GetType() const; | Type GetType() const; | |||
/** Returns heap snapshot UID (assigned by the profiler.) */ | /** Returns heap snapshot UID (assigned by the profiler.) */ | |||
unsigned GetUid() const; | unsigned GetUid() const; | |||
/** Returns heap snapshot title. */ | /** Returns heap snapshot title. */ | |||
Handle<String> GetTitle() const; | Handle<String> GetTitle() const; | |||
/** Returns the root node of the heap graph. */ | /** Returns the root node of the heap graph. */ | |||
const HeapGraphNode* GetRoot() const; | const HeapGraphNode* GetRoot() const; | |||
/** | /** | |||
* Returns a diff between this snapshot and another one. Only snapshots | * Returns a diff between this snapshot and another one. Only snapshots | |||
* of the same type can be compared. | * of the same type can be compared. | |||
*/ | */ | |||
const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; | const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; | |||
/** | ||||
* Prepare a serialized representation of the snapshot. The result | ||||
* is written into the stream provided in chunks of specified size. | ||||
* The total length of the serialized snapshot is unknown in | ||||
* advance, it is can be roughly equal to JS heap size (that means, | ||||
* it can be really big - tens of megabytes). | ||||
* | ||||
* For the JSON format, heap contents are represented as an object | ||||
* with the following structure: | ||||
* | ||||
* { | ||||
* snapshot: {title: "...", uid: nnn}, | ||||
* nodes: [ | ||||
* meta-info (JSON string), | ||||
* nodes themselves | ||||
* ], | ||||
* strings: [strings] | ||||
* } | ||||
* | ||||
* Outgoing node links are stored after each node. Nodes reference string | ||||
s | ||||
* and other nodes by their indexes in corresponding arrays. | ||||
*/ | ||||
void Serialize(OutputStream* stream, SerializationFormat format) const; | ||||
}; | }; | |||
/** | /** | |||
* Interface for controlling heap profiling. | * Interface for controlling heap profiling. | |||
*/ | */ | |||
class V8EXPORT HeapProfiler { | class V8EXPORT HeapProfiler { | |||
public: | public: | |||
/** Returns the number of snapshots taken. */ | /** Returns the number of snapshots taken. */ | |||
static int GetSnapshotsCount(); | static int GetSnapshotsCount(); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 29 lines changed or added | |||
v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 3127 | skipping to change at line 3127 | |||
bool has_lock_; | bool has_lock_; | |||
bool top_level_; | bool top_level_; | |||
static bool active_; | static bool active_; | |||
// Disallow copying and assigning. | // Disallow copying and assigning. | |||
Locker(const Locker&); | Locker(const Locker&); | |||
void operator=(const Locker&); | void operator=(const Locker&); | |||
}; | }; | |||
/** | ||||
* An interface for exporting data from V8, using "push" model. | ||||
*/ | ||||
class V8EXPORT OutputStream { | ||||
public: | ||||
enum OutputEncoding { | ||||
kAscii = 0 // 7-bit ASCII. | ||||
}; | ||||
enum WriteResult { | ||||
kContinue = 0, | ||||
kAbort = 1 | ||||
}; | ||||
virtual ~OutputStream() {} | ||||
/** Notify about the end of stream. */ | ||||
virtual void EndOfStream() = 0; | ||||
/** Get preferred output chunk size. Called only once. */ | ||||
virtual int GetChunkSize() { return 1024; } | ||||
/** Get preferred output encoding. Called only once. */ | ||||
virtual OutputEncoding GetOutputEncoding() { return kAscii; } | ||||
/** | ||||
* Writes the next chunk of snapshot data into the stream. Writing | ||||
* can be stopped by returning kAbort as function result. EndOfStream | ||||
* will not be called in case writing was aborted. | ||||
*/ | ||||
virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; | ||||
}; | ||||
// --- I m p l e m e n t a t i o n --- | // --- I m p l e m e n t a t i o n --- | |||
namespace internal { | namespace internal { | |||
// Tag information for HeapObject. | // Tag information for HeapObject. | |||
const int kHeapObjectTag = 1; | const int kHeapObjectTag = 1; | |||
const int kHeapObjectTagSize = 2; | const int kHeapObjectTagSize = 2; | |||
const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; | const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; | |||
// Tag information for Smi. | // Tag information for Smi. | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 27 lines changed or added | |||