mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:57:44 +00:00
LibJS: Implement bytecode ops for logical expressions
This commit is contained in:
parent
216d27d4c1
commit
6da587b59b
5 changed files with 83 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue