1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibJS: Add bytecode generation for BinaryOp::In

This commit is contained in:
Linus Groh 2021-06-07 21:13:37 +01:00
parent 93eae063a1
commit 5e996de8c6
4 changed files with 42 additions and 6 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -142,11 +143,6 @@ void BitwiseXor::execute(Bytecode::Interpreter& interpreter) const
interpreter.reg(m_dst) = bitwise_xor(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void BitwiseNot::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = bitwise_not(interpreter.global_object(), interpreter.reg(m_src));
}
void LeftShift::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = left_shift(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
@ -162,6 +158,16 @@ void UnsignedRightShift::execute(Bytecode::Interpreter& interpreter) const
interpreter.reg(m_dst) = unsigned_right_shift(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void In::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = in(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
}
void BitwiseNot::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = bitwise_not(interpreter.global_object(), interpreter.reg(m_src));
}
void Not::execute(Bytecode::Interpreter& interpreter) const
{
interpreter.reg(m_dst) = Value(!interpreter.reg(m_src).to_boolean());
@ -394,6 +400,11 @@ String UnsignedRightShift::to_string() const
return String::formatted("UnsignedRightShift dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String In::to_string() const
{
return String::formatted("In dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
}
String BitwiseNot::to_string() const
{
return String::formatted("BitwiseNot dst:{}, src:{}", m_dst, m_src);