LibJS: Implement bytecode generation for UpdateExpression :^)

Added Increment and Decrement bytecode ops to support this. Postfix
updates use a temporary register to preserve the original value.

Note that this patch only implements Identifier updates. Member
expression updates are a TODO.
This commit is contained in:
Andreas Kling 2021-06-09 11:40:38 +02:00
commit 59eedd6de0
Notes: sideshowbarker 2024-07-18 12:34:29 +09:00
5 changed files with 88 additions and 1 deletions

View file

@ -373,6 +373,28 @@ public:
String to_string() const;
};
class Increment final : public Instruction {
public:
Increment()
: Instruction(Type::Increment)
{
}
void execute(Bytecode::Interpreter&) const;
String to_string() const;
};
class Decrement final : public Instruction {
public:
Decrement()
: Instruction(Type::Decrement)
{
}
void execute(Bytecode::Interpreter&) const;
String to_string() const;
};
}
namespace JS::Bytecode {