mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 21:54:40 +03:00
LibJS: Move bytecode debug spam behind JS_BYTECODE_DEBUG :^)
This commit is contained in:
parent
e7d69c5d3c
commit
7cbe4daa7c
Notes:
sideshowbarker
2024-07-18 12:41:44 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7cbe4daa7ca
@ -226,6 +226,10 @@
|
||||
#cmakedefine01 JPG_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef JS_BYTECODE_DEBUG
|
||||
#cmakedefine01 JS_BYTECODE_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef KEYBOARD_SHORTCUTS_DEBUG
|
||||
#cmakedefine01 KEYBOARD_SHORTCUTS_DEBUG
|
||||
#endif
|
||||
|
@ -88,6 +88,7 @@ set(IRQ_DEBUG ON)
|
||||
set(ITEM_RECTS_DEBUG ON)
|
||||
set(JOB_DEBUG ON)
|
||||
set(JPG_DEBUG ON)
|
||||
set(JS_BYTECODE_DEBUG ON)
|
||||
set(KEYBOARD_DEBUG ON)
|
||||
set(KEYBOARD_SHORTCUTS_DEBUG ON)
|
||||
set(KMALLOC_DEBUG ON)
|
||||
|
@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibJS/Bytecode/Block.h>
|
||||
#include <LibJS/Bytecode/Instruction.h>
|
||||
#include <LibJS/Bytecode/Interpreter.h>
|
||||
@ -34,7 +35,7 @@ Interpreter::~Interpreter()
|
||||
|
||||
Value Interpreter::run(Bytecode::Block const& block)
|
||||
{
|
||||
dbgln("Bytecode::Interpreter will run block {:p}", &block);
|
||||
dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run block {:p}", &block);
|
||||
|
||||
CallFrame global_call_frame;
|
||||
if (vm().call_stack().is_empty()) {
|
||||
@ -65,14 +66,17 @@ Value Interpreter::run(Bytecode::Block const& block)
|
||||
++pc;
|
||||
}
|
||||
|
||||
dbgln("Bytecode::Interpreter did run block {:p}", &block);
|
||||
for (size_t i = 0; i < registers().size(); ++i) {
|
||||
String value_string;
|
||||
if (registers()[i].is_empty())
|
||||
value_string = "(empty)";
|
||||
else
|
||||
value_string = registers()[i].to_string_without_side_effects();
|
||||
dbgln("[{:3}] {}", i, value_string);
|
||||
dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter did run block {:p}", &block);
|
||||
|
||||
if constexpr (JS_BYTECODE_DEBUG) {
|
||||
for (size_t i = 0; i < registers().size(); ++i) {
|
||||
String value_string;
|
||||
if (registers()[i].is_empty())
|
||||
value_string = "(empty)";
|
||||
else
|
||||
value_string = registers()[i].to_string_without_side_effects();
|
||||
dbgln("[{:3}] {}", i, value_string);
|
||||
}
|
||||
}
|
||||
|
||||
m_register_windows.take_last();
|
||||
|
@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Function.h>
|
||||
#include <LibJS/AST.h>
|
||||
#include <LibJS/Bytecode/Block.h>
|
||||
@ -152,8 +153,10 @@ Value ScriptFunction::execute_function_body()
|
||||
prepare_arguments();
|
||||
auto block = Bytecode::Generator::generate(m_body);
|
||||
VERIFY(block);
|
||||
dbgln("Compiled Bytecode::Block for function '{}':", m_name);
|
||||
block->dump();
|
||||
if constexpr (JS_BYTECODE_DEBUG) {
|
||||
dbgln("Compiled Bytecode::Block for function '{}':", m_name);
|
||||
block->dump();
|
||||
}
|
||||
return bytecode_interpreter->run(*block);
|
||||
} else {
|
||||
OwnPtr<Interpreter> local_interpreter;
|
||||
|
Loading…
Reference in New Issue
Block a user