mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
LibJS/Bytecode: Add Bytecode::Operand
An Operand is either a register, a local, or a constant (index into the executable's constant table)
This commit is contained in:
parent
c0ec924dc9
commit
3466771492
6 changed files with 85 additions and 1 deletions
|
@ -53,6 +53,7 @@ public:
|
|||
|
||||
Realm& realm();
|
||||
VM& vm() { return m_vm; }
|
||||
VM const& vm() const { return m_vm; }
|
||||
|
||||
ThrowCompletionOr<Value> run(Script&, JS::GCPtr<Environment> lexical_environment_override = nullptr);
|
||||
ThrowCompletionOr<Value> run(SourceTextModule&);
|
||||
|
@ -72,6 +73,10 @@ public:
|
|||
ALWAYS_INLINE Value& accumulator() { return reg(Register::accumulator()); }
|
||||
ALWAYS_INLINE Value& saved_return_value() { return reg(Register::saved_return_value()); }
|
||||
Value& reg(Register const& r) { return registers()[r.index()]; }
|
||||
Value reg(Register const& r) const { return registers()[r.index()]; }
|
||||
|
||||
[[nodiscard]] Value get(Operand) const;
|
||||
void set(Operand, Value);
|
||||
|
||||
auto& saved_lexical_environment_stack() { return call_frame().saved_lexical_environments; }
|
||||
auto& unwind_contexts() { return call_frame().unwind_contexts; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue