| v8-profiler.h | | v8-profiler.h | |
| | | | |
| skipping to change at line 240 | | skipping to change at line 240 | |
| /** Returns destination node. */ | | /** Returns destination node. */ | |
| const HeapGraphNode* GetToNode() const; | | const HeapGraphNode* GetToNode() const; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * HeapGraphNode represents a node in a heap graph. | | * HeapGraphNode represents a node in a heap graph. | |
| */ | | */ | |
| class V8EXPORT HeapGraphNode { | | class V8EXPORT HeapGraphNode { | |
| public: | | public: | |
| enum Type { | | enum Type { | |
|
| kHidden = 0, // Hidden node, may be filtered when shown to user. | | kHidden = 0, // Hidden node, may be filtered when shown to user. | |
| kArray = 1, // An array of elements. | | kArray = 1, // An array of elements. | |
| kString = 2, // A string. | | kString = 2, // A string. | |
| kObject = 3, // A JS object (except for arrays and strings). | | kObject = 3, // A JS object (except for arrays and strings). | |
| kCode = 4, // Compiled code. | | kCode = 4, // Compiled code. | |
| kClosure = 5, // Function closure. | | kClosure = 5, // Function closure. | |
| kRegExp = 6, // RegExp. | | kRegExp = 6, // RegExp. | |
| kHeapNumber = 7 // Number stored in the heap. | | kHeapNumber = 7, // Number stored in the heap. | |
| | | kNative = 8 // Native object (not from V8 heap). | |
| }; | | }; | |
| | | | |
| /** Returns node type (see HeapGraphNode::Type). */ | | /** Returns node type (see HeapGraphNode::Type). */ | |
| Type GetType() const; | | Type GetType() const; | |
| | | | |
| /** | | /** | |
| * Returns node name. Depending on node's type this can be the name | | * Returns node name. Depending on node's type this can be the name | |
| * of the constructor (for objects), the name of the function (for | | * of the constructor (for objects), the name of the function (for | |
| * closures), string value, or an empty string (for compiled code). | | * closures), string value, or an empty string (for compiled code). | |
| */ | | */ | |
| | | | |
| skipping to change at line 384 | | skipping to change at line 385 | |
| * ], | | * ], | |
| * strings: [strings] | | * strings: [strings] | |
| * } | | * } | |
| * | | * | |
| * Outgoing node links are stored after each node. Nodes reference string
s | | * Outgoing node links are stored after each node. Nodes reference string
s | |
| * and other nodes by their indexes in corresponding arrays. | | * and other nodes by their indexes in corresponding arrays. | |
| */ | | */ | |
| void Serialize(OutputStream* stream, SerializationFormat format) const; | | void Serialize(OutputStream* stream, SerializationFormat format) const; | |
| }; | | }; | |
| | | | |
|
| | | class RetainedObjectInfo; | |
| | | | |
| /** | | /** | |
| * Interface for controlling heap profiling. | | * Interface for controlling heap profiling. | |
| */ | | */ | |
| class V8EXPORT HeapProfiler { | | class V8EXPORT HeapProfiler { | |
| public: | | public: | |
|
| | | /** | |
| | | * Callback function invoked for obtaining RetainedObjectInfo for | |
| | | * the given JavaScript wrapper object. It is prohibited to enter V8 | |
| | | * while the callback is running: only getters on the handle and | |
| | | * GetPointerFromInternalField on the objects are allowed. | |
| | | */ | |
| | | typedef RetainedObjectInfo* (*WrapperInfoCallback) | |
| | | (uint16_t class_id, Handle<Value> wrapper); | |
| | | | |
| /** Returns the number of snapshots taken. */ | | /** Returns the number of snapshots taken. */ | |
| static int GetSnapshotsCount(); | | static int GetSnapshotsCount(); | |
| | | | |
| /** Returns a snapshot by index. */ | | /** Returns a snapshot by index. */ | |
| static const HeapSnapshot* GetSnapshot(int index); | | static const HeapSnapshot* GetSnapshot(int index); | |
| | | | |
| /** Returns a profile by uid. */ | | /** Returns a profile by uid. */ | |
| static const HeapSnapshot* FindSnapshot(unsigned uid); | | static const HeapSnapshot* FindSnapshot(unsigned uid); | |
| | | | |
| /** | | /** | |
| * Takes a heap snapshot and returns it. Title may be an empty string. | | * Takes a heap snapshot and returns it. Title may be an empty string. | |
| * See HeapSnapshot::Type for types description. | | * See HeapSnapshot::Type for types description. | |
| */ | | */ | |
| static const HeapSnapshot* TakeSnapshot( | | static const HeapSnapshot* TakeSnapshot( | |
| Handle<String> title, | | Handle<String> title, | |
| HeapSnapshot::Type type = HeapSnapshot::kFull, | | HeapSnapshot::Type type = HeapSnapshot::kFull, | |
| ActivityControl* control = NULL); | | ActivityControl* control = NULL); | |
|
| | | | |
| | | /** Binds a callback to embedder's class ID. */ | |
| | | static void DefineWrapperClass( | |
| | | uint16_t class_id, | |
| | | WrapperInfoCallback callback); | |
| | | | |
| | | /** | |
| | | * Default value of persistent handle class ID. Must not be used to | |
| | | * define a class. Can be used to reset a class of a persistent | |
| | | * handle. | |
| | | */ | |
| | | static const uint16_t kPersistentHandleNoClassId = 0; | |
| | | }; | |
| | | | |
| | | /** | |
| | | * Interface for providing information about embedder's objects | |
| | | * held by global handles. This information is reported in two ways: | |
| | | * | |
| | | * 1. When calling AddObjectGroup, an embedder may pass | |
| | | * RetainedObjectInfo instance describing the group. To collect | |
| | | * this information while taking a heap snapshot, V8 calls GC | |
| | | * prologue and epilogue callbacks. | |
| | | * | |
| | | * 2. When a heap snapshot is collected, V8 additionally | |
| | | * requests RetainedObjectInfos for persistent handles that | |
| | | * were not previously reported via AddObjectGroup. | |
| | | * | |
| | | * Thus, if an embedder wants to provide information about native | |
| | | * objects for heap snapshots, he can do it in a GC prologue | |
| | | * handler, and / or by assigning wrapper class ids in the following way: | |
| | | * | |
| | | * 1. Bind a callback to class id by calling DefineWrapperClass. | |
| | | * 2. Call SetWrapperClassId on certain persistent handles. | |
| | | * | |
| | | * V8 takes ownership of RetainedObjectInfo instances passed to it and | |
| | | * keeps them alive only during snapshot collection. Afterwards, they | |
| | | * are freed by calling the Dispose class function. | |
| | | */ | |
| | | class V8EXPORT RetainedObjectInfo { // NOLINT | |
| | | public: | |
| | | /** Called by V8 when it no longer needs an instance. */ | |
| | | virtual void Dispose() = 0; | |
| | | | |
| | | /** Returns whether two instances are equivalent. */ | |
| | | virtual bool IsEquivalent(RetainedObjectInfo* other) = 0; | |
| | | | |
| | | /** | |
| | | * Returns hash value for the instance. Equivalent instances | |
| | | * must have the same hash value. | |
| | | */ | |
| | | virtual intptr_t GetHash() = 0; | |
| | | | |
| | | /** | |
| | | * Returns human-readable label. It must be a NUL-terminated UTF-8 | |
| | | * encoded string. V8 copies its contents during a call to GetLabel. | |
| | | */ | |
| | | virtual const char* GetLabel() = 0; | |
| | | | |
| | | /** | |
| | | * Returns element count in case if a global handle retains | |
| | | * a subgraph by holding one of its nodes. | |
| | | */ | |
| | | virtual intptr_t GetElementCount() { return -1; } | |
| | | | |
| | | /** Returns embedder's object size in bytes. */ | |
| | | virtual intptr_t GetSizeInBytes() { return -1; } | |
| | | | |
| | | protected: | |
| | | RetainedObjectInfo() {} | |
| | | virtual ~RetainedObjectInfo() {} | |
| | | | |
| | | private: | |
| | | RetainedObjectInfo(const RetainedObjectInfo&); | |
| | | RetainedObjectInfo& operator=(const RetainedObjectInfo&); | |
| }; | | }; | |
| | | | |
| } // namespace v8 | | } // namespace v8 | |
| | | | |
| #undef V8EXPORT | | #undef V8EXPORT | |
| | | | |
| #endif // V8_V8_PROFILER_H_ | | #endif // V8_V8_PROFILER_H_ | |
| | | | |
End of changes. 4 change blocks. |
| 8 lines changed or deleted | | 94 lines changed or added | |
|
| v8.h | | v8.h | |
| | | | |
| skipping to change at line 394 | | skipping to change at line 394 | |
| /** | | /** | |
| *Checks if the handle holds the only reference to an object. | | *Checks if the handle holds the only reference to an object. | |
| */ | | */ | |
| inline bool IsNearDeath() const; | | inline bool IsNearDeath() const; | |
| | | | |
| /** | | /** | |
| * Returns true if the handle's reference is weak. | | * Returns true if the handle's reference is weak. | |
| */ | | */ | |
| inline bool IsWeak() const; | | inline bool IsWeak() const; | |
| | | | |
|
| | | /** | |
| | | * Assigns a wrapper class ID to the handle. See RetainedObjectInfo | |
| | | * interface description in v8-profiler.h for details. | |
| | | */ | |
| | | inline void SetWrapperClassId(uint16_t class_id); | |
| | | | |
| private: | | private: | |
| friend class ImplementationUtilities; | | friend class ImplementationUtilities; | |
| friend class ObjectTemplate; | | friend class ObjectTemplate; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * A stack-allocated class that governs a number of local handles. | | * A stack-allocated class that governs a number of local handles. | |
| * After a handle scope has been created, all local handles will be | | * After a handle scope has been created, all local handles will be | |
| * allocated within that handle scope until either the handle scope is | | * allocated within that handle scope until either the handle scope is | |
| * deleted or another handle scope is created. If there is already a | | * deleted or another handle scope is created. If there is already a | |
| | | | |
| skipping to change at line 2471 | | skipping to change at line 2477 | |
| void set_heap_size_limit(size_t size) { heap_size_limit_ = size; } | | void set_heap_size_limit(size_t size) { heap_size_limit_ = size; } | |
| | | | |
| size_t total_heap_size_; | | size_t total_heap_size_; | |
| size_t total_heap_size_executable_; | | size_t total_heap_size_executable_; | |
| size_t used_heap_size_; | | size_t used_heap_size_; | |
| size_t heap_size_limit_; | | size_t heap_size_limit_; | |
| | | | |
| friend class V8; | | friend class V8; | |
| }; | | }; | |
| | | | |
|
| | | class RetainedObjectInfo; | |
| | | | |
| /** | | /** | |
| * Container class for static utility functions. | | * Container class for static utility functions. | |
| */ | | */ | |
| class V8EXPORT V8 { | | class V8EXPORT V8 { | |
| public: | | public: | |
| /** Set the callback to invoke in case of fatal errors. */ | | /** Set the callback to invoke in case of fatal errors. */ | |
| static void SetFatalErrorHandler(FatalErrorCallback that); | | static void SetFatalErrorHandler(FatalErrorCallback that); | |
| | | | |
| /** | | /** | |
| * Ignore out-of-memory exceptions. | | * Ignore out-of-memory exceptions. | |
| | | | |
| skipping to change at line 2640 | | skipping to change at line 2648 | |
| */ | | */ | |
| static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callb
ack); | | static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callb
ack); | |
| | | | |
| /** | | /** | |
| * Allows the host application to group objects together. If one | | * Allows the host application to group objects together. If one | |
| * object in the group is alive, all objects in the group are alive. | | * object in the group is alive, all objects in the group are alive. | |
| * After each garbage collection, object groups are removed. It is | | * After each garbage collection, object groups are removed. It is | |
| * intended to be used in the before-garbage-collection callback | | * intended to be used in the before-garbage-collection callback | |
| * function, for instance to simulate DOM tree connections among JS | | * function, for instance to simulate DOM tree connections among JS | |
| * wrapper objects. | | * wrapper objects. | |
|
| | | * See v8-profiler.h for RetainedObjectInfo interface description. | |
| */ | | */ | |
|
| static void AddObjectGroup(Persistent<Value>* objects, size_t length); | | static void AddObjectGroup(Persistent<Value>* objects, | |
| | | size_t length, | |
| | | RetainedObjectInfo* info = NULL); | |
| | | | |
| /** | | /** | |
| * Initializes from snapshot if possible. Otherwise, attempts to | | * Initializes from snapshot if possible. Otherwise, attempts to | |
| * initialize from scratch. This function is called implicitly if | | * initialize from scratch. This function is called implicitly if | |
| * you use the API without calling it first. | | * you use the API without calling it first. | |
| */ | | */ | |
| static bool Initialize(); | | static bool Initialize(); | |
| | | | |
| /** | | /** | |
| * Adjusts the amount of registered external memory. Used to give | | * Adjusts the amount of registered external memory. Used to give | |
| | | | |
| skipping to change at line 2850 | | skipping to change at line 2861 | |
| V8(); | | V8(); | |
| | | | |
| static internal::Object** GlobalizeReference(internal::Object** handle); | | static internal::Object** GlobalizeReference(internal::Object** handle); | |
| static void DisposeGlobal(internal::Object** global_handle); | | static void DisposeGlobal(internal::Object** global_handle); | |
| static void MakeWeak(internal::Object** global_handle, | | static void MakeWeak(internal::Object** global_handle, | |
| void* data, | | void* data, | |
| WeakReferenceCallback); | | WeakReferenceCallback); | |
| static void ClearWeak(internal::Object** global_handle); | | static void ClearWeak(internal::Object** global_handle); | |
| static bool IsGlobalNearDeath(internal::Object** global_handle); | | static bool IsGlobalNearDeath(internal::Object** global_handle); | |
| static bool IsGlobalWeak(internal::Object** global_handle); | | static bool IsGlobalWeak(internal::Object** global_handle); | |
|
| | | static void SetWrapperClassId(internal::Object** global_handle, | |
| | | uint16_t class_id); | |
| | | | |
| template <class T> friend class Handle; | | template <class T> friend class Handle; | |
| template <class T> friend class Local; | | template <class T> friend class Local; | |
| template <class T> friend class Persistent; | | template <class T> friend class Persistent; | |
| friend class Context; | | friend class Context; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * An external exception handler. | | * An external exception handler. | |
| */ | | */ | |
| | | | |
| skipping to change at line 3480 | | skipping to change at line 3493 | |
| V8::MakeWeak(reinterpret_cast<internal::Object**>(**this), | | V8::MakeWeak(reinterpret_cast<internal::Object**>(**this), | |
| parameters, | | parameters, | |
| callback); | | callback); | |
| } | | } | |
| | | | |
| template <class T> | | template <class T> | |
| void Persistent<T>::ClearWeak() { | | void Persistent<T>::ClearWeak() { | |
| V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); | | V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); | |
| } | | } | |
| | | | |
|
| | | template <class T> | |
| | | void Persistent<T>::SetWrapperClassId(uint16_t class_id) { | |
| | | V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class | |
| | | _id); | |
| | | } | |
| | | | |
| Arguments::Arguments(internal::Object** implicit_args, | | Arguments::Arguments(internal::Object** implicit_args, | |
| internal::Object** values, int length, | | internal::Object** values, int length, | |
| bool is_construct_call) | | bool is_construct_call) | |
| : implicit_args_(implicit_args), | | : implicit_args_(implicit_args), | |
| values_(values), | | values_(values), | |
| length_(length), | | length_(length), | |
| is_construct_call_(is_construct_call) { } | | is_construct_call_(is_construct_call) { } | |
| | | | |
| Local<Value> Arguments::operator[](int i) const { | | Local<Value> Arguments::operator[](int i) const { | |
| if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); | | if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); | |
| | | | |
End of changes. 6 change blocks. |
| 1 lines changed or deleted | | 20 lines changed or added | |
|