mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 07:37:03 +00:00
LibJS/Bytecode: Fuse [Not, JumpIf] instructions into JumpIfNot
This commit is contained in:
parent
4438ec481c
commit
795149e585
Notes:
sideshowbarker
2024-07-16 20:05:14 +09:00
Author: https://github.com/awesomekling
Commit: 795149e585
Pull-request: https://github.com/SerenityOS/serenity/pull/23462
Reviewed-by: https://github.com/Hendiadyoin1
5 changed files with 53 additions and 0 deletions
|
@ -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) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue