1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

Revert "LibJS: Add bytecode instruction handles"

This reverts commit a01bd35c67.

This broke simple programs like:

function sum(a, b) { return a + b; }
console.log(sum(1, 2));
This commit is contained in:
Andreas Kling 2021-06-09 00:50:42 +02:00
parent a01bd35c67
commit b8a5ea1f8d
8 changed files with 79 additions and 81 deletions

View file

@ -8,7 +8,6 @@
#include <AK/Badge.h>
#include <AK/NonnullOwnPtrVector.h>
#include <LibJS/Bytecode/Register.h>
#include <LibJS/Forward.h>
namespace JS::Bytecode {
@ -43,20 +42,25 @@ public:
static NonnullOwnPtr<Block> create();
~Block();
void seal();
void dump() const;
ReadonlyBytes instruction_stream() const { return m_buffer.span(); }
ReadonlyBytes instruction_stream() const { return ReadonlyBytes { m_buffer, m_buffer_size }; }
size_t register_count() const { return m_register_count; }
void set_register_count(Badge<Bytecode::Generator>, size_t count) { m_register_count = count; }
Vector<u8>& buffer() { return m_buffer; }
void* next_slot() { return m_buffer + m_buffer_size; }
void grow(size_t additional_size);
private:
Block() = default;
Block();
size_t m_register_count { 0 };
Vector<u8> m_buffer;
u8* m_buffer { nullptr };
size_t m_buffer_capacity { 0 };
size_t m_buffer_size { 0 };
};
}