Minor improvements to opt/deopt tracing output

For the 'finish compilation' event for all tiers (SP, ML, TF),
consistently use the 'completed compiling' message prefix.

For deoptimization, print the Code object in addition to the JSFunction
(now that deopts may happen in both ML and TF).

Bug: v8:7700
Change-Id: I3375db91413195c92007db9b1b202af9bd6ac05a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3904601
Auto-Submit: Jakob Linke <jgruber@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83303}
This commit is contained in:
Jakob Linke 2022-09-19 14:00:09 +02:00 committed by V8 LUCI CQ
parent c439efdadd
commit 2b7d58d1b1
2 changed files with 13 additions and 11 deletions

View File

@ -176,13 +176,14 @@ class CompilerTracer : public AllStatic {
function->DebugNameCStr().get(), osr_offset.ToInt(), ToString(mode));
}
static void TraceCompilationStats(Isolate* isolate,
OptimizedCompilationInfo* info,
double ms_creategraph, double ms_optimize,
double ms_codegen) {
static void TraceFinishTurbofanCompile(Isolate* isolate,
OptimizedCompilationInfo* info,
double ms_creategraph,
double ms_optimize,
double ms_codegen) {
if (!v8_flags.trace_opt || !info->IsOptimizing()) return;
CodeTracer::Scope scope(isolate->GetCodeTracer());
PrintTracePrefix(scope, "optimizing", info);
PrintTracePrefix(scope, "completed compiling", info);
if (info->is_osr()) PrintF(scope.file(), " OSR");
PrintF(scope.file(), " - took %0.3f, %0.3f, %0.3f ms", ms_creategraph,
ms_optimize, ms_codegen);
@ -194,7 +195,7 @@ class CompilerTracer : public AllStatic {
double ms_timetaken) {
if (!v8_flags.trace_baseline) return;
CodeTracer::Scope scope(isolate->GetCodeTracer());
PrintTracePrefix(scope, "compiling", shared, CodeKind::BASELINE);
PrintTracePrefix(scope, "completed compiling", shared, CodeKind::BASELINE);
PrintF(scope.file(), " - took %0.3f ms", ms_timetaken);
PrintTraceSuffix(scope);
}
@ -525,7 +526,7 @@ void TurbofanCompilationJob::RecordCompilationStats(ConcurrencyMode mode,
double ms_creategraph = time_taken_to_prepare_.InMillisecondsF();
double ms_optimize = time_taken_to_execute_.InMillisecondsF();
double ms_codegen = time_taken_to_finalize_.InMillisecondsF();
CompilerTracer::TraceCompilationStats(
CompilerTracer::TraceFinishTurbofanCompile(
isolate, compilation_info(), ms_creategraph, ms_optimize, ms_codegen);
if (v8_flags.trace_opt_stats) {
static double compilation_time = 0.0;

View File

@ -678,9 +678,9 @@ void Deoptimizer::TraceDeoptBegin(int optimization_id,
MessageFor(deopt_kind_), DeoptimizeReasonToString(info.deopt_reason));
if (function_.IsJSFunction()) {
function_.ShortPrint(file);
} else {
PrintF(file, "%s", CodeKindToString(compiled_code_.kind()));
PrintF(file, ", ");
}
compiled_code_.ShortPrint(file);
PrintF(file,
", opt id %d, "
#ifdef DEBUG
@ -721,8 +721,9 @@ void Deoptimizer::TraceMarkForDeoptimization(Code code, const char* reason) {
DeoptimizationData deopt_data = DeoptimizationData::cast(maybe_data);
CodeTracer::Scope scope(isolate->GetCodeTracer());
if (FLAG_trace_deopt) {
PrintF(scope.file(), "[marking dependent code " V8PRIxPTR_FMT " (",
code.ptr());
PrintF(scope.file(), "[marking dependent code ");
code.ShortPrint(scope.file());
PrintF(scope.file(), " (");
deopt_data.SharedFunctionInfo().ShortPrint(scope.file());
PrintF(") (opt id %d) for deoptimization, reason: %s]\n",
deopt_data.OptimizationId().value(), reason);