Commit 42c67f25 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Add some basic trace events

This adds trace events for Liftoff compilation, Turbofan compilation,
instantiation and running the start function. These are basic
operations that help to understand the startup behaviour of WebAssembly
modules.

R=ahaas@chromium.org

Change-Id: I0c0544cfd2d03de1783fa1d3a5897d3b8ef09e05
Reviewed-on: https://chromium-review.googlesource.com/1134768
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54434}
parent 3ffeaac8
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "src/isolate-inl.h" #include "src/isolate-inl.h"
#include "src/log-inl.h" #include "src/log-inl.h"
#include "src/optimized-compilation-info.h" #include "src/optimized-compilation-info.h"
#include "src/tracing/trace-event.h"
#include "src/trap-handler/trap-handler.h" #include "src/trap-handler/trap-handler.h"
#include "src/wasm/function-body-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/function-compiler.h" #include "src/wasm/function-compiler.h"
...@@ -5154,6 +5155,8 @@ Vector<const char> GetDebugName(Zone* zone, wasm::WasmName name, int index) { ...@@ -5154,6 +5155,8 @@ Vector<const char> GetDebugName(Zone* zone, wasm::WasmName name, int index) {
} // namespace } // namespace
void TurbofanWasmCompilationUnit::ExecuteCompilation() { void TurbofanWasmCompilationUnit::ExecuteCompilation() {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
"ExecuteTurbofanCompilation");
double decode_ms = 0; double decode_ms = 0;
size_t node_count = 0; size_t node_count = 0;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "src/compiler/wasm-compiler.h" #include "src/compiler/wasm-compiler.h"
#include "src/counters.h" #include "src/counters.h"
#include "src/macro-assembler-inl.h" #include "src/macro-assembler-inl.h"
#include "src/tracing/trace-event.h"
#include "src/wasm/baseline/liftoff-assembler.h" #include "src/wasm/baseline/liftoff-assembler.h"
#include "src/wasm/function-body-decoder-impl.h" #include "src/wasm/function-body-decoder-impl.h"
#include "src/wasm/function-compiler.h" #include "src/wasm/function-compiler.h"
...@@ -1832,6 +1833,8 @@ class LiftoffCompiler { ...@@ -1832,6 +1833,8 @@ class LiftoffCompiler {
} // namespace } // namespace
bool LiftoffCompilationUnit::ExecuteCompilation() { bool LiftoffCompilationUnit::ExecuteCompilation() {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
"ExecuteLiftoffCompilation");
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();
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "src/counters.h" #include "src/counters.h"
#include "src/identity-map.h" #include "src/identity-map.h"
#include "src/property-descriptor.h" #include "src/property-descriptor.h"
#include "src/tracing/trace-event.h"
#include "src/trap-handler/trap-handler.h" #include "src/trap-handler/trap-handler.h"
#include "src/wasm/module-decoder.h" #include "src/wasm/module-decoder.h"
#include "src/wasm/streaming-decoder.h" #include "src/wasm/streaming-decoder.h"
...@@ -577,6 +578,7 @@ void InitializeCompilationUnits(NativeModule* native_module) { ...@@ -577,6 +578,7 @@ void InitializeCompilationUnits(NativeModule* native_module) {
void FinishCompilationUnits(CompilationState* compilation_state, void FinishCompilationUnits(CompilationState* compilation_state,
ErrorThrower* thrower) { ErrorThrower* thrower) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "FinishCompilationUnits");
while (true) { while (true) {
if (compilation_state->failed()) break; if (compilation_state->failed()) break;
std::unique_ptr<WasmCompilationUnit> unit = std::unique_ptr<WasmCompilationUnit> unit =
...@@ -959,6 +961,7 @@ InstanceBuilder::InstanceBuilder(Isolate* isolate, ErrorThrower* thrower, ...@@ -959,6 +961,7 @@ InstanceBuilder::InstanceBuilder(Isolate* isolate, ErrorThrower* thrower,
// Build an instance, in all of its glory. // Build an instance, in all of its glory.
MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() { MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "InstanceBuilder::Build");
// Check that an imports argument was provided, if the module requires it. // Check that an imports argument was provided, if the module requires it.
// No point in continuing otherwise. // No point in continuing otherwise.
if (!module_->import_table.empty() && ffi_.is_null()) { if (!module_->import_table.empty() && ffi_.is_null()) {
...@@ -1235,6 +1238,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() { ...@@ -1235,6 +1238,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
} }
bool InstanceBuilder::ExecuteStartFunction() { bool InstanceBuilder::ExecuteStartFunction() {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
"InstanceBuilder::ExecuteStartFunction");
if (start_function_.is_null()) return true; // No start function. if (start_function_.is_null()) return true; // No start function.
HandleScope scope(isolate_); HandleScope scope(isolate_);
......
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