LibJS/Bytecode: Store Instruction length as u32

This makes every instruction 8 bytes smaller.
This commit is contained in:
Andreas Kling 2024-05-06 07:09:59 +02:00
commit 4cf4ea92a7
Notes: sideshowbarker 2024-07-17 06:51:10 +09:00
2 changed files with 9 additions and 6 deletions

View file

@ -10,6 +10,13 @@
namespace JS::Bytecode {
Instruction::Instruction(Type type, size_t length)
: m_type(type)
, m_length(length)
{
VERIFY(length <= NumericLimits<u32>::max());
}
void Instruction::destroy(Instruction& instruction)
{
#define __BYTECODE_OP(op) \

View file

@ -145,18 +145,14 @@ public:
SourceRecord source_record() const { return m_source_record; }
protected:
Instruction(Type type, size_t length)
: m_type(type)
, m_length(length)
{
}
Instruction(Type, size_t length);
void visit_labels_impl(Function<void(Label&)>) { }
private:
SourceRecord m_source_record {};
Type m_type {};
size_t m_length {};
u32 m_length {};
};
class InstructionStreamIterator {