mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 18:46:03 +00:00
LibWeb/WebAssembly: Use a debug flag for dbgln calls
This prevents the horrendous console spam when functions are resolved, e.g. on the Royal Albert Hall website.
This commit is contained in:
parent
b10016d914
commit
48366ddddf
Notes:
github-actions[bot]
2024-09-07 17:45:19 +00:00
Author: https://github.com/jamierocks
Commit: 48366ddddf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1316
Reviewed-by: https://github.com/alimpfard ✅
3 changed files with 9 additions and 4 deletions
|
@ -142,6 +142,10 @@
|
||||||
# cmakedefine01 LIBWEB_CSS_DEBUG
|
# cmakedefine01 LIBWEB_CSS_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef LIBWEB_WASM_DEBUG
|
||||||
|
# cmakedefine01 LIBWEB_WASM_DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LINE_EDITOR_DEBUG
|
#ifndef LINE_EDITOR_DEBUG
|
||||||
# cmakedefine01 LINE_EDITOR_DEBUG
|
# cmakedefine01 LINE_EDITOR_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,6 +31,7 @@ set(JS_MODULE_DEBUG ON)
|
||||||
set(LEXER_DEBUG ON)
|
set(LEXER_DEBUG ON)
|
||||||
set(LIBWEB_CSS_ANIMATION_DEBUG ON)
|
set(LIBWEB_CSS_ANIMATION_DEBUG ON)
|
||||||
set(LIBWEB_CSS_DEBUG ON)
|
set(LIBWEB_CSS_DEBUG ON)
|
||||||
|
set(LIBWEB_WASM_DEBUG ON)
|
||||||
set(LINE_EDITOR_DEBUG ON)
|
set(LINE_EDITOR_DEBUG ON)
|
||||||
set(LZMA_DEBUG ON)
|
set(LZMA_DEBUG ON)
|
||||||
set(LZW_DEBUG ON)
|
set(LZW_DEBUG ON)
|
||||||
|
|
|
@ -165,9 +165,9 @@ JS::ThrowCompletionOr<NonnullOwnPtr<Wasm::ModuleInstance>> instantiate_module(JS
|
||||||
auto& cache = get_cache(*vm.current_realm());
|
auto& cache = get_cache(*vm.current_realm());
|
||||||
if (!import_argument.is_undefined()) {
|
if (!import_argument.is_undefined()) {
|
||||||
auto import_object = TRY(import_argument.to_object(vm));
|
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()) {
|
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);
|
auto value_or_error = import_object->get(import_name.module);
|
||||||
if (value_or_error.is_error())
|
if (value_or_error.is_error())
|
||||||
break;
|
break;
|
||||||
|
@ -182,7 +182,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<Wasm::ModuleInstance>> instantiate_module(JS
|
||||||
auto import_ = import_or_error.release_value();
|
auto import_ = import_or_error.release_value();
|
||||||
TRY(import_name.type.visit(
|
TRY(import_name.type.visit(
|
||||||
[&](Wasm::TypeIndex index) -> JS::ThrowCompletionOr<void> {
|
[&](Wasm::TypeIndex index) -> JS::ThrowCompletionOr<void> {
|
||||||
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()];
|
auto& type = module.type_section().types()[index.value()];
|
||||||
// FIXME: IsCallable()
|
// FIXME: IsCallable()
|
||||||
if (!import_.is_function())
|
if (!import_.is_function())
|
||||||
|
@ -229,7 +229,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<Wasm::ModuleInstance>> instantiate_module(JS
|
||||||
ByteString::formatted("func{}", resolved_imports.size()),
|
ByteString::formatted("func{}", resolved_imports.size()),
|
||||||
};
|
};
|
||||||
auto address = cache.abstract_machine().store().allocate(move(host_function));
|
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.
|
// FIXME: LinkError instead.
|
||||||
VERIFY(address.has_value());
|
VERIFY(address.has_value());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue