Skip to content

Commit d529da0

Browse files
gahaasCommit Bot
authored andcommitted
[wasm] Introduce v8.wasm.detailed trace event category
This CL repurposes the v8.wasm trace event category, and introduces additionally the v8.wasm.detailed category. The v8.wasm category is enabled by default and captures core wasm events like validation, compilation, instantiation, and important operations like grow-memory and tier-up timings. The v8.wasm.detailed category is disabled by default. It captures all events the previous v8.wasm category captured, like compilation of single functions, time needed for register allocation, ... This CL splits these categories to allow enabling the v8.wasm category in telemetry benchmarks to calculate compile time and other metrics from traces of telemetry runs. R=ecmziegler@chromium.org Bug: chromium:1084929 Change-Id: Ida58b8f344b0ccb6ee1210e259c3e0e993eff497 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2210230 Commit-Queue: Andreas Haas <ahaas@chromium.org> Reviewed-by: Clemens Backes <clemensb@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Reviewed-by: Emanuel Ziegler <ecmziegler@chromium.org> Cr-Commit-Position: refs/heads/master@{#68156}
1 parent b96855f commit d529da0

11 files changed

Lines changed: 73 additions & 47 deletions

src/compiler/pipeline-statistics.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ namespace compiler {
1818
namespace {
1919

2020
// We log detailed phase information about the pipeline
21-
// in both the v8.turbofan and the v8.wasm categories.
21+
// in both the v8.turbofan and the v8.wasm.detailed categories.
2222
constexpr const char kTraceCategory[] = // --
2323
TRACE_DISABLED_BY_DEFAULT("v8.turbofan") "," // --
24-
TRACE_DISABLED_BY_DEFAULT("v8.wasm");
24+
TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed");
2525

2626
} // namespace
2727

src/compiler/wasm-compiler.cc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6530,8 +6530,8 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
65306530
const wasm::FunctionSig* sig) {
65316531
DCHECK_EQ(1, sig->return_count());
65326532

6533-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
6534-
"CompileWasmMathIntrinsic");
6533+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
6534+
"wasm.CompileWasmMathIntrinsic");
65356535

65366536
Zone zone(wasm_engine->allocator(), ZONE_NAME);
65376537

@@ -6604,8 +6604,8 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
66046604
return CompileWasmMathIntrinsic(wasm_engine, kind, sig);
66056605
}
66066606

6607-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
6608-
"CompileWasmImportCallWrapper");
6607+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
6608+
"wasm.CompileWasmImportCallWrapper");
66096609
//----------------------------------------------------------------------------
66106610
// Create the Graph
66116611
//----------------------------------------------------------------------------
@@ -6647,7 +6647,8 @@ wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::WasmEngine* wasm_engine,
66476647
wasm::NativeModule* native_module,
66486648
const wasm::FunctionSig* sig,
66496649
Address address) {
6650-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "CompileWasmCapiFunction");
6650+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
6651+
"wasm.CompileWasmCapiFunction");
66516652

66526653
Zone zone(wasm_engine->allocator(), ZONE_NAME);
66536654

@@ -6858,9 +6859,9 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation(
68586859
wasm::WasmEngine* wasm_engine, wasm::CompilationEnv* env,
68596860
const wasm::FunctionBody& func_body, int func_index, Counters* counters,
68606861
wasm::WasmFeatures* detected) {
6861-
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
6862-
"ExecuteTurbofanCompilation", "func_index", func_index,
6863-
"body_size", func_body.end - func_body.start);
6862+
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
6863+
"wasm.CompileTopTier", "func_index", func_index, "body_size",
6864+
func_body.end - func_body.start);
68646865
Zone zone(wasm_engine->allocator(), ZONE_NAME);
68656866
MachineGraph* mcgraph = new (&zone) MachineGraph(
68666867
new (&zone) Graph(&zone), new (&zone) CommonOperatorBuilder(&zone),

src/execution/stack-guard.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ Object StackGuard::HandleInterrupts() {
272272
}
273273

274274
if (TestAndClear(&interrupt_flags, GROW_SHARED_MEMORY)) {
275-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
276-
"V8.WasmGrowSharedMemory");
275+
TRACE_EVENT0("v8.wasm", "V8.WasmGrowSharedMemory");
277276
BackingStore::UpdateSharedWasmMemoryObjects(isolate_);
278277
}
279278

@@ -297,12 +296,12 @@ Object StackGuard::HandleInterrupts() {
297296
}
298297

299298
if (TestAndClear(&interrupt_flags, LOG_WASM_CODE)) {
300-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "LogCode");
299+
TRACE_EVENT0("v8.wasm", "V8.LogCode");
301300
isolate_->wasm_engine()->LogOutstandingCodesForIsolate(isolate_);
302301
}
303302

304303
if (TestAndClear(&interrupt_flags, WASM_CODE_GC)) {
305-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "WasmCodeGC");
304+
TRACE_EVENT0("v8.wasm", "V8.WasmCodeGC");
306305
isolate_->wasm_engine()->ReportLiveCodeFromStackForGC(isolate_);
307306
}
308307

src/tracing/trace-categories.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ PERFETTO_DEFINE_CATEGORIES(
3232
perfetto::Category("v8.console"),
3333
perfetto::Category("v8.execute"),
3434
perfetto::Category("v8.runtime"),
35+
perfetto::Category("v8.wasm"),
3536
perfetto::Category::Group("devtools.timeline,v8"),
3637
perfetto::Category::Group("devtools.timeline,"
3738
TRACE_DISABLED_BY_DEFAULT("v8.gc")),
@@ -46,11 +47,11 @@ PERFETTO_DEFINE_CATEGORIES(
4647
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats")),
4748
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats_sampling")),
4849
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.turbofan")),
49-
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.wasm")),
50+
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed")),
5051
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.zone_stats")),
5152
perfetto::Category::Group("v8,devtools.timeline"),
5253
perfetto::Category::Group(TRACE_DISABLED_BY_DEFAULT("v8.turbofan") ","
53-
TRACE_DISABLED_BY_DEFAULT("v8.wasm")));
54+
TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed")));
5455
// clang-format on
5556

5657
#endif // defined(V8_USE_PERFETTO)

src/wasm/baseline/liftoff-compiler.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3710,9 +3710,9 @@ WasmCompilationResult ExecuteLiftoffCompilation(
37103710
std::unique_ptr<DebugSideTable>* debug_sidetable,
37113711
Vector<int> extra_source_pos) {
37123712
int func_body_size = static_cast<int>(func_body.end - func_body.start);
3713-
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
3714-
"ExecuteLiftoffCompilation", "func_index", func_index,
3715-
"body_size", func_body_size);
3713+
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
3714+
"wasm.CompileBaseline", "func_index", func_index, "body_size",
3715+
func_body_size);
37163716

37173717
Zone zone(allocator, "LiftoffCompilationZone");
37183718
auto call_descriptor = compiler::GetWasmCallDescriptor(&zone, func_body.sig);

src/wasm/function-compiler.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ JSToWasmWrapperCompilationUnit::JSToWasmWrapperCompilationUnit(
278278
JSToWasmWrapperCompilationUnit::~JSToWasmWrapperCompilationUnit() = default;
279279

280280
void JSToWasmWrapperCompilationUnit::Execute() {
281-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "CompileJSToWasmWrapper");
281+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
282+
"wasm.CompileJSToWasmWrapper");
282283
CompilationJob::Status status = job_->ExecuteJob(nullptr);
283284
CHECK_EQ(status, CompilationJob::SUCCEEDED);
284285
}

