Commit 5191f664 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Also log import wrappers

Import wrappers (wasm-to-js) were missing from profiling, since their
code is never logged.
This CL fixes this by generally logging all wasm code generated, not
just actual wasm functions.

Also, instead of logging each individual code object (which requires a
lock) within another lock, move the code out of the other lock and log
all code objects at once.

R=jkummerow@chromium.org

Bug: chromium:1029470
Change-Id: Ia250d7f3f183b2c1d8e6af4e58dd65ee27df545b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1943163
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65286}
parent cce670e7
......@@ -1068,6 +1068,8 @@ bool ExecuteCompilationUnits(
}
}
native_module->engine()->LogCode(VectorOf(code_vector));
compile_scope->compilation_state()->OnFinishedUnits(VectorOf(code_vector));
results_to_publish.clear();
};
......@@ -2422,7 +2424,6 @@ void CompilationStateImpl::OnFinishedUnits(Vector<WasmCode*> code_vector) {
} else {
// Function.
DCHECK_NE(code->tier(), ExecutionTier::kNone);
native_module_->engine()->LogCode(code);
// Read function's compilation progress.
// This view on the compilation progress may differ from the actually
......
......@@ -623,9 +623,10 @@ void WasmEngine::RemoveIsolate(Isolate* isolate) {
}
}
void WasmEngine::LogCode(WasmCode* code) {
void WasmEngine::LogCode(Vector<WasmCode*> code_vec) {
if (code_vec.empty()) return;
base::MutexGuard guard(&mutex_);
NativeModule* native_module = code->native_module();
NativeModule* native_module = code_vec[0]->native_module();
DCHECK_EQ(1, native_modules_.count(native_module));
for (Isolate* isolate : native_modules_[native_module]->isolates) {
DCHECK_EQ(1, isolates_.count(isolate));
......@@ -640,8 +641,12 @@ void WasmEngine::LogCode(WasmCode* code) {
if (info->code_to_log.empty()) {
isolate->stack_guard()->RequestLogWasmCode();
}
info->code_to_log.push_back(code);
code->IncRef();
info->code_to_log.insert(info->code_to_log.end(), code_vec.begin(),
code_vec.end());
for (WasmCode* code : code_vec) {
DCHECK_EQ(native_module, code->native_module());
code->IncRef();
}
}
}
......
......@@ -158,10 +158,10 @@ class V8_EXPORT_PRIVATE WasmEngine {
std::forward<Args>(args)...);
}
// Trigger code logging for this WasmCode in all Isolates which have access to
// the NativeModule containing this code. This method can be called from
// background threads.
void LogCode(WasmCode*);
// Trigger code logging for the given code objects in all Isolates which have
// access to the NativeModule containing this code. This method can be called
// from background threads.
void LogCode(Vector<WasmCode*>);
// Enable code logging for the given Isolate. Initially, code logging is
// enabled if {WasmCode::ShouldBeLogged(Isolate*)} returns true during
......
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