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