1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

LibJS/Bytecode: Fuse [Not, JumpIf] instructions into JumpIfNot

This commit is contained in:
Andreas Kling 2024-03-03 17:27:53 +01:00
parent 4438ec481c
commit 795149e585
5 changed files with 53 additions and 0 deletions

View file

@ -1123,6 +1123,23 @@ private:
Operand m_condition;
};
class JumpIfNot final : public Jump {
public:
explicit JumpIfNot(Operand condition, Label true_target, Label false_target)
: Jump(Type::JumpIfNot, move(true_target), move(false_target), sizeof(*this))
, m_condition(condition)
{
}
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
Operand condition() const { return m_condition; }
private:
Operand m_condition;
};
// NOTE: The raw operator is used for comparing two Int32 values.
#define JS_ENUMERATE_FUSABLE_BINARY_OPS(X) \
X(GreaterThan, >, greater_than) \