mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +00:00
LibJS: Move bytecode debug spam behind JS_BYTECODE_DEBUG :^)
This commit is contained in:
parent
e7d69c5d3c
commit
7cbe4daa7c
4 changed files with 23 additions and 11 deletions
|
@ -226,6 +226,10 @@
|
||||||
#cmakedefine01 JPG_DEBUG
|
#cmakedefine01 JPG_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef JS_BYTECODE_DEBUG
|
||||||
|
#cmakedefine01 JS_BYTECODE_DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef KEYBOARD_SHORTCUTS_DEBUG
|
#ifndef KEYBOARD_SHORTCUTS_DEBUG
|
||||||
#cmakedefine01 KEYBOARD_SHORTCUTS_DEBUG
|
#cmakedefine01 KEYBOARD_SHORTCUTS_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -88,6 +88,7 @@ set(IRQ_DEBUG ON)
|
||||||
set(ITEM_RECTS_DEBUG ON)
|
set(ITEM_RECTS_DEBUG ON)
|
||||||
set(JOB_DEBUG ON)
|
set(JOB_DEBUG ON)
|
||||||
set(JPG_DEBUG ON)
|
set(JPG_DEBUG ON)
|
||||||
|
set(JS_BYTECODE_DEBUG ON)
|
||||||
set(KEYBOARD_DEBUG ON)
|
set(KEYBOARD_DEBUG ON)
|
||||||
set(KEYBOARD_SHORTCUTS_DEBUG ON)
|
set(KEYBOARD_SHORTCUTS_DEBUG ON)
|
||||||
set(KMALLOC_DEBUG ON)
|
set(KMALLOC_DEBUG ON)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/Debug.h>
|
||||||
#include <LibJS/Bytecode/Block.h>
|
#include <LibJS/Bytecode/Block.h>
|
||||||
#include <LibJS/Bytecode/Instruction.h>
|
#include <LibJS/Bytecode/Instruction.h>
|
||||||
#include <LibJS/Bytecode/Interpreter.h>
|
#include <LibJS/Bytecode/Interpreter.h>
|
||||||
|
@ -34,7 +35,7 @@ Interpreter::~Interpreter()
|
||||||
|
|
||||||
Value Interpreter::run(Bytecode::Block const& block)
|
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;
|
CallFrame global_call_frame;
|
||||||
if (vm().call_stack().is_empty()) {
|
if (vm().call_stack().is_empty()) {
|
||||||
|
@ -65,14 +66,17 @@ Value Interpreter::run(Bytecode::Block const& block)
|
||||||
++pc;
|
++pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgln("Bytecode::Interpreter did run block {:p}", &block);
|
dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter did run block {:p}", &block);
|
||||||
for (size_t i = 0; i < registers().size(); ++i) {
|
|
||||||
String value_string;
|
if constexpr (JS_BYTECODE_DEBUG) {
|
||||||
if (registers()[i].is_empty())
|
for (size_t i = 0; i < registers().size(); ++i) {
|
||||||
value_string = "(empty)";
|
String value_string;
|
||||||
else
|
if (registers()[i].is_empty())
|
||||||
value_string = registers()[i].to_string_without_side_effects();
|
value_string = "(empty)";
|
||||||
dbgln("[{:3}] {}", i, value_string);
|
else
|
||||||
|
value_string = registers()[i].to_string_without_side_effects();
|
||||||
|
dbgln("[{:3}] {}", i, value_string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_register_windows.take_last();
|
m_register_windows.take_last();
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/Debug.h>
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <LibJS/AST.h>
|
#include <LibJS/AST.h>
|
||||||
#include <LibJS/Bytecode/Block.h>
|
#include <LibJS/Bytecode/Block.h>
|
||||||
|
@ -152,8 +153,10 @@ Value ScriptFunction::execute_function_body()
|
||||||
prepare_arguments();
|
prepare_arguments();
|
||||||
auto block = Bytecode::Generator::generate(m_body);
|
auto block = Bytecode::Generator::generate(m_body);
|
||||||
VERIFY(block);
|
VERIFY(block);
|
||||||
dbgln("Compiled Bytecode::Block for function '{}':", m_name);
|
if constexpr (JS_BYTECODE_DEBUG) {
|
||||||
block->dump();
|
dbgln("Compiled Bytecode::Block for function '{}':", m_name);
|
||||||
|
block->dump();
|
||||||
|
}
|
||||||
return bytecode_interpreter->run(*block);
|
return bytecode_interpreter->run(*block);
|
||||||
} else {
|
} else {
|
||||||
OwnPtr<Interpreter> local_interpreter;
|
OwnPtr<Interpreter> local_interpreter;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue