LibJS: Automatically split linear bytecode into multiple blocks

...instead of crashing :^)
This commit is contained in:
Ali Mohammad Pur 2021-06-11 01:35:01 +04:30 committed by Andreas Kling
commit 4cfdfb6a88
Notes: sideshowbarker 2024-07-18 12:28:06 +09:00
3 changed files with 25 additions and 0 deletions

View file

@ -44,6 +44,8 @@ struct UnwindInfo {
};
class BasicBlock {
AK_MAKE_NONCOPYABLE(BasicBlock);
public:
static NonnullOwnPtr<BasicBlock> create(String name);
~BasicBlock();
@ -54,6 +56,7 @@ public:
ReadonlyBytes instruction_stream() const { return ReadonlyBytes { m_buffer, m_buffer_size }; }
void* next_slot() { return m_buffer + m_buffer_size; }
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; }