1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +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:
Andreas Kling 2023-06-17 13:16:35 +02:00
parent 7ec7015750
commit 9c568282dc
20 changed files with 91 additions and 38 deletions

View file

@ -6,8 +6,6 @@
#pragma once
#include "Generator.h"
#include "PassManager.h"
#include <LibJS/Bytecode/Label.h>
#include <LibJS/Bytecode/Register.h>
#include <LibJS/Forward.h>
@ -18,6 +16,9 @@
namespace JS::Bytecode {
class InstructionStreamIterator;
class PassManager;
struct RegisterWindow {
MarkedVector<Value> registers;
MarkedVector<GCPtr<Environment>> saved_lexical_environments;
@ -27,6 +28,9 @@ struct RegisterWindow {
class Interpreter {
public:
[[nodiscard]] static bool enabled();
static void set_enabled(bool);
explicit Interpreter(Realm&);
~Interpreter();
@ -82,11 +86,8 @@ public:
Executable const& current_executable() { return *m_current_executable; }
BasicBlock const& current_block() const { return *m_current_block; }
size_t pc() const { return m_pc ? m_pc->offset() : 0; }
DeprecatedString debug_position()
{
return DeprecatedString::formatted("{}:{:2}:{:4x}", m_current_executable->name, m_current_block->name(), pc());
}
size_t pc() const;
DeprecatedString debug_position() const;
enum class OptimizationLevel {
None,