1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:15:07 +00:00

LibJS: Add bytecode ops for >, >= and <=

This commit is contained in:
Gunnar Beutner 2021-06-07 19:57:38 +02:00 committed by Andreas Kling
parent 73b8acf432
commit 4be3374b24
4 changed files with 99 additions and 0 deletions

View file

@ -82,11 +82,26 @@ void Exp::execute(Bytecode::Interpreter& interpreter) const
interpreter.reg(m_dst) = exp(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void GreaterThan::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = greater_than(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void GreaterThanEquals::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = greater_than_equals(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));
}
void LessThanEquals::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = less_than_equals(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void AbstractInequals::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = Value(!abstract_eq(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2)));
@ -233,11 +248,26 @@ String Exp::to_string() const
return String::formatted("Exp dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String GreaterThan::to_string() const
{
return String::formatted("GreaterThan dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String GreaterThanEquals::to_string() const
{
return String::formatted("GreaterThanEquals 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);
}
String LessThanEquals::to_string() const
{
return String::formatted("LessThanEquals dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String AbstractInequals::to_string() const
{
return String::formatted("AbstractInequals dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);