1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 11:55:12 +00:00

LibJS: Add bytecode ops for &, | and ^

This commit is contained in:
Luke 2021-06-07 19:16:04 +01:00 committed by Andreas Kling
parent 4be3374b24
commit ae763f1ade
4 changed files with 100 additions and 1 deletions

View file

@ -112,6 +112,21 @@ void AbstractEquals::execute(Bytecode::Interpreter& interpreter) const
interpreter.reg(m_dst) = Value(abstract_eq(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2)));
}
void BitwiseAnd::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = Value(bitwise_and(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2)));
}
void BitwiseOr::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = Value(bitwise_or(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2)));
}
void BitwiseXor::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = Value(bitwise_xor(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2)));
}
void NewString::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = js_string(interpreter.vm(), m_string);
@ -278,6 +293,21 @@ String AbstractEquals::to_string() const
return String::formatted("AbstractEquals dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String BitwiseAnd::to_string() const
{
return String::formatted("BitwiseAnd dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String BitwiseOr::to_string() const
{
return String::formatted("BitwiseOr dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String BitwiseXor::to_string() const
{
return String::formatted("BitwiseXor dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String NewString::to_string() const
{
return String::formatted("NewString dst:{}, string:\"{}\"", m_dst, m_string);