|
@@ -46,6 +46,19 @@ void SetVariable::execute(Bytecode::Interpreter& interpreter) const
|
|
|
interpreter.vm().set_variable(m_identifier, interpreter.reg(m_src), interpreter.global_object());
|
|
|
}
|
|
|
|
|
|
+void Jump::execute(Bytecode::Interpreter& interpreter) const
|
|
|
+{
|
|
|
+ interpreter.jump(m_target);
|
|
|
+}
|
|
|
+
|
|
|
+void JumpIfFalse::execute(Bytecode::Interpreter& interpreter) const
|
|
|
+{
|
|
|
+ VERIFY(m_target.has_value());
|
|
|
+ auto result = interpreter.reg(m_result);
|
|
|
+ if (!result.as_bool())
|
|
|
+ interpreter.jump(m_target.value());
|
|
|
+}
|
|
|
+
|
|
|
String Load::to_string() const
|
|
|
{
|
|
|
return String::formatted("Load dst:{}, value:{}", m_dst, m_value.to_string_without_side_effects());
|
|
@@ -81,4 +94,16 @@ String SetVariable::to_string() const
|
|
|
return String::formatted("SetVariable identifier:{}, src:{}", m_identifier, m_src);
|
|
|
}
|
|
|
|
|
|
+String Jump::to_string() const
|
|
|
+{
|
|
|
+ return String::formatted("Jump {}", m_target);
|
|
|
+}
|
|
|
+
|
|
|
+String JumpIfFalse::to_string() const
|
|
|
+{
|
|
|
+ if (m_target.has_value())
|
|
|
+ return String::formatted("JumpIfFalse result:{}, target:{}", m_result, m_target.value());
|
|
|
+ return String::formatted("JumpIfFalse result:{}, target:<empty>", m_result);
|
|
|
+}
|
|
|
+
|
|
|
}
|