1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:58:12 +00:00

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
parent 7b2c838162
commit 4cfdfb6a88
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; }