1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 18:45:07 +00:00

LibJS: Remeber which instruction terminated a block

This commit is contained in:
Hendiadyoin1 2022-11-26 14:42:36 +01:00 committed by Ali Mohammad Pur
parent 8c4717fc6e
commit 192897c269
2 changed files with 6 additions and 5 deletions

View file

@ -36,8 +36,9 @@ public:
bool can_grow(size_t additional_size) const { return m_buffer_size + additional_size <= m_buffer_capacity; }
void grow(size_t additional_size);
void terminate(Badge<Generator>) { m_is_terminated = true; }
bool is_terminated() const { return m_is_terminated; }
void terminate(Badge<Generator>, Instruction const* terminator) { m_terminator = terminator; }
bool is_terminated() const { return m_terminator != nullptr; }
Instruction const* terminator() const { return m_terminator; }
String const& name() const { return m_name; }
@ -45,9 +46,9 @@ private:
BasicBlock(String name, size_t size);
u8* m_buffer { nullptr };
Instruction const* m_terminator { nullptr };
size_t m_buffer_capacity { 0 };
size_t m_buffer_size { 0 };
bool m_is_terminated { false };
String m_name;
};