5#ifndef V8_LOGGING_CODE_EVENTS_H_
6#define V8_LOGGING_CODE_EVENTS_H_
25class SharedFunctionInfo;
33#define LOG_EVENT_LIST(V) \
34 V(kCodeCreation, "code-creation") \
35 V(kCodeDisableOpt, "code-disable-optimization") \
36 V(kCodeMove, "code-move") \
37 V(kCodeDeopt, "code-deopt") \
38 V(kCodeDelete, "code-delete") \
39 V(kCodeMovingGC, "code-moving-gc") \
40 V(kSharedFuncMove, "sfi-move") \
41 V(kSnapshotCodeName, "snapshot-code-name") \
44#define CODE_TYPE_LIST(V) \
45 V(kBuiltin, Builtin) \
46 V(kCallback, Callback) \
49 V(kHandler, Handler) \
50 V(kBytecodeHandler, BytecodeHandler) \
54 V(kNativeFunction, JS) \
55 V(kNativeScript, Script)
59#define PROFILE(the_isolate, Call) (the_isolate)->logger()->Call;
63#define DECLARE_ENUM(enum_item, _) enum_item,
71 const char* name) = 0;
81#if V8_ENABLE_WEBASSEMBLY
84 int code_offset,
int script_id) = 0;
111 const char* reason) = 0;
150 if (listener->is_listening_to_code_events())
return true;
158 if (!listener->allows_code_compaction())
return false;
164 const char* comment) {
167 listener->CodeCreateEvent(tag, code, comment);
175 listener->CodeCreateEvent(tag, code, name);
184 listener->CodeCreateEvent(tag, code, shared, name);
193 listener->CodeCreateEvent(tag, code, shared, source, line, column);
197#if V8_ENABLE_WEBASSEMBLY
200 int code_offset,
int script_id) {
203 listener->CodeCreateEvent(tag, code, name, source_url, code_offset,
212 listener->CallbackEvent(name, entry_point);
219 listener->GetterCallbackEvent(name, entry_point);
226 listener->SetterCallbackEvent(name, entry_point);
234 listener->RegExpCodeCreateEvent(code, source, flags);
242 listener->CodeMoveEvent(from, to);
249 listener->BytecodeMoveEvent(from, to);
256 listener->SharedFunctionInfoMoveEvent(from, to);
263 listener->NativeContextMoveEvent(from, to);
270 listener->CodeMovingGCEvent();
278 listener->CodeDisableOptEvent(code, shared);
283 int fp_to_sp_delta) {
286 listener->CodeDeoptEvent(code,
kind,
pc, fp_to_sp_delta);
292 const char* reason) {
295 listener->CodeDependencyChangeEvent(code, sfi, reason);
302 listener->WeakCodeClearEvent();
virtual void BytecodeMoveEvent(Tagged< BytecodeArray > from, Tagged< BytecodeArray > to)=0
virtual void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, DirectHandle< Name > name)=0
virtual void CodeDisableOptEvent(DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared)=0
virtual ~LogEventListener()=default
virtual void NativeContextMoveEvent(Address from, Address to)=0
virtual bool allows_code_compaction()
virtual bool is_listening_to_code_events()
virtual void SetterCallbackEvent(DirectHandle< Name > name, Address entry_point)=0
virtual void CodeMoveEvent(Tagged< InstructionStream > from, Tagged< InstructionStream > to)=0
virtual void CodeDependencyChangeEvent(DirectHandle< Code > code, DirectHandle< SharedFunctionInfo > shared, const char *reason)=0
virtual void CodeDeoptEvent(DirectHandle< Code > code, DeoptimizeKind kind, Address pc, int fp_to_sp_delta)=0
virtual void CodeMovingGCEvent()=0
virtual void RegExpCodeCreateEvent(DirectHandle< AbstractCode > code, DirectHandle< String > source, RegExpFlags flags)=0
virtual void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared, DirectHandle< Name > script_name)=0
virtual void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, const char *name)=0
virtual void SharedFunctionInfoMoveEvent(Address from, Address to)=0
virtual void CallbackEvent(DirectHandle< Name > name, Address entry_point)=0
virtual void WeakCodeClearEvent()=0
virtual void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared, DirectHandle< Name > script_name, int line, int column)=0
virtual void GetterCallbackEvent(DirectHandle< Name > name, Address entry_point)=0
void CodeDisableOptEvent(DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared)
void CodeMoveEvent(Tagged< InstructionStream > from, Tagged< InstructionStream > to)
bool allows_code_compaction()
Logger & operator=(const Logger &)=delete
void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared, DirectHandle< Name > source, int line, int column)
void CodeDeoptEvent(DirectHandle< Code > code, DeoptimizeKind kind, Address pc, int fp_to_sp_delta)
bool is_listening_to_code_events()
void SharedFunctionInfoMoveEvent(Address from, Address to)
void BytecodeMoveEvent(Tagged< BytecodeArray > from, Tagged< BytecodeArray > to)
void WeakCodeClearEvent()
void CodeDependencyChangeEvent(DirectHandle< Code > code, DirectHandle< SharedFunctionInfo > sfi, const char *reason)
void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, DirectHandle< Name > name)
bool AddListener(LogEventListener *listener)
bool RemoveListener(LogEventListener *listener)
Logger(const Logger &)=delete
void NativeContextMoveEvent(Address from, Address to)
void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, const char *comment)
LogEventListener::CodeTag CodeTag
void RegExpCodeCreateEvent(DirectHandle< AbstractCode > code, DirectHandle< String > source, RegExpFlags flags)
base::RecursiveMutex mutex_
void GetterCallbackEvent(DirectHandle< Name > name, Address entry_point)
void CallbackEvent(DirectHandle< Name > name, Address entry_point)
void SetterCallbackEvent(DirectHandle< Name > name, Address entry_point)
void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared, DirectHandle< Name > name)
std::vector< LogEventListener * > listeners_
DECLARE_ENUM(enum_item, ignore)
v8_inspector::String16 String