1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +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

@ -72,6 +72,16 @@ void Div::execute(Bytecode::Interpreter& interpreter) const
interpreter.reg(m_dst) = div(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void Mod::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = mod(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void Exp::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = exp(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void LessThan::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = less_than(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
@ -213,6 +223,16 @@ String Div::to_string() const
return String::formatted("Div dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String Mod::to_string() const
{
return String::formatted("Mod dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String Exp::to_string() const
{
return String::formatted("Exp dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String LessThan::to_string() const
{
return String::formatted("LessThan dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);