[wasm] Move {LogWasmCodes} to the native module

{LogWasmCodes} is independent of the runtime object, so it should be
defined on the {NativeModule}.

R=herhut@chromium.org

Change-Id: I1202b18264ef0367004ba80e0030b057c633b62f
Reviewed-on: https://chromium-review.googlesource.com/1102424
Reviewed-by: Stephan Herhut <herhut@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53764}
This commit is contained in:
Clemens Hammacher 2018-06-15 14:00:30 +02:00 committed by Commit Bot
parent b9401e42d1
commit 082422c409
7 changed files with 16 additions and 19 deletions

View File

@ -2095,7 +2095,7 @@ void ExistingCodeLogger::LogCompiledFunctions() {
ScopedVector<Handle<WasmCompiledModule>> modules(compiled_wasm_modules_count);
EnumerateWasmModules(heap, modules.start());
for (int i = 0; i < compiled_wasm_modules_count; ++i) {
modules[i]->LogWasmCodes(isolate_);
modules[i]->GetNativeModule()->LogWasmCodes(isolate_);
}
}

View File

@ -1409,7 +1409,7 @@ MaybeHandle<WasmModuleObject> CompileToModuleObjectInternal(
}
// Log the code within the generated module for profiling.
compiled_module->LogWasmCodes(isolate);
compiled_module->GetNativeModule()->LogWasmCodes(isolate);
return module_object;
}
@ -2924,7 +2924,7 @@ void AsyncCompileJob::FinishCompile() {
isolate_->debug()->OnAfterCompile(script);
// Log the code within the generated module for profiling.
compiled_module_->LogWasmCodes(isolate_);
compiled_module_->GetNativeModule()->LogWasmCodes(isolate_);
// TODO(wasm): compiling wrappers should be made async as well.
DoSync<CompileWrappers>();

View File

@ -360,6 +360,16 @@ void NativeModule::SetCodeForTesting(uint32_t index, WasmCode* code) {
code_table_[index - num_imported_functions_] = code;
}
void NativeModule::LogWasmCodes(Isolate* isolate) {
if (!wasm::WasmCode::ShouldBeLogged(isolate)) return;
// TODO(titzer): we skip the logging of the import wrappers
// here, but they should be included somehow.
for (wasm::WasmCode* code : code_table()) {
if (code != nullptr) code->LogCode(isolate);
}
}
WasmCode* NativeModule::AddOwnedCode(
Vector<const byte> orig_instructions,
std::unique_ptr<const byte[]> reloc_info, size_t reloc_size,

View File

@ -310,6 +310,8 @@ class V8_EXPORT_PRIVATE NativeModule final {
void SetNumFunctionsForTesting(uint32_t num_functions);
void SetCodeForTesting(uint32_t index, WasmCode* code);
void LogWasmCodes(Isolate* isolate);
CompilationState* compilation_state() { return compilation_state_.get(); }
// TODO(mstarzinger): The link to the {WasmModuleObject} is deprecated and

View File

@ -1595,19 +1595,6 @@ void WasmCompiledModule::RemoveFromChain() {
}
}
void WasmCompiledModule::LogWasmCodes(Isolate* isolate) {
if (!wasm::WasmCode::ShouldBeLogged(isolate)) return;
wasm::NativeModule* native_module = GetNativeModule();
if (native_module == nullptr) return;
// TODO(titzer): we skip the logging of the import wrappers
// here, but they should be included somehow.
for (wasm::WasmCode* code : native_module->code_table()) {
if (code == nullptr) continue;
code->LogCode(isolate);
}
}
#undef TRACE
#undef TRACE_IFT
} // namespace internal

View File

@ -593,8 +593,6 @@ class WasmCompiledModule : public Struct {
void PrintInstancesChain();
void LogWasmCodes(Isolate* isolate);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule);
};

View File

@ -628,7 +628,7 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
WasmCompiledModule::Reset(isolate, *compiled_module);
// Log the code within the generated module for profiling.
compiled_module->LogWasmCodes(isolate);
native_module->LogWasmCodes(isolate);
return module_object;
}