Commit ed6be498 authored by Camillo's avatar Camillo Committed by V8 LUCI CQ

[logging] Use short "JS:" prefix for function log events

"Function:" and "LazyCompile:" are confusing by now and use up too
much space.# Enter a description of the change.

This also changes the function names visible when using linux-perf

Change-Id: Ib2d4b7df39068c27b5b06db578fc550d2973ebb4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3693705
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81161}
parent a31c6b95
...@@ -1163,18 +1163,18 @@ struct HeapStatsUpdate { ...@@ -1163,18 +1163,18 @@ struct HeapStatsUpdate {
uint32_t size; // New value of size field for the interval with this index. uint32_t size; // New value of size field for the interval with this index.
}; };
#define CODE_EVENTS_LIST(V) \ #define CODE_EVENTS_LIST(V) \
V(Builtin) \ V(Builtin) \
V(Callback) \ V(Callback) \
V(Eval) \ V(Eval) \
V(Function) \ V(Function) \
V(InterpretedFunction) \ V(InterpretedFunction) \
V(Handler) \ V(Handler) \
V(BytecodeHandler) \ V(BytecodeHandler) \
V(LazyCompile) \ V(LazyCompile) /* Unused, use kFunction instead */ \
V(RegExp) \ V(RegExp) \
V(Script) \ V(Script) \
V(Stub) \ V(Stub) \
V(Relocation) V(Relocation)
/** /**
......
...@@ -86,7 +86,7 @@ class BaselineCompilerTask { ...@@ -86,7 +86,7 @@ class BaselineCompilerTask {
} }
if (shared_function_info_->script().IsScript()) { if (shared_function_info_->script().IsScript()) {
Compiler::LogFunctionCompilation( Compiler::LogFunctionCompilation(
isolate, LogEventListener::FUNCTION_TAG, isolate, LogEventListener::CodeTag::kFunction,
handle(Script::cast(shared_function_info_->script()), isolate), handle(Script::cast(shared_function_info_->script()), isolate),
shared_function_info_, Handle<FeedbackVector>(), shared_function_info_, Handle<FeedbackVector>(),
Handle<AbstractCode>::cast(code), CodeKind::BASELINE, time_taken_ms_); Handle<AbstractCode>::cast(code), CodeKind::BASELINE, time_taken_ms_);
......
...@@ -343,7 +343,7 @@ void Builtins::EmitCodeCreateEvents(Isolate* isolate) { ...@@ -343,7 +343,7 @@ void Builtins::EmitCodeCreateEvents(Isolate* isolate) {
for (; i < ToInt(Builtin::kFirstBytecodeHandler); i++) { for (; i < ToInt(Builtin::kFirstBytecodeHandler); i++) {
Code builtin_code = FromCodeT(CodeT::cast(Object(builtins[i]))); Code builtin_code = FromCodeT(CodeT::cast(Object(builtins[i])));
Handle<AbstractCode> code(AbstractCode::cast(builtin_code), isolate); Handle<AbstractCode> code(AbstractCode::cast(builtin_code), isolate);
PROFILE(isolate, CodeCreateEvent(LogEventListener::BUILTIN_TAG, code, PROFILE(isolate, CodeCreateEvent(LogEventListener::CodeTag::kBuiltin, code,
Builtins::name(FromInt(i)))); Builtins::name(FromInt(i))));
} }
...@@ -357,7 +357,7 @@ void Builtins::EmitCodeCreateEvents(Isolate* isolate) { ...@@ -357,7 +357,7 @@ void Builtins::EmitCodeCreateEvents(Isolate* isolate) {
builtin_metadata[i].data.bytecode_and_scale.scale; builtin_metadata[i].data.bytecode_and_scale.scale;
PROFILE(isolate, PROFILE(isolate,
CodeCreateEvent( CodeCreateEvent(
LogEventListener::BYTECODE_HANDLER_TAG, code, LogEventListener::CodeTag::kBytecodeHandler, code,
interpreter::Bytecodes::ToString(bytecode, scale).c_str())); interpreter::Bytecodes::ToString(bytecode, scale).c_str()));
} }
} }
......
...@@ -273,7 +273,7 @@ class CompilerTracer : public AllStatic { ...@@ -273,7 +273,7 @@ class CompilerTracer : public AllStatic {
// static // static
void Compiler::LogFunctionCompilation(Isolate* isolate, void Compiler::LogFunctionCompilation(Isolate* isolate,
LogEventListener::LogEventsAndTags tag, LogEventListener::CodeTag code_type,
Handle<Script> script, Handle<Script> script,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<FeedbackVector> vector, Handle<FeedbackVector> vector,
...@@ -301,8 +301,8 @@ void Compiler::LogFunctionCompilation(Isolate* isolate, ...@@ -301,8 +301,8 @@ void Compiler::LogFunctionCompilation(Isolate* isolate,
? String::cast(script->name()) ? String::cast(script->name())
: ReadOnlyRoots(isolate).empty_string(), : ReadOnlyRoots(isolate).empty_string(),
isolate); isolate);
LogEventListener::LogEventsAndTags log_tag = LogEventListener::CodeTag log_tag =
V8FileLogger::ToNativeByScript(tag, *script); V8FileLogger::ToNativeByScript(code_type, *script);
PROFILE(isolate, CodeCreateEvent(log_tag, abstract_code, shared, script_name, PROFILE(isolate, CodeCreateEvent(log_tag, abstract_code, shared, script_name,
line_num, column_num)); line_num, column_num));
if (!vector.is_null()) { if (!vector.is_null()) {
...@@ -327,16 +327,12 @@ void Compiler::LogFunctionCompilation(Isolate* isolate, ...@@ -327,16 +327,12 @@ void Compiler::LogFunctionCompilation(Isolate* isolate,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
switch (tag) { switch (code_type) {
case LogEventListener::EVAL_TAG: case LogEventListener::CodeTag::kEval:
name += "-eval"; name += "-eval";
break; break;
case LogEventListener::SCRIPT_TAG: case LogEventListener::CodeTag::kScript:
break; case LogEventListener::CodeTag::kFunction:
case LogEventListener::LAZY_COMPILE_TAG:
name += "-lazy";
break;
case LogEventListener::FUNCTION_TAG:
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -415,7 +411,7 @@ CompilationJob::Status UnoptimizedCompilationJob::FinalizeJob( ...@@ -415,7 +411,7 @@ CompilationJob::Status UnoptimizedCompilationJob::FinalizeJob(
namespace { namespace {
void RecordUnoptimizedFunctionCompilation( void RecordUnoptimizedFunctionCompilation(
Isolate* isolate, LogEventListener::LogEventsAndTags tag, Isolate* isolate, LogEventListener::CodeTag code_type,
Handle<SharedFunctionInfo> shared, base::TimeDelta time_taken_to_execute, Handle<SharedFunctionInfo> shared, base::TimeDelta time_taken_to_execute,
base::TimeDelta time_taken_to_finalize) { base::TimeDelta time_taken_to_finalize) {
Handle<AbstractCode> abstract_code; Handle<AbstractCode> abstract_code;
...@@ -437,8 +433,8 @@ void RecordUnoptimizedFunctionCompilation( ...@@ -437,8 +433,8 @@ void RecordUnoptimizedFunctionCompilation(
Handle<Script> script(Script::cast(shared->script()), isolate); Handle<Script> script(Script::cast(shared->script()), isolate);
Compiler::LogFunctionCompilation( Compiler::LogFunctionCompilation(
isolate, tag, script, shared, Handle<FeedbackVector>(), abstract_code, isolate, code_type, script, shared, Handle<FeedbackVector>(),
CodeKind::INTERPRETED_FUNCTION, time_taken_ms); abstract_code, CodeKind::INTERPRETED_FUNCTION, time_taken_ms);
} }
} // namespace } // namespace
...@@ -561,7 +557,7 @@ void TurbofanCompilationJob::RecordCompilationStats(ConcurrencyMode mode, ...@@ -561,7 +557,7 @@ void TurbofanCompilationJob::RecordCompilationStats(ConcurrencyMode mode,
} }
void TurbofanCompilationJob::RecordFunctionCompilation( void TurbofanCompilationJob::RecordFunctionCompilation(
LogEventListener::LogEventsAndTags tag, Isolate* isolate) const { LogEventListener::CodeTag code_type, Isolate* isolate) const {
Handle<AbstractCode> abstract_code = Handle<AbstractCode> abstract_code =
Handle<AbstractCode>::cast(compilation_info()->code()); Handle<AbstractCode>::cast(compilation_info()->code());
...@@ -574,8 +570,9 @@ void TurbofanCompilationJob::RecordFunctionCompilation( ...@@ -574,8 +570,9 @@ void TurbofanCompilationJob::RecordFunctionCompilation(
Handle<FeedbackVector> feedback_vector( Handle<FeedbackVector> feedback_vector(
compilation_info()->closure()->feedback_vector(), isolate); compilation_info()->closure()->feedback_vector(), isolate);
Compiler::LogFunctionCompilation( Compiler::LogFunctionCompilation(
isolate, tag, script, compilation_info()->shared_info(), feedback_vector, isolate, code_type, script, compilation_info()->shared_info(),
abstract_code, compilation_info()->code_kind(), time_taken_ms); feedback_vector, abstract_code, compilation_info()->code_kind(),
time_taken_ms);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -600,9 +597,9 @@ bool UseAsmWasm(FunctionLiteral* literal, bool asm_wasm_broken) { ...@@ -600,9 +597,9 @@ bool UseAsmWasm(FunctionLiteral* literal, bool asm_wasm_broken) {
} }
#endif #endif
void InstallInterpreterTrampolineCopy( void InstallInterpreterTrampolineCopy(Isolate* isolate,
Isolate* isolate, Handle<SharedFunctionInfo> shared_info, Handle<SharedFunctionInfo> shared_info,
LogEventListener::LogEventsAndTags log_tag) { LogEventListener::CodeTag log_tag) {
DCHECK(FLAG_interpreted_frames_native_stack); DCHECK(FLAG_interpreted_frames_native_stack);
if (!shared_info->function_data(kAcquireLoad).IsBytecodeArray()) { if (!shared_info->function_data(kAcquireLoad).IsBytecodeArray()) {
DCHECK(!shared_info->HasBytecodeArray()); DCHECK(!shared_info->HasBytecodeArray());
...@@ -675,7 +672,7 @@ void InstallUnoptimizedCode(UnoptimizedCompilationInfo* compilation_info, ...@@ -675,7 +672,7 @@ void InstallUnoptimizedCode(UnoptimizedCompilationInfo* compilation_info,
void LogUnoptimizedCompilation(Isolate* isolate, void LogUnoptimizedCompilation(Isolate* isolate,
Handle<SharedFunctionInfo> shared_info, Handle<SharedFunctionInfo> shared_info,
LogEventListener::LogEventsAndTags log_tag, LogEventListener::CodeTag log_tag,
base::TimeDelta time_taken_to_execute, base::TimeDelta time_taken_to_execute,
base::TimeDelta time_taken_to_finalize) { base::TimeDelta time_taken_to_finalize) {
RecordUnoptimizedFunctionCompilation(isolate, log_tag, shared_info, RecordUnoptimizedFunctionCompilation(isolate, log_tag, shared_info,
...@@ -1022,7 +1019,7 @@ bool CompileTurbofan_NotConcurrent(Isolate* isolate, ...@@ -1022,7 +1019,7 @@ bool CompileTurbofan_NotConcurrent(Isolate* isolate,
compilation_info->osr_offset(), compilation_info->osr_offset(),
ToCodeT(*compilation_info->code()), ToCodeT(*compilation_info->code()),
compilation_info->function_context_specializing()); compilation_info->function_context_specializing());
job->RecordFunctionCompilation(LogEventListener::LAZY_COMPILE_TAG, isolate); job->RecordFunctionCompilation(LogEventListener::CodeTag::kFunction, isolate);
return true; return true;
} }
...@@ -1149,8 +1146,8 @@ void RecordMaglevFunctionCompilation(Isolate* isolate, ...@@ -1149,8 +1146,8 @@ void RecordMaglevFunctionCompilation(Isolate* isolate,
double time_taken_ms = 0; double time_taken_ms = 0;
Compiler::LogFunctionCompilation( Compiler::LogFunctionCompilation(
isolate, LogEventListener::FUNCTION_TAG, script, shared, feedback_vector, isolate, LogEventListener::CodeTag::kFunction, script, shared,
abstract_code, abstract_code->kind(), time_taken_ms); feedback_vector, abstract_code, abstract_code->kind(), time_taken_ms);
} }
#endif // V8_ENABLE_MAGLEV #endif // V8_ENABLE_MAGLEV
...@@ -1365,13 +1362,12 @@ void FinalizeUnoptimizedCompilation( ...@@ -1365,13 +1362,12 @@ void FinalizeUnoptimizedCompilation(
if (need_source_positions) { if (need_source_positions) {
SharedFunctionInfo::EnsureSourcePositionsAvailable(isolate, shared_info); SharedFunctionInfo::EnsureSourcePositionsAvailable(isolate, shared_info);
} }
LogEventListener::LogEventsAndTags log_tag; LogEventListener::CodeTag log_tag;
if (shared_info->is_toplevel()) { if (shared_info->is_toplevel()) {
log_tag = flags.is_eval() ? LogEventListener::EVAL_TAG log_tag = flags.is_eval() ? LogEventListener::CodeTag::kEval
: LogEventListener::SCRIPT_TAG; : LogEventListener::CodeTag::kScript;
} else { } else {
log_tag = flags.is_lazy_compile() ? LogEventListener::LAZY_COMPILE_TAG log_tag = LogEventListener::CodeTag::kFunction;
: LogEventListener::FUNCTION_TAG;
} }
log_tag = V8FileLogger::ToNativeByScript(log_tag, *script); log_tag = V8FileLogger::ToNativeByScript(log_tag, *script);
if (FLAG_interpreted_frames_native_stack) { if (FLAG_interpreted_frames_native_stack) {
...@@ -2175,7 +2171,7 @@ bool Compiler::CompileSharedWithBaseline(Isolate* isolate, ...@@ -2175,7 +2171,7 @@ bool Compiler::CompileSharedWithBaseline(Isolate* isolate,
CompilerTracer::TraceFinishBaselineCompile(isolate, shared, time_taken_ms); CompilerTracer::TraceFinishBaselineCompile(isolate, shared, time_taken_ms);
if (shared->script().IsScript()) { if (shared->script().IsScript()) {
LogFunctionCompilation(isolate, LogEventListener::FUNCTION_TAG, LogFunctionCompilation(isolate, LogEventListener::CodeTag::kFunction,
handle(Script::cast(shared->script()), isolate), handle(Script::cast(shared->script()), isolate),
shared, Handle<FeedbackVector>(), shared, Handle<FeedbackVector>(),
Handle<AbstractCode>::cast(code), CodeKind::BASELINE, Handle<AbstractCode>::cast(code), CodeKind::BASELINE,
...@@ -3447,7 +3443,7 @@ bool Compiler::FinalizeTurbofanCompilationJob(TurbofanCompilationJob* job, ...@@ -3447,7 +3443,7 @@ bool Compiler::FinalizeTurbofanCompilationJob(TurbofanCompilationJob* job,
job->RetryOptimization(BailoutReason::kOptimizationDisabled); job->RetryOptimization(BailoutReason::kOptimizationDisabled);
} else if (job->FinalizeJob(isolate) == CompilationJob::SUCCEEDED) { } else if (job->FinalizeJob(isolate) == CompilationJob::SUCCEEDED) {
job->RecordCompilationStats(ConcurrencyMode::kConcurrent, isolate); job->RecordCompilationStats(ConcurrencyMode::kConcurrent, isolate);
job->RecordFunctionCompilation(LogEventListener::LAZY_COMPILE_TAG, job->RecordFunctionCompilation(LogEventListener::CodeTag::kFunction,
isolate); isolate);
if (V8_LIKELY(use_result)) { if (V8_LIKELY(use_result)) {
ResetTieringState(*function, osr_offset); ResetTieringState(*function, osr_offset);
......
...@@ -238,7 +238,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic { ...@@ -238,7 +238,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
IsolateT* isolate); IsolateT* isolate);
static void LogFunctionCompilation(Isolate* isolate, static void LogFunctionCompilation(Isolate* isolate,
LogEventListener::LogEventsAndTags tag, LogEventListener::CodeTag code_type,
Handle<Script> script, Handle<Script> script,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<FeedbackVector> vector, Handle<FeedbackVector> vector,
...@@ -322,7 +322,7 @@ class UnoptimizedCompilationJob : public CompilationJob { ...@@ -322,7 +322,7 @@ class UnoptimizedCompilationJob : public CompilationJob {
FinalizeJob(Handle<SharedFunctionInfo> shared_info, LocalIsolate* isolate); FinalizeJob(Handle<SharedFunctionInfo> shared_info, LocalIsolate* isolate);
void RecordCompilationStats(Isolate* isolate) const; void RecordCompilationStats(Isolate* isolate) const;
void RecordFunctionCompilation(LogEventListener::LogEventsAndTags tag, void RecordFunctionCompilation(LogEventListener::CodeTag code_type,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Isolate* isolate) const; Isolate* isolate) const;
...@@ -423,7 +423,7 @@ class TurbofanCompilationJob : public OptimizedCompilationJob { ...@@ -423,7 +423,7 @@ class TurbofanCompilationJob : public OptimizedCompilationJob {
Status AbortOptimization(BailoutReason reason); Status AbortOptimization(BailoutReason reason);
void RecordCompilationStats(ConcurrencyMode mode, Isolate* isolate) const; void RecordCompilationStats(ConcurrencyMode mode, Isolate* isolate) const;
void RecordFunctionCompilation(LogEventListener::LogEventsAndTags tag, void RecordFunctionCompilation(LogEventListener::CodeTag code_type,
Isolate* isolate) const; Isolate* isolate) const;
private: private:
......
...@@ -2745,7 +2745,7 @@ CompilationJob::Status WasmHeapStubCompilationJob::FinalizeJobImpl( ...@@ -2745,7 +2745,7 @@ CompilationJob::Status WasmHeapStubCompilationJob::FinalizeJobImpl(
tracing_scope.stream(), isolate); tracing_scope.stream(), isolate);
} }
#endif #endif
PROFILE(isolate, CodeCreateEvent(LogEventListener::STUB_TAG, PROFILE(isolate, CodeCreateEvent(LogEventListener::CodeTag::kStub,
Handle<AbstractCode>::cast(code), Handle<AbstractCode>::cast(code),
compilation_info()->GetDebugName().get())); compilation_info()->GetDebugName().get()));
return SUCCEEDED; return SUCCEEDED;
......
...@@ -28,64 +28,56 @@ class WasmCode; ...@@ -28,64 +28,56 @@ class WasmCode;
using WasmName = base::Vector<const char>; using WasmName = base::Vector<const char>;
} // namespace wasm } // namespace wasm
// clang-format off #define LOG_EVENT_LIST(V) \
#define LOG_EVENTS_LIST(V) \ V(kCodeCreation, "code-creation") \
V(CODE_CREATION_EVENT, code-creation) \ V(kCodeDisableOpt, "code-disable-optimization") \
V(CODE_DISABLE_OPT_EVENT, code-disable-optimization) \ V(kCodeMove, "code-move") \
V(CODE_MOVE_EVENT, code-move) \ V(kCodeDeopt, "code-deopt") \
V(CODE_DELETE_EVENT, code-delete) \ V(kCodeDelete, "code-delete") \
V(CODE_MOVING_GC, code-moving-gc) \ V(kCodeMovingGC, "code-moving-gc") \
V(SHARED_FUNC_MOVE_EVENT, sfi-move) \ V(kSharedFuncMove, "sfi-move") \
V(SNAPSHOT_CODE_NAME_EVENT, snapshot-code-name) \ V(kSnapshotCodeName, "snapshot-code-name") \
V(TICK_EVENT, tick) V(kTick, "tick")
// clang-format on
#define TAGS_LIST(V) \ #define CODE_TYPE_LIST(V) \
V(BUILTIN_TAG, Builtin) \ V(kBuiltin, Builtin) \
V(CALLBACK_TAG, Callback) \ V(kCallback, Callback) \
V(EVAL_TAG, Eval) \ V(kEval, Eval) \
V(FUNCTION_TAG, Function) \ V(kFunction, JS) \
V(HANDLER_TAG, Handler) \ V(kHandler, Handler) \
V(BYTECODE_HANDLER_TAG, BytecodeHandler) \ V(kBytecodeHandler, BytecodeHandler) \
V(LAZY_COMPILE_TAG, LazyCompile) \ V(kRegExp, RegExp) \
V(REG_EXP_TAG, RegExp) \ V(kScript, Script) \
V(SCRIPT_TAG, Script) \ V(kStub, Stub) \
V(STUB_TAG, Stub) \ V(kNativeFunction, JS) \
V(NATIVE_FUNCTION_TAG, Function) \ V(kNativeScript, Script)
V(NATIVE_LAZY_COMPILE_TAG, LazyCompile) \ // Note that 'Native' cases for functions and scripts are mapped onto
V(NATIVE_SCRIPT_TAG, Script)
// Note that 'NATIVE_' cases for functions and scripts are mapped onto
// original tags when writing to the log. // original tags when writing to the log.
#define LOG_EVENTS_AND_TAGS_LIST(V) \
LOG_EVENTS_LIST(V) \
TAGS_LIST(V)
#define PROFILE(the_isolate, Call) (the_isolate)->logger()->Call; #define PROFILE(the_isolate, Call) (the_isolate)->logger()->Call;
class LogEventListener { class LogEventListener {
public: public:
#define DECLARE_ENUM(enum_item, _) enum_item, #define DECLARE_ENUM(enum_item, _) enum_item,
enum LogEventsAndTags { enum class Event : uint8_t { LOG_EVENT_LIST(DECLARE_ENUM) kLength };
LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) NUMBER_OF_LOG_EVENTS enum class CodeTag : uint8_t { CODE_TYPE_LIST(DECLARE_ENUM) kLength };
};
#undef DECLARE_ENUM #undef DECLARE_ENUM
virtual ~LogEventListener() = default; virtual ~LogEventListener() = default;
virtual void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, virtual void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* name) = 0; const char* name) = 0;
virtual void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, virtual void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) = 0; Handle<Name> name) = 0;
virtual void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, virtual void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) = 0; Handle<Name> script_name) = 0;
virtual void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, virtual void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name, int line, Handle<Name> script_name, int line,
int column) = 0; int column) = 0;
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
virtual void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, virtual void CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name, const char* source_url, wasm::WasmName name, const char* source_url,
int code_offset, int script_id) = 0; int code_offset, int script_id) = 0;
#endif // V8_ENABLE_WEBASSEMBLY #endif // V8_ENABLE_WEBASSEMBLY
...@@ -119,7 +111,8 @@ class LogEventListener { ...@@ -119,7 +111,8 @@ class LogEventListener {
// Dispatches code events to a set of registered listeners. // Dispatches code events to a set of registered listeners.
class Logger { class Logger {
public: public:
using LogEventsAndTags = LogEventListener::LogEventsAndTags; using Event = LogEventListener::Event;
using CodeTag = LogEventListener::CodeTag;
Logger() = default; Logger() = default;
Logger(const Logger&) = delete; Logger(const Logger&) = delete;
...@@ -153,28 +146,28 @@ class Logger { ...@@ -153,28 +146,28 @@ class Logger {
return _is_listening_to_code_events; return _is_listening_to_code_events;
} }
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* comment) { const char* comment) {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
for (auto listener : listeners_) { for (auto listener : listeners_) {
listener->CodeCreateEvent(tag, code, comment); listener->CodeCreateEvent(tag, code, comment);
} }
} }
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) { Handle<Name> name) {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
for (auto listener : listeners_) { for (auto listener : listeners_) {
listener->CodeCreateEvent(tag, code, name); listener->CodeCreateEvent(tag, code, name);
} }
} }
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<Name> name) { Handle<SharedFunctionInfo> shared, Handle<Name> name) {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
for (auto listener : listeners_) { for (auto listener : listeners_) {
listener->CodeCreateEvent(tag, code, shared, name); listener->CodeCreateEvent(tag, code, shared, name);
} }
} }
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<Name> source, Handle<SharedFunctionInfo> shared, Handle<Name> source,
int line, int column) { int line, int column) {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
...@@ -183,7 +176,7 @@ class Logger { ...@@ -183,7 +176,7 @@ class Logger {
} }
} }
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, void CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name, const char* source_url, wasm::WasmName name, const char* source_url,
int code_offset, int script_id) { int code_offset, int script_id) {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
......
...@@ -13,16 +13,14 @@ ...@@ -13,16 +13,14 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
LogEventListener::LogEventsAndTags V8FileLogger::ToNativeByScript( LogEventListener::CodeTag V8FileLogger::ToNativeByScript(
LogEventListener::LogEventsAndTags tag, Script script) { LogEventListener::CodeTag tag, Script script) {
if (script.type() != Script::TYPE_NATIVE) return tag; if (script.type() != Script::TYPE_NATIVE) return tag;
switch (tag) { switch (tag) {
case LogEventListener::FUNCTION_TAG: case LogEventListener::CodeTag::kFunction:
return LogEventListener::NATIVE_FUNCTION_TAG; return LogEventListener::CodeTag::kNativeFunction;
case LogEventListener::LAZY_COMPILE_TAG: case LogEventListener::CodeTag::kScript:
return LogEventListener::NATIVE_LAZY_COMPILE_TAG; return LogEventListener::CodeTag::kNativeScript;
case LogEventListener::SCRIPT_TAG:
return LogEventListener::NATIVE_SCRIPT_TAG;
default: default:
return tag; return tag;
} }
......
This diff is collapsed.
...@@ -83,6 +83,7 @@ class Ticker; ...@@ -83,6 +83,7 @@ class Ticker;
class ExistingCodeLogger { class ExistingCodeLogger {
public: public:
using CodeTag = LogEventListener::CodeTag;
explicit ExistingCodeLogger(Isolate* isolate, explicit ExistingCodeLogger(Isolate* isolate,
LogEventListener* listener = nullptr) LogEventListener* listener = nullptr)
: isolate_(isolate), listener_(listener) {} : isolate_(isolate), listener_(listener) {}
...@@ -93,7 +94,7 @@ class ExistingCodeLogger { ...@@ -93,7 +94,7 @@ class ExistingCodeLogger {
void LogCompiledFunctions(); void LogCompiledFunctions();
void LogExistingFunction( void LogExistingFunction(
Handle<SharedFunctionInfo> shared, Handle<AbstractCode> code, Handle<SharedFunctionInfo> shared, Handle<AbstractCode> code,
LogEventListener::LogEventsAndTags tag = LogEventListener::FUNCTION_TAG); LogEventListener::CodeTag tag = LogEventListener::CodeTag::kFunction);
void LogCodeObject(Object object); void LogCodeObject(Object object);
private: private:
...@@ -167,18 +168,18 @@ class V8FileLogger : public LogEventListener { ...@@ -167,18 +168,18 @@ class V8FileLogger : public LogEventListener {
V8_EXPORT_PRIVATE void RemoveLogEventListener(LogEventListener* listener); V8_EXPORT_PRIVATE void RemoveLogEventListener(LogEventListener* listener);
// LogEventListener implementation. // LogEventListener implementation.
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* name) override; const char* name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) override; Handle<Name> name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) override; Handle<Name> script_name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name, int line, int column) override; Handle<Name> script_name, int line, int column) override;
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, void CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name, const char* source_url, wasm::WasmName name, const char* source_url,
int code_offset, int script_id) override; int code_offset, int script_id) override;
#endif // V8_ENABLE_WEBASSEMBLY #endif // V8_ENABLE_WEBASSEMBLY
...@@ -283,8 +284,7 @@ class V8FileLogger : public LogEventListener { ...@@ -283,8 +284,7 @@ class V8FileLogger : public LogEventListener {
void LogAllMaps(); void LogAllMaps();
// Converts tag to a corresponding NATIVE_... if the script is native. // Converts tag to a corresponding NATIVE_... if the script is native.
V8_INLINE static LogEventListener::LogEventsAndTags ToNativeByScript( V8_INLINE static CodeTag ToNativeByScript(CodeTag tag, Script script);
LogEventListener::LogEventsAndTags, Script);
private: private:
void UpdateIsLogging(bool value); void UpdateIsLogging(bool value);
...@@ -297,11 +297,10 @@ class V8FileLogger : public LogEventListener { ...@@ -297,11 +297,10 @@ class V8FileLogger : public LogEventListener {
Address entry_point); Address entry_point);
// Internal configurable move event. // Internal configurable move event.
void MoveEventInternal(LogEventListener::LogEventsAndTags event, Address from, void MoveEventInternal(Event event, Address from, Address to);
Address to);
// Helper method. It resets name_buffer_ and add tag name into it. // Helper method. It resets name_buffer_ and add tag name into it.
void InitNameBuffer(LogEventListener::LogEventsAndTags tag); void InitNameBuffer(Event tag);
// Emits a profiler tick event. Used by the profiler thread. // Emits a profiler tick event. Used by the profiler thread.
void TickEvent(TickSample* sample, bool overflow); void TickEvent(TickSample* sample, bool overflow);
...@@ -409,18 +408,18 @@ class V8_EXPORT_PRIVATE CodeEventLogger : public LogEventListener { ...@@ -409,18 +408,18 @@ class V8_EXPORT_PRIVATE CodeEventLogger : public LogEventListener {
explicit CodeEventLogger(Isolate* isolate); explicit CodeEventLogger(Isolate* isolate);
~CodeEventLogger() override; ~CodeEventLogger() override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* name) override; const char* name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) override; Handle<Name> name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) override; Handle<Name> script_name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name, int line, int column) override; Handle<Name> script_name, int line, int column) override;
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, void CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name, const char* source_url, wasm::WasmName name, const char* source_url,
int code_offset, int script_id) override; int code_offset, int script_id) override;
#endif // V8_ENABLE_WEBASSEMBLY #endif // V8_ENABLE_WEBASSEMBLY
...@@ -477,18 +476,18 @@ class ExternalLogEventListener : public LogEventListener { ...@@ -477,18 +476,18 @@ class ExternalLogEventListener : public LogEventListener {
explicit ExternalLogEventListener(Isolate* isolate); explicit ExternalLogEventListener(Isolate* isolate);
~ExternalLogEventListener() override; ~ExternalLogEventListener() override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* comment) override; const char* comment) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) override; Handle<Name> name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> name) override; Handle<Name> name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<Name> source, Handle<SharedFunctionInfo> shared, Handle<Name> source,
int line, int column) override; int line, int column) override;
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, void CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name, const char* source_url, wasm::WasmName name, const char* source_url,
int code_offset, int script_id) override; int code_offset, int script_id) override;
#endif // V8_ENABLE_WEBASSEMBLY #endif // V8_ENABLE_WEBASSEMBLY
......
...@@ -53,7 +53,7 @@ void ReportBuiltinEventRecord::UpdateCodeMap(CodeMap* code_map) { ...@@ -53,7 +53,7 @@ void ReportBuiltinEventRecord::UpdateCodeMap(CodeMap* code_map) {
if (builtin == Builtin::kGenericJSToWasmWrapper) { if (builtin == Builtin::kGenericJSToWasmWrapper) {
// Make sure to add the generic js-to-wasm wrapper builtin, because that // Make sure to add the generic js-to-wasm wrapper builtin, because that
// one is supposed to show up in profiles. // one is supposed to show up in profiles.
entry = code_map->code_entries().Create(LogEventListener::BUILTIN_TAG, entry = code_map->code_entries().Create(LogEventListener::CodeTag::kBuiltin,
Builtins::name(builtin)); Builtins::name(builtin));
code_map->AddCode(instruction_start, entry, instruction_size); code_map->AddCode(instruction_start, entry, instruction_size);
} }
......
...@@ -398,7 +398,7 @@ void ProfilerCodeObserver::CreateEntriesForRuntimeCallStats() { ...@@ -398,7 +398,7 @@ void ProfilerCodeObserver::CreateEntriesForRuntimeCallStats() {
for (int i = 0; i < RuntimeCallStats::kNumberOfCounters; ++i) { for (int i = 0; i < RuntimeCallStats::kNumberOfCounters; ++i) {
RuntimeCallCounter* counter = rcs->GetCounter(i); RuntimeCallCounter* counter = rcs->GetCounter(i);
DCHECK(counter->name()); DCHECK(counter->name());
auto entry = code_entries_.Create(LogEventListener::FUNCTION_TAG, auto entry = code_entries_.Create(LogEventListener::CodeTag::kFunction,
counter->name(), "native V8Runtime"); counter->name(), "native V8Runtime");
code_map_.AddCode(reinterpret_cast<Address>(counter), entry, 1); code_map_.AddCode(reinterpret_cast<Address>(counter), entry, 1);
} }
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
CodeEntry::CodeEntry(LogEventListener::LogEventsAndTags tag, const char* name, CodeEntry::CodeEntry(LogEventListener::CodeTag tag, const char* name,
const char* resource_name, int line_number, const char* resource_name, int line_number,
int column_number, int column_number,
std::unique_ptr<SourcePositionTable> line_info, std::unique_ptr<SourcePositionTable> line_info,
bool is_shared_cross_origin, CodeType code_type) bool is_shared_cross_origin, CodeType code_type)
: bit_field_(TagField::encode(tag) | : bit_field_(CodeTagField::encode(tag) |
BuiltinField::encode(Builtin::kIllegal) | BuiltinField::encode(Builtin::kIllegal) |
CodeTypeField::encode(code_type) | CodeTypeField::encode(code_type) |
SharedCrossOriginField::encode(is_shared_cross_origin)), SharedCrossOriginField::encode(is_shared_cross_origin)),
......
...@@ -91,7 +91,7 @@ const char* const CodeEntry::kRootEntryName = "(root)"; ...@@ -91,7 +91,7 @@ const char* const CodeEntry::kRootEntryName = "(root)";
// static // static
CodeEntry* CodeEntry::program_entry() { CodeEntry* CodeEntry::program_entry() {
static base::LeakyObject<CodeEntry> kProgramEntry( static base::LeakyObject<CodeEntry> kProgramEntry(
LogEventListener::FUNCTION_TAG, CodeEntry::kProgramEntryName, LogEventListener::CodeTag::kFunction, CodeEntry::kProgramEntryName,
CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo, CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo,
v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false, v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false,
CodeEntry::CodeType::OTHER); CodeEntry::CodeType::OTHER);
...@@ -101,7 +101,7 @@ CodeEntry* CodeEntry::program_entry() { ...@@ -101,7 +101,7 @@ CodeEntry* CodeEntry::program_entry() {
// static // static
CodeEntry* CodeEntry::idle_entry() { CodeEntry* CodeEntry::idle_entry() {
static base::LeakyObject<CodeEntry> kIdleEntry( static base::LeakyObject<CodeEntry> kIdleEntry(
LogEventListener::FUNCTION_TAG, CodeEntry::kIdleEntryName, LogEventListener::CodeTag::kFunction, CodeEntry::kIdleEntryName,
CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo, CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo,
v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false, v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false,
CodeEntry::CodeType::OTHER); CodeEntry::CodeType::OTHER);
...@@ -111,8 +111,9 @@ CodeEntry* CodeEntry::idle_entry() { ...@@ -111,8 +111,9 @@ CodeEntry* CodeEntry::idle_entry() {
// static // static
CodeEntry* CodeEntry::gc_entry() { CodeEntry* CodeEntry::gc_entry() {
static base::LeakyObject<CodeEntry> kGcEntry( static base::LeakyObject<CodeEntry> kGcEntry(
LogEventListener::BUILTIN_TAG, CodeEntry::kGarbageCollectorEntryName, LogEventListener::CodeTag::kBuiltin,
CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo, CodeEntry::kGarbageCollectorEntryName, CodeEntry::kEmptyResourceName,
v8::CpuProfileNode::kNoLineNumberInfo,
v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false, v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false,
CodeEntry::CodeType::OTHER); CodeEntry::CodeType::OTHER);
return kGcEntry.get(); return kGcEntry.get();
...@@ -121,7 +122,7 @@ CodeEntry* CodeEntry::gc_entry() { ...@@ -121,7 +122,7 @@ CodeEntry* CodeEntry::gc_entry() {
// static // static
CodeEntry* CodeEntry::unresolved_entry() { CodeEntry* CodeEntry::unresolved_entry() {
static base::LeakyObject<CodeEntry> kUnresolvedEntry( static base::LeakyObject<CodeEntry> kUnresolvedEntry(
LogEventListener::FUNCTION_TAG, CodeEntry::kUnresolvedFunctionName, LogEventListener::CodeTag::kFunction, CodeEntry::kUnresolvedFunctionName,
CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo, CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo,
v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false, v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false,
CodeEntry::CodeType::OTHER); CodeEntry::CodeType::OTHER);
...@@ -131,7 +132,7 @@ CodeEntry* CodeEntry::unresolved_entry() { ...@@ -131,7 +132,7 @@ CodeEntry* CodeEntry::unresolved_entry() {
// static // static
CodeEntry* CodeEntry::root_entry() { CodeEntry* CodeEntry::root_entry() {
static base::LeakyObject<CodeEntry> kRootEntry( static base::LeakyObject<CodeEntry> kRootEntry(
LogEventListener::FUNCTION_TAG, CodeEntry::kRootEntryName, LogEventListener::CodeTag::kFunction, CodeEntry::kRootEntryName,
CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo, CodeEntry::kEmptyResourceName, v8::CpuProfileNode::kNoLineNumberInfo,
v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false, v8::CpuProfileNode::kNoColumnNumberInfo, nullptr, false,
CodeEntry::CodeType::OTHER); CodeEntry::CodeType::OTHER);
...@@ -163,7 +164,8 @@ bool CodeEntry::IsSameFunctionAs(const CodeEntry* entry) const { ...@@ -163,7 +164,8 @@ bool CodeEntry::IsSameFunctionAs(const CodeEntry* entry) const {
} }
void CodeEntry::SetBuiltinId(Builtin id) { void CodeEntry::SetBuiltinId(Builtin id) {
bit_field_ = TagField::update(bit_field_, LogEventListener::BUILTIN_TAG); bit_field_ =
CodeTagField::update(bit_field_, LogEventListener::CodeTag::kBuiltin);
bit_field_ = BuiltinField::update(bit_field_, id); bit_field_ = BuiltinField::update(bit_field_, id);
} }
...@@ -339,34 +341,26 @@ CpuProfileNode::SourceType ProfileNode::source_type() const { ...@@ -339,34 +341,26 @@ CpuProfileNode::SourceType ProfileNode::source_type() const {
return CpuProfileNode::kUnresolved; return CpuProfileNode::kUnresolved;
// Otherwise, resolve based on logger tag. // Otherwise, resolve based on logger tag.
switch (entry_->tag()) { switch (entry_->code_tag()) {
case LogEventListener::EVAL_TAG: case LogEventListener::CodeTag::kEval:
case LogEventListener::SCRIPT_TAG: case LogEventListener::CodeTag::kScript:
case LogEventListener::LAZY_COMPILE_TAG: case LogEventListener::CodeTag::kFunction:
case LogEventListener::FUNCTION_TAG:
return CpuProfileNode::kScript; return CpuProfileNode::kScript;
case LogEventListener::BUILTIN_TAG: case LogEventListener::CodeTag::kBuiltin:
case LogEventListener::HANDLER_TAG: case LogEventListener::CodeTag::kHandler:
case LogEventListener::BYTECODE_HANDLER_TAG: case LogEventListener::CodeTag::kBytecodeHandler:
case LogEventListener::NATIVE_FUNCTION_TAG: case LogEventListener::CodeTag::kNativeFunction:
case LogEventListener::NATIVE_SCRIPT_TAG: case LogEventListener::CodeTag::kNativeScript:
case LogEventListener::NATIVE_LAZY_COMPILE_TAG:
return CpuProfileNode::kBuiltin; return CpuProfileNode::kBuiltin;
case LogEventListener::CALLBACK_TAG: case LogEventListener::CodeTag::kCallback:
return CpuProfileNode::kCallback; return CpuProfileNode::kCallback;
case LogEventListener::REG_EXP_TAG: case LogEventListener::CodeTag::kRegExp:
case LogEventListener::STUB_TAG: case LogEventListener::CodeTag::kStub:
case LogEventListener::CODE_CREATION_EVENT: case LogEventListener::CodeTag::kLength:
case LogEventListener::CODE_DISABLE_OPT_EVENT:
case LogEventListener::CODE_MOVE_EVENT:
case LogEventListener::CODE_DELETE_EVENT:
case LogEventListener::CODE_MOVING_GC:
case LogEventListener::SHARED_FUNC_MOVE_EVENT:
case LogEventListener::SNAPSHOT_CODE_NAME_EVENT:
case LogEventListener::TICK_EVENT:
case LogEventListener::NUMBER_OF_LOG_EVENTS:
return CpuProfileNode::kInternal; return CpuProfileNode::kInternal;
} }
return CpuProfileNode::kInternal;
UNREACHABLE();
} }
void ProfileNode::CollectDeoptInfo(CodeEntry* entry) { void ProfileNode::CollectDeoptInfo(CodeEntry* entry) {
......
...@@ -65,7 +65,7 @@ class CodeEntry { ...@@ -65,7 +65,7 @@ class CodeEntry {
// CodeEntry may reference strings (|name|, |resource_name|) managed by a // CodeEntry may reference strings (|name|, |resource_name|) managed by a
// StringsStorage instance. These must be freed via ReleaseStrings. // StringsStorage instance. These must be freed via ReleaseStrings.
inline CodeEntry(LogEventListener::LogEventsAndTags tag, const char* name, inline CodeEntry(LogEventListener::CodeTag tag, const char* name,
const char* resource_name = CodeEntry::kEmptyResourceName, const char* resource_name = CodeEntry::kEmptyResourceName,
int line_number = v8::CpuProfileNode::kNoLineNumberInfo, int line_number = v8::CpuProfileNode::kNoLineNumberInfo,
int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, int column_number = v8::CpuProfileNode::kNoColumnNumberInfo,
...@@ -164,8 +164,12 @@ class CodeEntry { ...@@ -164,8 +164,12 @@ class CodeEntry {
const std::vector<CodeEntryAndLineNumber>* GetInlineStack( const std::vector<CodeEntryAndLineNumber>* GetInlineStack(
int pc_offset) const; int pc_offset) const;
LogEventListener::LogEventsAndTags tag() const { LogEventListener::Event event() const {
return TagField::decode(bit_field_); return EventField::decode(bit_field_);
}
LogEventListener::CodeTag code_tag() const {
return CodeTagField::decode(bit_field_);
} }
V8_EXPORT_PRIVATE static const char* const kEmptyResourceName; V8_EXPORT_PRIVATE static const char* const kEmptyResourceName;
...@@ -227,7 +231,8 @@ class CodeEntry { ...@@ -227,7 +231,8 @@ class CodeEntry {
return ref_count_; return ref_count_;
} }
using TagField = base::BitField<LogEventListener::LogEventsAndTags, 0, 8>; using EventField = base::BitField<LogEventListener::Event, 0, 4>;
using CodeTagField = base::BitField<LogEventListener::CodeTag, 0, 4>;
using BuiltinField = base::BitField<Builtin, 8, 20>; using BuiltinField = base::BitField<Builtin, 8, 20>;
static_assert(Builtins::kBuiltinCount <= BuiltinField::kNumValues, static_assert(Builtins::kBuiltinCount <= BuiltinField::kNumValues,
"builtin_count exceeds size of bitfield"); "builtin_count exceeds size of bitfield");
......
...@@ -40,8 +40,7 @@ ProfilerListener::ProfilerListener(Isolate* isolate, ...@@ -40,8 +40,7 @@ ProfilerListener::ProfilerListener(Isolate* isolate,
ProfilerListener::~ProfilerListener() = default; ProfilerListener::~ProfilerListener() = default;
void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<AbstractCode> code,
const char* name) { const char* name) {
CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation); CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
...@@ -55,8 +54,7 @@ void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag, ...@@ -55,8 +54,7 @@ void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag,
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
} }
void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<AbstractCode> code,
Handle<Name> name) { Handle<Name> name) {
CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation); CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
...@@ -70,8 +68,7 @@ void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag, ...@@ -70,8 +68,7 @@ void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag,
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
} }
void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) { Handle<Name> script_name) {
CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation); CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation);
...@@ -106,7 +103,7 @@ CodeEntry* GetOrInsertCachedEntry( ...@@ -106,7 +103,7 @@ CodeEntry* GetOrInsertCachedEntry(
} // namespace } // namespace
void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeTag tag,
Handle<AbstractCode> abstract_code, Handle<AbstractCode> abstract_code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name, int line, Handle<Name> script_name, int line,
...@@ -230,8 +227,7 @@ void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag, ...@@ -230,8 +227,7 @@ void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag,
} }
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
const wasm::WasmCode* code,
wasm::WasmName name, wasm::WasmName name,
const char* source_url, int code_offset, const char* source_url, int code_offset,
int script_id) { int script_id) {
...@@ -252,8 +248,8 @@ void ProfilerListener::CallbackEvent(Handle<Name> name, Address entry_point) { ...@@ -252,8 +248,8 @@ void ProfilerListener::CallbackEvent(Handle<Name> name, Address entry_point) {
CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation); CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->instruction_start = entry_point; rec->instruction_start = entry_point;
rec->entry = rec->entry = code_entries_.Create(LogEventListener::CodeTag::kCallback,
code_entries_.Create(LogEventListener::CALLBACK_TAG, GetName(*name)); GetName(*name));
rec->instruction_size = 1; rec->instruction_size = 1;
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
} }
...@@ -263,7 +259,7 @@ void ProfilerListener::GetterCallbackEvent(Handle<Name> name, ...@@ -263,7 +259,7 @@ void ProfilerListener::GetterCallbackEvent(Handle<Name> name,
CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation); CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->instruction_start = entry_point; rec->instruction_start = entry_point;
rec->entry = code_entries_.Create(LogEventListener::CALLBACK_TAG, rec->entry = code_entries_.Create(LogEventListener::CodeTag::kCallback,
GetConsName("get ", *name)); GetConsName("get ", *name));
rec->instruction_size = 1; rec->instruction_size = 1;
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
...@@ -274,7 +270,7 @@ void ProfilerListener::SetterCallbackEvent(Handle<Name> name, ...@@ -274,7 +270,7 @@ void ProfilerListener::SetterCallbackEvent(Handle<Name> name,
CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation); CodeEventsContainer evt_rec(CodeEventRecord::Type::kCodeCreation);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->instruction_start = entry_point; rec->instruction_start = entry_point;
rec->entry = code_entries_.Create(LogEventListener::CALLBACK_TAG, rec->entry = code_entries_.Create(LogEventListener::CodeTag::kCallback,
GetConsName("set ", *name)); GetConsName("set ", *name));
rec->instruction_size = 1; rec->instruction_size = 1;
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
...@@ -286,7 +282,7 @@ void ProfilerListener::RegExpCodeCreateEvent(Handle<AbstractCode> code, ...@@ -286,7 +282,7 @@ void ProfilerListener::RegExpCodeCreateEvent(Handle<AbstractCode> code,
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->instruction_start = code->InstructionStart(); rec->instruction_start = code->InstructionStart();
rec->entry = code_entries_.Create( rec->entry = code_entries_.Create(
LogEventListener::REG_EXP_TAG, GetConsName("RegExp: ", *source), LogEventListener::CodeTag::kRegExp, GetConsName("RegExp: ", *source),
CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo,
CpuProfileNode::kNoColumnNumberInfo, nullptr); CpuProfileNode::kNoColumnNumberInfo, nullptr);
rec->instruction_size = code->InstructionSize(); rec->instruction_size = code->InstructionSize();
......
...@@ -35,18 +35,18 @@ class V8_EXPORT_PRIVATE ProfilerListener : public LogEventListener, ...@@ -35,18 +35,18 @@ class V8_EXPORT_PRIVATE ProfilerListener : public LogEventListener,
ProfilerListener(const ProfilerListener&) = delete; ProfilerListener(const ProfilerListener&) = delete;
ProfilerListener& operator=(const ProfilerListener&) = delete; ProfilerListener& operator=(const ProfilerListener&) = delete;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* name) override; const char* name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) override; Handle<Name> name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) override; Handle<Name> script_name) override;
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name, int line, int column) override; Handle<Name> script_name, int line, int column) override;
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, void CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name, const char* source_url, wasm::WasmName name, const char* source_url,
int code_offset, int script_id) override; int code_offset, int script_id) override;
#endif // V8_ENABLE_WEBASSEMBLY #endif // V8_ENABLE_WEBASSEMBLY
......
...@@ -1547,19 +1547,19 @@ RUNTIME_FUNCTION(Runtime_EnableCodeLoggingForTesting) { ...@@ -1547,19 +1547,19 @@ RUNTIME_FUNCTION(Runtime_EnableCodeLoggingForTesting) {
// {true} on {is_listening_to_code_events()}. Feel free to add assertions to // {true} on {is_listening_to_code_events()}. Feel free to add assertions to
// any method to further test the code logging callbacks. // any method to further test the code logging callbacks.
class NoopListener final : public LogEventListener { class NoopListener final : public LogEventListener {
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* name) final {} const char* name) final {}
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) final {} Handle<Name> name) final {}
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) final {} Handle<Name> script_name) final {}
void CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code, void CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name, int line, int column) final { Handle<Name> script_name, int line, int column) final {
} }
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, void CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name, const char* source_url, wasm::WasmName name, const char* source_url,
int code_offset, int script_id) final {} int code_offset, int script_id) final {}
#endif // V8_ENABLE_WEBASSEMBLY #endif // V8_ENABLE_WEBASSEMBLY
......
...@@ -314,8 +314,8 @@ void CreateInterpreterDataForDeserializedCode(Isolate* isolate, ...@@ -314,8 +314,8 @@ void CreateInterpreterDataForDeserializedCode(Isolate* isolate,
int line_num = script->GetLineNumber(info->StartPosition()) + 1; int line_num = script->GetLineNumber(info->StartPosition()) + 1;
int column_num = script->GetColumnNumber(info->StartPosition()) + 1; int column_num = script->GetColumnNumber(info->StartPosition()) + 1;
PROFILE(isolate, PROFILE(isolate,
CodeCreateEvent(LogEventListener::FUNCTION_TAG, abstract_code, info, CodeCreateEvent(LogEventListener::CodeTag::kFunction, abstract_code,
name_handle, line_num, column_num)); info, name_handle, line_num, column_num));
} }
} }
#endif // V8_TARGET_ARCH_ARM #endif // V8_TARGET_ARCH_ARM
...@@ -397,13 +397,13 @@ void FinalizeDeserialization(Isolate* isolate, ...@@ -397,13 +397,13 @@ void FinalizeDeserialization(Isolate* isolate,
script->GetLineNumber(shared_info->StartPosition()) + 1; script->GetLineNumber(shared_info->StartPosition()) + 1;
int column_num = int column_num =
script->GetColumnNumber(shared_info->StartPosition()) + 1; script->GetColumnNumber(shared_info->StartPosition()) + 1;
PROFILE( PROFILE(isolate,
isolate, CodeCreateEvent(
CodeCreateEvent( shared_info->is_toplevel()
shared_info->is_toplevel() ? LogEventListener::SCRIPT_TAG ? LogEventListener::CodeTag::kScript
: LogEventListener::FUNCTION_TAG, : LogEventListener::CodeTag::kFunction,
handle(shared_info->abstract_code(isolate), isolate), handle(shared_info->abstract_code(isolate), isolate),
shared_info, name, line_num, column_num)); shared_info, name, line_num, column_num));
} }
} }
} }
......
...@@ -248,7 +248,7 @@ Handle<CodeT> JSToWasmWrapperCompilationUnit::Finalize() { ...@@ -248,7 +248,7 @@ Handle<CodeT> JSToWasmWrapperCompilationUnit::Finalize() {
isolate_->is_profiling()) { isolate_->is_profiling()) {
Handle<String> name = isolate_->factory()->NewStringFromAsciiChecked( Handle<String> name = isolate_->factory()->NewStringFromAsciiChecked(
job_->compilation_info()->GetDebugName().get()); job_->compilation_info()->GetDebugName().get());
PROFILE(isolate_, CodeCreateEvent(LogEventListener::STUB_TAG, PROFILE(isolate_, CodeCreateEvent(LogEventListener::CodeTag::kStub,
Handle<AbstractCode>::cast(code), name)); Handle<AbstractCode>::cast(code), name));
} }
return ToCodeT(code, isolate_); return ToCodeT(code, isolate_);
......
...@@ -289,8 +289,8 @@ void WasmCode::LogCode(Isolate* isolate, const char* source_url, ...@@ -289,8 +289,8 @@ void WasmCode::LogCode(Isolate* isolate, const char* source_url,
} }
int code_offset = module->functions[index_].code.offset(); int code_offset = module->functions[index_].code.offset();
PROFILE(isolate, CodeCreateEvent(LogEventListener::FUNCTION_TAG, this, name, PROFILE(isolate, CodeCreateEvent(LogEventListener::CodeTag::kFunction, this,
source_url, code_offset, script_id)); name, source_url, code_offset, script_id));
} }
void WasmCode::Validate() const { void WasmCode::Validate() const {
......
...@@ -13542,13 +13542,9 @@ static int move_events = 0; ...@@ -13542,13 +13542,9 @@ static int move_events = 0;
static bool FunctionNameIs(const char* expected, static bool FunctionNameIs(const char* expected,
const v8::JitCodeEvent* event) { const v8::JitCodeEvent* event) {
// Log lines for functions are of the general form: // Log lines for functions are of the general form:
// "LazyCompile:<type><function_name>" or Function:<type><function_name>, // "JS:<type><function_name>" or Function:<type><function_name>,
// where the type is one of "*", "~" or "". // where the type is one of "*", "~" or "".
static const char* kPreamble = "Function:"; static const char* kPreamble = "JS:";
if (i::FLAG_lazy &&
event->code_type != v8::JitCodeEvent::CodeType::WASM_CODE) {
kPreamble = "LazyCompile:";
}
static size_t kPreambleLen = strlen(kPreamble); static size_t kPreambleLen = strlen(kPreamble);
if (event->name.len < kPreambleLen || if (event->name.len < kPreambleLen ||
...@@ -192,12 +192,12 @@ TEST(CodeEvents) { ...@@ -192,12 +192,12 @@ TEST(CodeEvents) {
// Enqueue code creation events. // Enqueue code creation events.
const char* aaa_str = "aaa"; const char* aaa_str = "aaa";
i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str);
profiler_listener.CodeCreateEvent(i::V8FileLogger::FUNCTION_TAG, aaa_code, profiler_listener.CodeCreateEvent(i::LogEventListener::CodeTag::kFunction,
aaa_name); aaa_code, aaa_name);
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, comment_code, profiler_listener.CodeCreateEvent(i::LogEventListener::CodeTag::kBuiltin,
"comment"); comment_code, "comment");
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, comment2_code, profiler_listener.CodeCreateEvent(i::LogEventListener::CodeTag::kBuiltin,
"comment2"); comment2_code, "comment2");
profiler_listener.CodeMoveEvent(*comment2_code, *moved_code); profiler_listener.CodeMoveEvent(*comment2_code, *moved_code);
// Enqueue a tick event to enable code events processing. // Enqueue a tick event to enable code events processing.
...@@ -257,12 +257,12 @@ TEST(TickEvents) { ...@@ -257,12 +257,12 @@ TEST(TickEvents) {
*code_observer->weak_code_registry()); *code_observer->weak_code_registry());
isolate->v8_file_logger()->AddLogEventListener(&profiler_listener); isolate->v8_file_logger()->AddLogEventListener(&profiler_listener);
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, frame1_code, profiler_listener.CodeCreateEvent(i::LogEventListener::CodeTag::kBuiltin,
"bbb"); frame1_code, "bbb");
profiler_listener.CodeCreateEvent(i::V8FileLogger::STUB_TAG, frame2_code, profiler_listener.CodeCreateEvent(i::LogEventListener::CodeTag::kStub,
"ccc"); frame2_code, "ccc");
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, frame3_code, profiler_listener.CodeCreateEvent(i::LogEventListener::CodeTag::kBuiltin,
"ddd"); frame3_code, "ddd");
EnqueueTickSampleEvent(processor, frame1_code->raw_instruction_start()); EnqueueTickSampleEvent(processor, frame1_code->raw_instruction_start());
EnqueueTickSampleEvent(processor, EnqueueTickSampleEvent(processor,
...@@ -418,7 +418,8 @@ TEST(Issue1398) { ...@@ -418,7 +418,8 @@ TEST(Issue1398) {
*code_observer->code_entries(), *code_observer->code_entries(),
*code_observer->weak_code_registry()); *code_observer->weak_code_registry());
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, code, "bbb"); profiler_listener.CodeCreateEvent(i::LogEventListener::CodeTag::kBuiltin,
code, "bbb");
v8::internal::TickSample sample; v8::internal::TickSample sample;
sample.pc = reinterpret_cast<void*>(code->InstructionStart()); sample.pc = reinterpret_cast<void*>(code->InstructionStart());
...@@ -1310,9 +1311,9 @@ static void TickLines(bool optimize) { ...@@ -1310,9 +1311,9 @@ static void TickLines(bool optimize) {
i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name); i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name);
int line = 1; int line = 1;
int column = 1; int column = 1;
profiler_listener.CodeCreateEvent(i::V8FileLogger::FUNCTION_TAG, code, profiler_listener.CodeCreateEvent(i::LogEventListener::CodeTag::kFunction,
handle(func->shared(), isolate), str, line, code, handle(func->shared(), isolate), str,
column); line, column);
// Enqueue a tick event to enable code events processing. // Enqueue a tick event to enable code events processing.
EnqueueTickSampleEvent(processor, code_address); EnqueueTickSampleEvent(processor, code_address);
......
This diff is collapsed.
...@@ -541,7 +541,7 @@ TEST_F(LogAllTest, LogAll) { ...@@ -541,7 +541,7 @@ TEST_F(LogAllTest, LogAll) {
CHECK(logger.ContainsLine({"timer-event-start", "V8.CompileCode"})); CHECK(logger.ContainsLine({"timer-event-start", "V8.CompileCode"}));
CHECK(logger.ContainsLine({"timer-event-end", "V8.CompileCode"})); CHECK(logger.ContainsLine({"timer-event-end", "V8.CompileCode"}));
CHECK(logger.ContainsLine({"code-creation,Script", ":1:1"})); CHECK(logger.ContainsLine({"code-creation,Script", ":1:1"}));
CHECK(logger.ContainsLine({"code-creation,LazyCompile,", "testAddFn"})); CHECK(logger.ContainsLine({"code-creation,JS,", "testAddFn"}));
if (i::FLAG_turbofan && !i::FLAG_always_turbofan) { if (i::FLAG_turbofan && !i::FLAG_always_turbofan) {
CHECK(logger.ContainsLine({"code-deopt,", "not a Smi"})); CHECK(logger.ContainsLine({"code-deopt,", "not a Smi"}));
...@@ -573,8 +573,8 @@ TEST_F(LogInterpretedFramesNativeStackTest, LogInterpretedFramesNativeStack) { ...@@ -573,8 +573,8 @@ TEST_F(LogInterpretedFramesNativeStackTest, LogInterpretedFramesNativeStack) {
logger.StopLogging(); logger.StopLogging();
CHECK(logger.ContainsLinesInOrder( CHECK(logger.ContainsLinesInOrder(
{{"LazyCompile", "testLogInterpretedFramesNativeStack"}, {{"JS", "testLogInterpretedFramesNativeStack"},
{"LazyCompile", "testLogInterpretedFramesNativeStack"}})); {"JS", "testLogInterpretedFramesNativeStack"}}));
} }
} }
...@@ -656,7 +656,7 @@ TEST_F(LogInterpretedFramesNativeStackWithSerializationTest, ...@@ -656,7 +656,7 @@ TEST_F(LogInterpretedFramesNativeStackWithSerializationTest,
// Function is logged twice: once as interpreted, and once as the // Function is logged twice: once as interpreted, and once as the
// interpreter entry trampoline builtin. // interpreter entry trampoline builtin.
CHECK(logger.ContainsLinesInOrder( CHECK(logger.ContainsLinesInOrder(
{{"Function", "eyecatcher"}, {"Function", "eyecatcher"}})); {{"JS", "eyecatcher"}, {"JS", "eyecatcher"}}));
} }
v8::Local<v8::Value> arg = Number::New(isolate, 3); v8::Local<v8::Value> arg = Number::New(isolate, 3);
v8::Local<v8::Value> result = v8::Local<v8::Value> result =
...@@ -699,6 +699,7 @@ TEST_F(LogExternalLogEventListenerTest, ExternalLogEventListener) { ...@@ -699,6 +699,7 @@ TEST_F(LogExternalLogEventListenerTest, ExternalLogEventListener) {
CHECK_EQ(code_event_handler.CountLines("Function", CHECK_EQ(code_event_handler.CountLines("Function",
"testLogEventListenerBeforeStart"), "testLogEventListenerBeforeStart"),
0); 0);
// We no longer log LazyCompile.
CHECK_EQ(code_event_handler.CountLines("LazyCompile", CHECK_EQ(code_event_handler.CountLines("LazyCompile",
"testLogEventListenerBeforeStart"), "testLogEventListenerBeforeStart"),
0); 0);
...@@ -714,9 +715,13 @@ TEST_F(LogExternalLogEventListenerTest, ExternalLogEventListener) { ...@@ -714,9 +715,13 @@ TEST_F(LogExternalLogEventListenerTest, ExternalLogEventListener) {
"testLogEventListenerAfterStart('1', 1);"; "testLogEventListenerAfterStart('1', 1);";
RunJS(source_text_after_start); RunJS(source_text_after_start);
CHECK_GE(code_event_handler.CountLines("LazyCompile", CHECK_GE(code_event_handler.CountLines("Function",
"testLogEventListenerAfterStart"), "testLogEventListenerAfterStart"),
1); 1);
// We no longer log LazyCompile.
CHECK_GE(code_event_handler.CountLines("LazyCompile",
"testLogEventListenerAfterStart"),
0);
} }
} }
...@@ -845,7 +850,7 @@ TEST_F(LogExternalInterpretedFramesNativeStackTest, ...@@ -845,7 +850,7 @@ TEST_F(LogExternalInterpretedFramesNativeStackTest,
"testLogEventListenerAfterStart('1', 1);"; "testLogEventListenerAfterStart('1', 1);";
RunJS(source_text_after_start); RunJS(source_text_after_start);
CHECK_GE(code_event_handler.CountLines("LazyCompile", CHECK_GE(code_event_handler.CountLines("Function",
"testLogEventListenerAfterStart"), "testLogEventListenerAfterStart"),
2); 2);
...@@ -1185,16 +1190,16 @@ TEST_F(LogFunctionEventsTest, LogFunctionEvents) { ...@@ -1185,16 +1190,16 @@ TEST_F(LogFunctionEventsTest, LogFunctionEvents) {
// Step 4. - lazy parse, lazy compiling and execute skipped functions // Step 4. - lazy parse, lazy compiling and execute skipped functions
// - execute eager functions. // - execute eager functions.
{"function,parse-function,", ",lazyFunction"}, {"function,parse-function,", ",lazyFunction"},
{"function,interpreter-lazy,", ",lazyFunction"}, {"function,interpreter,", ",lazyFunction"},
{"function,parse-function,", ",lazyInnerFunction"}, {"function,parse-function,", ",lazyInnerFunction"},
{"function,interpreter-lazy,", ",lazyInnerFunction"}, {"function,interpreter,", ",lazyInnerFunction"},
{"function,parse-function,", ",Foo"}, {"function,parse-function,", ",Foo"},
{"function,interpreter-lazy,", ",Foo"}, {"function,interpreter,", ",Foo"},
{"function,parse-function,", ",Foo.foo"}, {"function,parse-function,", ",Foo.foo"},
{"function,interpreter-lazy,", ",Foo.foo"}, {"function,interpreter,", ",Foo.foo"},
}; };
CHECK(logger.ContainsLinesInOrder(lines)); CHECK(logger.ContainsLinesInOrder(lines));
} }
...@@ -1214,7 +1219,7 @@ TEST_F(LogTest, BuiltinsNotLoggedAsLazyCompile) { ...@@ -1214,7 +1219,7 @@ TEST_F(LogTest, BuiltinsNotLoggedAsLazyCompile) {
i_isolate); i_isolate);
v8::base::EmbeddedVector<char, 100> buffer; v8::base::EmbeddedVector<char, 100> buffer;
// Should only be logged as "Builtin" with a name, never as "LazyCompile". // Should only be logged as "Builtin" with a name, never as "Function".
v8::base::SNPrintF(buffer, ",0x%" V8PRIxPTR ",%d,BooleanConstructor", v8::base::SNPrintF(buffer, ",0x%" V8PRIxPTR ",%d,BooleanConstructor",
builtin->InstructionStart(), builtin->InstructionSize()); builtin->InstructionStart(), builtin->InstructionSize());
CHECK(logger.ContainsLine( CHECK(logger.ContainsLine(
...@@ -1223,7 +1228,7 @@ TEST_F(LogTest, BuiltinsNotLoggedAsLazyCompile) { ...@@ -1223,7 +1228,7 @@ TEST_F(LogTest, BuiltinsNotLoggedAsLazyCompile) {
v8::base::SNPrintF(buffer, ",0x%" V8PRIxPTR ",%d,", v8::base::SNPrintF(buffer, ",0x%" V8PRIxPTR ",%d,",
builtin->InstructionStart(), builtin->InstructionSize()); builtin->InstructionStart(), builtin->InstructionSize());
CHECK(!logger.ContainsLine( CHECK(!logger.ContainsLine(
{"code-creation,LazyCompile,2,", std::string(buffer.begin())})); {"code-creation,JS,2,", std::string(buffer.begin())}));
} }
} }
} // namespace v8 } // namespace v8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment