diff --git a/AK/Debug.h.in b/AK/Debug.h.in index bf6c55a5044..2e192899461 100644 --- a/AK/Debug.h.in +++ b/AK/Debug.h.in @@ -142,6 +142,10 @@ # cmakedefine01 LIBWEB_CSS_DEBUG #endif +#ifndef LIBWEB_WASM_DEBUG +# cmakedefine01 LIBWEB_WASM_DEBUG +#endif + #ifndef LINE_EDITOR_DEBUG # cmakedefine01 LINE_EDITOR_DEBUG #endif diff --git a/Meta/CMake/all_the_debug_macros.cmake b/Meta/CMake/all_the_debug_macros.cmake index 90b4cea1fa7..ddef7394e78 100644 --- a/Meta/CMake/all_the_debug_macros.cmake +++ b/Meta/CMake/all_the_debug_macros.cmake @@ -31,6 +31,7 @@ set(JS_MODULE_DEBUG ON) set(LEXER_DEBUG ON) set(LIBWEB_CSS_ANIMATION_DEBUG ON) set(LIBWEB_CSS_DEBUG ON) +set(LIBWEB_WASM_DEBUG ON) set(LINE_EDITOR_DEBUG ON) set(LZMA_DEBUG ON) set(LZW_DEBUG ON) diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssembly.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssembly.cpp index b1c466a5e54..53062c5ab50 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssembly.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssembly.cpp @@ -165,9 +165,9 @@ JS::ThrowCompletionOr> instantiate_module(JS auto& cache = get_cache(*vm.current_realm()); if (!import_argument.is_undefined()) { auto import_object = TRY(import_argument.to_object(vm)); - dbgln("Trying to resolve stuff because import object was specified"); + dbgln_if(LIBWEB_WASM_DEBUG, "Trying to resolve stuff because import object was specified"); for (Wasm::Linker::Name const& import_name : linker.unresolved_imports()) { - dbgln("Trying to resolve {}::{}", import_name.module, import_name.name); + dbgln_if(LIBWEB_WASM_DEBUG, "Trying to resolve {}::{}", import_name.module, import_name.name); auto value_or_error = import_object->get(import_name.module); if (value_or_error.is_error()) break; @@ -182,7 +182,7 @@ JS::ThrowCompletionOr> instantiate_module(JS auto import_ = import_or_error.release_value(); TRY(import_name.type.visit( [&](Wasm::TypeIndex index) -> JS::ThrowCompletionOr { - dbgln("Trying to resolve a function {}::{}, type index {}", import_name.module, import_name.name, index.value()); + dbgln_if(LIBWEB_WASM_DEBUG, "Trying to resolve a function {}::{}, type index {}", import_name.module, import_name.name, index.value()); auto& type = module.type_section().types()[index.value()]; // FIXME: IsCallable() if (!import_.is_function()) @@ -229,7 +229,7 @@ JS::ThrowCompletionOr> instantiate_module(JS ByteString::formatted("func{}", resolved_imports.size()), }; auto address = cache.abstract_machine().store().allocate(move(host_function)); - dbgln("Resolved to {}", address->value()); + dbgln_if(LIBWEB_WASM_DEBUG, "Resolved to {}", address->value()); // FIXME: LinkError instead. VERIFY(address.has_value());