1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

LibJS: Add bytecode instructions for modulo and exponentiation

This commit is contained in:
Gunnar Beutner 2021-06-07 19:37:23 +02:00 committed by Andreas Kling
parent 6af9d87258
commit 55f0791b13
4 changed files with 66 additions and 0 deletions

View file

@ -108,6 +108,44 @@ private:
Register m_src2;
};
class Mod final : public Instruction {
public:
Mod(Register dst, Register src1, Register src2)
: Instruction(Type::Mod)
, m_dst(dst)
, m_src1(src1)
, m_src2(src2)
{
}
void execute(Bytecode::Interpreter&) const;
String to_string() const;
private:
Register m_dst;
Register m_src1;
Register m_src2;
};
class Exp final : public Instruction {
public:
Exp(Register dst, Register src1, Register src2)
: Instruction(Type::Exp)
, m_dst(dst)
, m_src1(src1)
, m_src2(src2)
{
}
void execute(Bytecode::Interpreter&) const;
String to_string() const;
private:
Register m_dst;
Register m_src1;
Register m_src2;
};
class LessThan final : public Instruction {
public:
LessThan(Register dst, Register src1, Register src2)