mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +00:00
Ladybird+LibJS: Add CLI option to run browser with LibJS bytecode VM
This required quite a bit of plumbing, but now you can run
ladybird --use-bytecode
This commit is contained in:
@@ -8,9 +8,11 @@
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibJS/AST.h>
|
||||
#include <LibJS/Bytecode/BasicBlock.h>
|
||||
#include <LibJS/Bytecode/Generator.h>
|
||||
#include <LibJS/Bytecode/Instruction.h>
|
||||
#include <LibJS/Bytecode/Interpreter.h>
|
||||
#include <LibJS/Bytecode/Op.h>
|
||||
#include <LibJS/Bytecode/PassManager.h>
|
||||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/Runtime/GlobalEnvironment.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
@@ -18,6 +20,18 @@
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
static bool s_bytecode_interpreter_enabled = false;
|
||||
|
||||
bool Interpreter::enabled()
|
||||
{
|
||||
return s_bytecode_interpreter_enabled;
|
||||
}
|
||||
|
||||
void Interpreter::set_enabled(bool enabled)
|
||||
{
|
||||
s_bytecode_interpreter_enabled = enabled;
|
||||
}
|
||||
|
||||
static Interpreter* s_current;
|
||||
bool g_dump_bytecode = false;
|
||||
|
||||
@@ -425,4 +439,14 @@ Bytecode::PassManager& Interpreter::optimization_pipeline(Interpreter::Optimizat
|
||||
return passes;
|
||||
}
|
||||
|
||||
size_t Interpreter::pc() const
|
||||
{
|
||||
return m_pc ? m_pc->offset() : 0;
|
||||
}
|
||||
|
||||
DeprecatedString Interpreter::debug_position() const
|
||||
{
|
||||
return DeprecatedString::formatted("{}:{:2}:{:4x}", m_current_executable->name, m_current_block->name(), pc());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user