mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:35:09 +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:
parent
7ec7015750
commit
9c568282dc
20 changed files with 91 additions and 38 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue