1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibJS: Some more opcodes for the bytecode VM

- NewString (allocates a new PrimitiveString from the GC heap)
- GetVariable (retrieves a variable in the current scope)
- SetVariable (assigns a variable in the current scope)
This commit is contained in:
Andreas Kling 2021-06-03 18:26:32 +02:00
parent 6da5d17416
commit 37cb70836b
4 changed files with 113 additions and 0 deletions

View file

@ -666,6 +666,7 @@ public:
virtual Value execute(Interpreter&, GlobalObject&) const override;
virtual void dump(int indent) const override;
virtual Optional<Bytecode::Register> generate_bytecode(Bytecode::Generator&) const override;
StringView value() const { return m_value; }
bool is_use_strict_directive() const { return m_is_use_strict_directive; };
@ -719,6 +720,7 @@ public:
virtual Value execute(Interpreter&, GlobalObject&) const override;
virtual void dump(int indent) const override;
virtual Reference to_reference(Interpreter&, GlobalObject&) const override;
virtual Optional<Bytecode::Register> generate_bytecode(Bytecode::Generator&) const override;
private:
FlyString m_string;
@ -896,6 +898,7 @@ public:
virtual Value execute(Interpreter&, GlobalObject&) const override;
virtual void dump(int indent) const override;
virtual Optional<Bytecode::Register> generate_bytecode(Bytecode::Generator&) const override;
private:
AssignmentOp m_op;