src/wasm/module-compiler.cc

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ bool ExecuteCompilationUnits(
10471047
const std::shared_ptr<BackgroundCompileToken>& token, Counters* counters,
10481048
int task_id, CompileBaselineOnly baseline_only) {
10491049
TRACE_COMPILE("Compiling (task %d)...\n", task_id);
1050-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "ExecuteCompilationUnits");
1050+
TRACE_EVENT0("v8.wasm", "wasm.ExecuteCompilationUnits");
10511051

10521052
// Execute JS to Wasm wrapper units first, so that they are ready to be
10531053
// finalized by the main thread when the kFinishedBaselineCompilation event is
@@ -1108,8 +1108,9 @@ bool ExecuteCompilationUnits(
11081108

11091109
auto publish_results = [&results_to_publish](
11101110
BackgroundCompileScope* compile_scope) {
1111-
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "PublishResults",
1112-
"num_results", results_to_publish.size());
1111+
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
1112+
"wasm.PublishCompilationResults", "num_results",
1113+
results_to_publish.size());
11131114
if (results_to_publish.empty()) return;
11141115
std::vector<std::unique_ptr<WasmCode>> unpublished_code =
11151116
compile_scope->native_module()->AddCompiledCode(
@@ -1512,7 +1513,8 @@ AsyncCompileJob::AsyncCompileJob(
15121513
bytes_copy_(std::move(bytes_copy)),
15131514
wire_bytes_(bytes_copy_.get(), bytes_copy_.get() + length),
15141515
resolver_(std::move(resolver)) {
1515-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "new AsyncCompileJob");
1516+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
1517+
"wasm.AsyncCompileJob");
15161518
CHECK(FLAG_wasm_async_compilation);
15171519
CHECK(!FLAG_jitless);
15181520
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
@@ -1660,8 +1662,8 @@ void AsyncCompileJob::PrepareRuntimeObjects() {
16601662
// This function assumes that it is executed in a HandleScope, and that a
16611663
// context is set on the isolate.
16621664
void AsyncCompileJob::FinishCompile(bool is_after_cache_hit) {
1663-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
1664-
"AsyncCompileJob::FinishCompile");
1665+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
1666+
"wasm.FinishAsyncCompile");
16651667
bool is_after_deserialization = !module_object_.is_null();
16661668
auto compilation_state = Impl(native_module_->compilation_state());
16671669
if (!is_after_deserialization) {
@@ -1693,7 +1695,8 @@ void AsyncCompileJob::FinishCompile(bool is_after_cache_hit) {
16931695
script->set_source_mapping_url(*src_map_str.ToHandleChecked());
16941696
}
16951697
{
1696-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "Debug::OnAfterCompile");
1698+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
1699+
"wasm.Debug.OnAfterCompile");
16971700
isolate_->debug()->OnAfterCompile(script);
16981701
}
16991702

@@ -1740,8 +1743,8 @@ void AsyncCompileJob::AsyncCompileFailed() {
17401743
}
17411744

17421745
void AsyncCompileJob::AsyncCompileSucceeded(Handle<WasmModuleObject> result) {
1743-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
1744-
"CompilationResultResolver::OnCompilationSucceeded");
1746+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
1747+
"wasm.OnCompilationSucceeded");
17451748
resolver_->OnCompilationSucceeded(result);
17461749
}
17471750

@@ -1938,8 +1941,8 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep {
19381941
DisallowHeapAllocation no_allocation;
19391942
// Decode the module bytes.
19401943
TRACE_COMPILE("(1) Decoding module...\n");
1941-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
1942-
"AsyncCompileJob::DecodeModule");
1944+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
1945+
"wasm.DecodeModule");
19431946
auto enabled_features = job->enabled_features_;
19441947
result = DecodeWasmModule(enabled_features, job->wire_bytes_.start(),
19451948
job->wire_bytes_.end(), false, kWasmOrigin,
@@ -2446,6 +2449,7 @@ void AsyncStreamingProcessor::OnAbort() {
24462449

24472450
bool AsyncStreamingProcessor::Deserialize(Vector<const uint8_t> module_bytes,
24482451
Vector<const uint8_t> wire_bytes) {
2452+
TRACE_EVENT0("v8.wasm", "wasm.Deserialize");
24492453
// DeserializeNativeModule and FinishCompile assume that they are executed in
24502454
// a HandleScope, and that a context is set on the isolate.
24512455
HandleScope scope(job_->isolate_);
@@ -2690,8 +2694,9 @@ void CompilationStateImpl::FinalizeJSToWasmWrappers(
26902694
// TODO(6792): Wrappers below are allocated with {Factory::NewCode}. As an
26912695
// optimization we keep the code space unlocked to avoid repeated unlocking
26922696
// because many such wrapper are allocated in sequence below.
2693-
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "FinalizeJSToWasmWrappers",
2694-
"num_wrappers", js_to_wasm_wrapper_units_.size());
2697+
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
2698+
"wasm.FinalizeJSToWasmWrappers", "num_wrappers",
2699+
js_to_wasm_wrapper_units_.size());
26952700
CodeSpaceMemoryModificationScope modification_scope(isolate->heap());
26962701
for (auto& unit : js_to_wasm_wrapper_units_) {
26972702
Handle<Code> code = unit->Finalize(isolate);
@@ -2709,8 +2714,8 @@ CompilationStateImpl::GetNextCompilationUnit(
27092714
}
27102715

27112716
void CompilationStateImpl::OnFinishedUnits(Vector<WasmCode*> code_vector) {
2712-
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "OnFinishedUnits",
2713-
"num_units", code_vector.size());
2717+
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
2718+
"wasm.OnFinishedUnits", "num_units", code_vector.size());
27142719

27152720
base::MutexGuard guard(&callbacks_mutex_);
27162721

@@ -2833,13 +2838,13 @@ void CompilationStateImpl::TriggerCallbacks(
28332838

28342839
for (auto event :
28352840
{std::make_pair(CompilationEvent::kFinishedBaselineCompilation,
2836-
"BaselineFinished"),
2841+
"wasm.BaselineFinished"),
28372842
std::make_pair(CompilationEvent::kFinishedTopTierCompilation,
2838-
"TopTierFinished"),
2843+
"wasm.TopTierFinished"),
28392844
std::make_pair(CompilationEvent::kFinishedRecompilation,
2840-
"RecompilationFinished")}) {
2845+
"wasm.RecompilationFinished")}) {
28412846
if (!triggered_events.contains(event.first)) continue;
2842-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), event.second);
2847+
TRACE_EVENT0("v8.wasm", event.second);
28432848
for (auto& callback : callbacks_) {
28442849
callback(event.first);
28452850
}

src/wasm/module-instantiate.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ InstanceBuilder::InstanceBuilder(Isolate* isolate, ErrorThrower* thrower,
304304

305305
// Build an instance, in all of its glory.
306306
MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
307-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "InstanceBuilder::Build");
307+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
308+
"wasm.InstanceBuilder.Build");
308309
// Check that an imports argument was provided, if the module requires it.
309310
// No point in continuing otherwise.
310311
if (!module_->import_table.empty() && ffi_.is_null()) {
@@ -616,8 +617,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
616617
}
617618

618619
bool InstanceBuilder::ExecuteStartFunction() {
619-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
620-
"InstanceBuilder::ExecuteStartFunction");
620+
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
621+
"wasm.ExecuteStartFunction");
621622
if (start_function_.is_null()) return true; // No start function.
622623

623624
HandleScope scope(isolate_);

src/wasm/wasm-engine.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ WasmEngine::~WasmEngine() {
409409

410410
bool WasmEngine::SyncValidate(Isolate* isolate, const WasmFeatures& enabled,
411411
const ModuleWireBytes& bytes) {
412+
TRACE_EVENT0("v8.wasm", "wasm.SyncValidate");
412413
// TODO(titzer): remove dependency on the isolate.
413414
if (bytes.start() == nullptr || bytes.length() == 0) return false;
414415
ModuleResult result =
@@ -421,6 +422,7 @@ MaybeHandle<AsmWasmData> WasmEngine::SyncCompileTranslatedAsmJs(
421422
Isolate* isolate, ErrorThrower* thrower, const ModuleWireBytes& bytes,
422423
Vector<const byte> asm_js_offset_table_bytes,
423424
Handle<HeapNumber> uses_bitset, LanguageMode language_mode) {
425+
TRACE_EVENT0("v8.wasm", "wasm.SyncCompileTranslatedAsmJs");
424426
ModuleOrigin origin = language_mode == LanguageMode::kSloppy
425427
? kAsmJsSloppyOrigin
426428
: kAsmJsStrictOrigin;
@@ -464,6 +466,7 @@ Handle<WasmModuleObject> WasmEngine::FinalizeTranslatedAsmJs(
464466
MaybeHandle<WasmModuleObject> WasmEngine::SyncCompile(
465467
Isolate* isolate, const WasmFeatures& enabled, ErrorThrower* thrower,
466468
const ModuleWireBytes& bytes) {
469+
TRACE_EVENT0("v8.wasm", "wasm.SyncCompile");
467470
ModuleResult result =
468471
DecodeWasmModule(enabled, bytes.start(), bytes.end(), false, kWasmOrigin,
469472
isolate->counters(), allocator());
@@ -509,6 +512,7 @@ MaybeHandle<WasmInstanceObject> WasmEngine::SyncInstantiate(
509512
Isolate* isolate, ErrorThrower* thrower,
510513
Handle<WasmModuleObject> module_object, MaybeHandle<JSReceiver> imports,
511514
MaybeHandle<JSArrayBuffer> memory) {
515+
TRACE_EVENT0("v8.wasm", "wasm.SyncInstantiate");
512516
return InstantiateToInstanceObject(isolate, thrower, module_object, imports,
513517
memory);
514518
}
@@ -517,6 +521,7 @@ void WasmEngine::AsyncInstantiate(
517521
Isolate* isolate, std::unique_ptr<InstantiationResultResolver> resolver,
518522
Handle<WasmModuleObject> module_object, MaybeHandle<JSReceiver> imports) {
519523
ErrorThrower thrower(isolate, "WebAssembly.instantiate()");
524+
TRACE_EVENT0("v8.wasm", "wasm.AsyncInstantiate");
520525
// Instantiate a TryCatch so that caught exceptions won't progagate out.
521526
// They will still be set as pending exceptions on the isolate.
522527
// TODO(clemensb): Avoid TryCatch, use Execution::TryCall internally to invoke
@@ -552,6 +557,7 @@ void WasmEngine::AsyncCompile(
552557
std::shared_ptr<CompilationResultResolver> resolver,
553558
const ModuleWireBytes& bytes, bool is_shared,
554559
const char* api_method_name_for_errors) {
560+
TRACE_EVENT0("v8.wasm", "wasm.AsyncCompile");
555561
if (!FLAG_wasm_async_compilation) {
556562
// Asynchronous compilation disabled; fall back on synchronous compilation.
557563
ErrorThrower thrower(isolate, api_method_name_for_errors);
@@ -600,6 +606,7 @@ std::shared_ptr<StreamingDecoder> WasmEngine::StartStreamingCompilation(
600606
Isolate* isolate, const WasmFeatures& enabled, Handle<Context> context,
601607
const char* api_method_name,
602608
std::shared_ptr<CompilationResultResolver> resolver) {
609+
TRACE_EVENT0("v8.wasm", "wasm.StartStreamingCompilation");
603610
if (FLAG_wasm_async_compilation) {
604611
AsyncCompileJob* job = CreateAsyncCompileJob(
605612
isolate, enabled, std::unique_ptr<byte[]>(nullptr), 0, context,
@@ -1170,7 +1177,7 @@ void WasmEngine::SampleTopTierCodeSizeInAllIsolates(
11701177

11711178
void WasmEngine::ReportLiveCodeForGC(Isolate* isolate,
11721179
Vector<WasmCode*> live_code) {
1173-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "ReportLiveCodeForGC");
1180+
TRACE_EVENT0("v8.wasm", "wasm.ReportLiveCodeForGC");
11741181
TRACE_CODE_GC("Isolate %d reporting %zu live code objects.\n", isolate->id(),
11751182
live_code.size());
11761183
base::MutexGuard guard(&mutex_);
@@ -1243,7 +1250,7 @@ void WasmEngine::FreeDeadCode(const DeadCodeMap& dead_code) {
12431250
}
12441251

12451252
void WasmEngine::FreeDeadCodeLocked(const DeadCodeMap& dead_code) {
1246-
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "FreeDeadCode");
1253+
TRACE_EVENT0("v8.wasm", "wasm.FreeDeadCode");
12471254
DCHECK(!mutex_.TryLock());
12481255
for (auto& dead_code_entry : dead_code) {
12491256
NativeModule* native_module = dead_code_entry.first;

src/wasm/wasm-js.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,37 +93,48 @@ class WasmStreaming::WasmStreamingImpl {
9393
};
9494

9595
WasmStreaming::WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl)
96-
: impl_(std::move(impl)) {}
96+
: impl_(std::move(impl)) {
97+
TRACE_EVENT0("v8.wasm", "wasm.InitializeStreaming");
98+
}
9799

98100
// The destructor is defined here because we have a unique_ptr with forward
99101
// declaration.
100102
WasmStreaming::~WasmStreaming() = default;
101103

102104
void WasmStreaming::OnBytesReceived(const uint8_t* bytes, size_t size) {
105+
TRACE_EVENT1("v8.wasm", "wasm.OnBytesReceived", "num_bytes", size);
103106
impl_->OnBytesReceived(bytes, size);
104107
}
105108

106-
void WasmStreaming::Finish() { impl_->Finish(); }
109+
void WasmStreaming::Finish() {
110+
TRACE_EVENT0("v8.wasm", "wasm.FinishStreaming");
111+
impl_->Finish();
112+
}
107113

108114
void WasmStreaming::Abort(MaybeLocal<Value> exception) {
115+
TRACE_EVENT0("v8.wasm", "wasm.AbortStreaming");
109116
impl_->Abort(exception);
110117
}
111118

112119
bool WasmStreaming::SetCompiledModuleBytes(const uint8_t* bytes, size_t size) {
120+
TRACE_EVENT0("v8.wasm", "wasm.SetCompiledModuleBytes");
113121
return impl_->SetCompiledModuleBytes(bytes, size);
114122
}
115123

116124
void WasmStreaming::SetClient(std::shared_ptr<Client> client) {
125+
TRACE_EVENT0("v8.wasm", "wasm.WasmStreaming.SetClient");
117126
impl_->SetClient(client);
118127
}
119128

120129
void WasmStreaming::SetUrl(const char* url, size_t length) {
130+
TRACE_EVENT0("v8.wasm", "wasm.SetUrl");
121131
impl_->SetUrl(internal::VectorOf(url, length));
122132
}
123133

124134
// static
125135
std::shared_ptr<WasmStreaming> WasmStreaming::Unpack(Isolate* isolate,
126136
Local<Value> value) {
137+
TRACE_EVENT0("v8.wasm", "wasm.WasmStreaming.Unpack");
127138
i::HandleScope scope(reinterpret_cast<i::Isolate*>(isolate));
128139
auto managed =
129140
i::Handle<i::Managed<WasmStreaming>>::cast(Utils::OpenHandle(*value));

0 commit comments

Comments
 (0)