1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibJS/JIT: Dump disassembly of generated code using LibX86

This avoids the need for redirecting stdout to a file and using
ndisasm, which can lead to problems if other things are printed.
This commit is contained in:
Simon Wanner 2023-10-23 18:37:29 +02:00 committed by Andreas Kling
parent 1d68c64b98
commit ec8330b647
4 changed files with 48 additions and 1 deletions

View file

@ -24,6 +24,7 @@
# define LOG_JIT_SUCCESS 1
# define LOG_JIT_FAILURE 1
# define DUMP_JIT_MACHINE_CODE_TO_STDOUT 0
# define DUMP_JIT_DISASSEMBLY 0
# define TRY_OR_SET_EXCEPTION(expression) \
({ \
@ -1154,7 +1155,10 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_execut
dbgln("\033[32;1mJIT compilation succeeded!\033[0m {}", bytecode_executable.name);
}
return make<NativeExecutable>(executable_memory, compiler.m_output.size());
auto executable = make<NativeExecutable>(executable_memory, compiler.m_output.size());
if constexpr (DUMP_JIT_DISASSEMBLY)
executable->dump_disassembly();
return executable;
}
}