diff --git a/Userland/Libraries/LibJS/Bytecode/Instruction.cpp b/Userland/Libraries/LibJS/Bytecode/Instruction.cpp index aa3d12c5308..f20bae513c6 100644 --- a/Userland/Libraries/LibJS/Bytecode/Instruction.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Instruction.cpp @@ -10,6 +10,13 @@ namespace JS::Bytecode { +Instruction::Instruction(Type type, size_t length) + : m_type(type) + , m_length(length) +{ + VERIFY(length <= NumericLimits::max()); +} + void Instruction::destroy(Instruction& instruction) { #define __BYTECODE_OP(op) \ diff --git a/Userland/Libraries/LibJS/Bytecode/Instruction.h b/Userland/Libraries/LibJS/Bytecode/Instruction.h index 5d48a661255..e8f9e96a8ed 100644 --- a/Userland/Libraries/LibJS/Bytecode/Instruction.h +++ b/Userland/Libraries/LibJS/Bytecode/Instruction.h @@ -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) { } private: SourceRecord m_source_record {}; Type m_type {}; - size_t m_length {}; + u32 m_length {}; }; class InstructionStreamIterator {