mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 19:56:30 +00:00
LibJS: Add bytecode instructions for modulo and exponentiation
This commit is contained in:
parent
6af9d87258
commit
55f0791b13
Notes:
sideshowbarker
2024-07-18 12:41:22 +09:00
Author: https://github.com/gunnarbeutner
Commit: 55f0791b13
Pull-request: https://github.com/SerenityOS/serenity/pull/7882
4 changed files with 66 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue