LibJS: Implement bytecode ops for logical expressions

This commit is contained in:
Gunnar Beutner 2021-06-08 02:18:47 +02:00 committed by Andreas Kling
commit 6da587b59b
Notes: sideshowbarker 2024-07-18 12:39:33 +09:00
5 changed files with 83 additions and 0 deletions

View file

@ -284,6 +284,25 @@ private:
Optional<Label> m_target;
};
class JumpIfNullish final : public Instruction {
public:
explicit JumpIfNullish(Register result, Optional<Label> target = {})
: Instruction(Type::JumpIfNullish)
, m_result(result)
, m_target(move(target))
{
}
void set_target(Optional<Label> target) { m_target = move(target); }
void execute(Bytecode::Interpreter&) const;
String to_string() const;
private:
Register m_result;
Optional<Label> m_target;
};
// NOTE: This instruction is variable-width depending on the number of arguments!
class Call final : public Instruction {
public: