66#define V8_V8_PROFILER_H_
77
88#include < limits.h>
9+ #include < memory>
910#include < unordered_set>
1011#include < vector>
12+
1113#include " v8.h" // NOLINT(build/include)
1214
1315/* *
@@ -143,9 +145,8 @@ class V8_EXPORT CpuProfileNode {
143145 unsigned GetHitCount () const ;
144146
145147 /* * Returns function entry UID. */
146- V8_DEPRECATE_SOON (
147- " Use GetScriptId, GetLineNumber, and GetColumnNumber instead." ,
148- unsigned GetCallUid () const );
148+ V8_DEPRECATED (" Use GetScriptId, GetLineNumber, and GetColumnNumber instead." )
149+ unsigned GetCallUid () const ;
149150
150151 /* * Returns id of the node. The id is unique within the tree */
151152 unsigned GetNodeId () const ;
@@ -370,20 +371,6 @@ class V8_EXPORT CpuProfiler {
370371 */
371372 CpuProfile* StopProfiling (Local<String> title);
372373
373- /* *
374- * Force collection of a sample. Must be called on the VM thread.
375- * Recording the forced sample does not contribute to the aggregated
376- * profile statistics.
377- */
378- V8_DEPRECATED (" Use static CollectSample(Isolate*) instead." ,
379- void CollectSample ());
380-
381- /* *
382- * Tells the profiler whether the embedder is idle.
383- */
384- V8_DEPRECATED (" Use Isolate::SetIdle(bool) instead." ,
385- void SetIdle (bool is_idle));
386-
387374 /* *
388375 * Generate more detailed source positions to code objects. This results in
389376 * better results when mapping profiling samples to script source.
@@ -989,7 +976,8 @@ struct HeapStatsUpdate {
989976 V (LazyCompile) \
990977 V (RegExp) \
991978 V (Script) \
992- V(Stub)
979+ V (Stub) \
980+ V (Relocation)
993981
994982/* *
995983 * Note that this enum may be extended in the future. Please include a default
@@ -1022,10 +1010,12 @@ class V8_EXPORT CodeEvent {
10221010 const char * GetComment ();
10231011
10241012 static const char * GetCodeEventTypeName (CodeEventType code_event_type);
1013+
1014+ uintptr_t GetPreviousCodeStartAddress ();
10251015};
10261016
10271017/* *
1028- * Interface to listen to code creation events.
1018+ * Interface to listen to code creation and code relocation events.
10291019 */
10301020class V8_EXPORT CodeEventHandler {
10311021 public:
@@ -1037,9 +1027,26 @@ class V8_EXPORT CodeEventHandler {
10371027 explicit CodeEventHandler (Isolate* isolate);
10381028 virtual ~CodeEventHandler ();
10391029
1030+ /* *
1031+ * Handle is called every time a code object is created or moved. Information
1032+ * about each code event will be available through the `code_event`
1033+ * parameter.
1034+ *
1035+ * When the CodeEventType is kRelocationType, the code for this CodeEvent has
1036+ * moved from `GetPreviousCodeStartAddress()` to `GetCodeStartAddress()`.
1037+ */
10401038 virtual void Handle (CodeEvent* code_event) = 0;
10411039
1040+ /* *
1041+ * Call `Enable()` to starts listening to code creation and code relocation
1042+ * events. These events will be handled by `Handle()`.
1043+ */
10421044 void Enable ();
1045+
1046+ /* *
1047+ * Call `Disable()` to stop listening to code creation and code relocation
1048+ * events.
1049+ */
10431050 void Disable ();
10441051
10451052 private:
0 commit comments