diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-06-08 02:18:47 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-08 10:42:45 +0200 |
commit | 6da587b59b5b96517adddef7b738d7092aec8783 (patch) | |
tree | a747003677f9dbe6eedef8089ec0411381238e2d /Userland/Libraries/LibJS/Bytecode/Op.h | |
parent | 216d27d4c13be78a859b8bcc7a1abc555a58f322 (diff) | |
download | serenity-6da587b59b5b96517adddef7b738d7092aec8783.zip |
LibJS: Implement bytecode ops for logical expressions
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode/Op.h')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h index 735dcbf331..d60138196c 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.h +++ b/Userland/Libraries/LibJS/Bytecode/Op.h @@ -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: |