[wasm] Add some more information to trace events

When tracing function compilations, do also trace the function index
and the function body size. This information often helps investigating
bottlenecks in compilation.

R=ahaas@chromium.org

Bug: v8:8916, chromium:950493
Change-Id: Ibabd1b59827b67ac9b0ef3a78f121ab8fb2c4e09
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1622111
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61701}
This commit is contained in:
Clemens Hammacher 2019-05-21 15:47:13 +02:00 committed by Commit Bot
parent 93ccfb74db
commit a031112eeb
4 changed files with 14 additions and 8 deletions

View File

@ -6450,8 +6450,10 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation(
wasm::WasmEngine* wasm_engine, wasm::CompilationEnv* env, wasm::WasmEngine* wasm_engine, wasm::CompilationEnv* env,
const wasm::FunctionBody& func_body, int func_index, Counters* counters, const wasm::FunctionBody& func_body, int func_index, Counters* counters,
wasm::WasmFeatures* detected) { wasm::WasmFeatures* detected) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
"ExecuteTurbofanCompilation"); "ExecuteTurbofanCompilation", "func_index", func_index,
"body_size",
static_cast<uint32_t>(func_body.end - func_body.start));
double decode_ms = 0; double decode_ms = 0;
size_t node_count = 0; size_t node_count = 0;

View File

@ -2051,10 +2051,13 @@ class LiftoffCompiler {
WasmCompilationResult ExecuteLiftoffCompilation(AccountingAllocator* allocator, WasmCompilationResult ExecuteLiftoffCompilation(AccountingAllocator* allocator,
CompilationEnv* env, CompilationEnv* env,
const FunctionBody& func_body, const FunctionBody& func_body,
int func_index,
Counters* counters, Counters* counters,
WasmFeatures* detected) { WasmFeatures* detected) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
"ExecuteLiftoffCompilation"); "ExecuteLiftoffCompilation", "func_index", func_index,
"body_size",
static_cast<uint32_t>(func_body.end - func_body.start));
base::ElapsedTimer compile_timer; base::ElapsedTimer compile_timer;
if (FLAG_trace_wasm_decode_time) { if (FLAG_trace_wasm_decode_time) {
compile_timer.Start(); compile_timer.Start();

View File

@ -20,8 +20,8 @@ struct FunctionBody;
struct WasmFeatures; struct WasmFeatures;
WasmCompilationResult ExecuteLiftoffCompilation( WasmCompilationResult ExecuteLiftoffCompilation(
AccountingAllocator*, CompilationEnv*, const FunctionBody&, Counters*, AccountingAllocator*, CompilationEnv*, const FunctionBody&, int func_index,
WasmFeatures* detected_features); Counters*, WasmFeatures* detected_features);
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal

View File

@ -145,8 +145,9 @@ WasmCompilationResult WasmCompilationUnit::ExecuteCompilation(
if (V8_LIKELY(FLAG_wasm_tier_mask_for_testing == 0) || if (V8_LIKELY(FLAG_wasm_tier_mask_for_testing == 0) ||
func_index_ >= 32 || func_index_ >= 32 ||
((FLAG_wasm_tier_mask_for_testing & (1 << func_index_)) == 0)) { ((FLAG_wasm_tier_mask_for_testing & (1 << func_index_)) == 0)) {
result = ExecuteLiftoffCompilation(wasm_engine->allocator(), env, result =
func_body, counters, detected); ExecuteLiftoffCompilation(wasm_engine->allocator(), env, func_body,
func_index_, counters, detected);
if (result.succeeded()) break; if (result.succeeded()) break;
} }