LibJS/Bytecode: Remove Instruction::m_length field
Now that the interpreter is unrolled, we can advance the program counter manually based on the current instruction type. This makes most instructions a bit smaller. :^)
This commit is contained in:
parent
ce93000757
commit
e43d96f310
3 changed files with 134 additions and 103 deletions
|
|
@ -10,13 +10,6 @@
|
|||
|
||||
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) \
|
||||
|
|
@ -49,6 +42,42 @@ void Instruction::visit_labels(Function<void(JS::Bytecode::Label&)> visitor)
|
|||
#undef __BYTECODE_OP
|
||||
}
|
||||
|
||||
template<typename Op>
|
||||
concept HasVariableLength = Op::IsVariableLength;
|
||||
|
||||
template<typename Op>
|
||||
concept HasFixedLength = !Op::IsVariableLength;
|
||||
|
||||
template<HasVariableLength Op>
|
||||
size_t get_length_impl(Op const& op)
|
||||
{
|
||||
return op.length_impl();
|
||||
}
|
||||
|
||||
// Function template for types without a length_impl method
|
||||
template<HasFixedLength Op>
|
||||
size_t get_length_impl(Op const&)
|
||||
{
|
||||
return sizeof(Op);
|
||||
}
|
||||
|
||||
size_t Instruction::length() const
|
||||
{
|
||||
#define __BYTECODE_OP(op) \
|
||||
case Type::op: { \
|
||||
auto& typed_op = static_cast<Op::op const&>(*this); \
|
||||
return get_length_impl(typed_op); \
|
||||
}
|
||||
|
||||
switch (type()) {
|
||||
ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
#undef __BYTECODE_OP
|
||||
}
|
||||
|
||||
UnrealizedSourceRange InstructionStreamIterator::source_range() const
|
||||
{
|
||||
VERIFY(m_executable);
|
||||
|
|
|
|||
|
|
@ -138,20 +138,22 @@ public:
|
|||
};
|
||||
|
||||
Type type() const { return m_type; }
|
||||
size_t length() const { return m_length; }
|
||||
size_t length() const;
|
||||
ByteString to_byte_string(Bytecode::Executable const&) const;
|
||||
ThrowCompletionOr<void> execute(Bytecode::Interpreter&) const;
|
||||
void visit_labels(Function<void(Label&)> visitor);
|
||||
static void destroy(Instruction&);
|
||||
|
||||
protected:
|
||||
Instruction(Type, size_t length);
|
||||
explicit Instruction(Type type)
|
||||
: m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
void visit_labels_impl(Function<void(Label&)>) { }
|
||||
|
||||
private:
|
||||
Type m_type {};
|
||||
u32 m_length {};
|
||||
};
|
||||
|
||||
class InstructionStreamIterator {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace JS::Bytecode::Op {
|
|||
class Mov final : public Instruction {
|
||||
public:
|
||||
Mov(Operand dst, Operand src)
|
||||
: Instruction(Type::Mov, sizeof(*this))
|
||||
: Instruction(Type::Mov)
|
||||
, m_dst(dst)
|
||||
, m_src(src)
|
||||
{
|
||||
|
|
@ -81,7 +81,7 @@ private:
|
|||
class OpTitleCase final : public Instruction { \
|
||||
public: \
|
||||
explicit OpTitleCase(Operand dst, Operand lhs, Operand rhs) \
|
||||
: Instruction(Type::OpTitleCase, sizeof(*this)) \
|
||||
: Instruction(Type::OpTitleCase) \
|
||||
, m_dst(dst) \
|
||||
, m_lhs(lhs) \
|
||||
, m_rhs(rhs) \
|
||||
|
|
@ -116,7 +116,7 @@ JS_ENUMERATE_COMMON_BINARY_OPS_WITH_FAST_PATH(JS_DECLARE_COMMON_BINARY_OP)
|
|||
class OpTitleCase final : public Instruction { \
|
||||
public: \
|
||||
OpTitleCase(Operand dst, Operand src) \
|
||||
: Instruction(Type::OpTitleCase, sizeof(*this)) \
|
||||
: Instruction(Type::OpTitleCase) \
|
||||
, m_dst(dst) \
|
||||
, m_src(src) \
|
||||
{ \
|
||||
|
|
@ -139,7 +139,7 @@ JS_ENUMERATE_COMMON_UNARY_OPS(JS_DECLARE_COMMON_UNARY_OP)
|
|||
class NewObject final : public Instruction {
|
||||
public:
|
||||
explicit NewObject(Operand dst)
|
||||
: Instruction(Type::NewObject, sizeof(*this))
|
||||
: Instruction(Type::NewObject)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ private:
|
|||
class NewRegExp final : public Instruction {
|
||||
public:
|
||||
NewRegExp(Operand dst, StringTableIndex source_index, StringTableIndex flags_index, RegexTableIndex regex_index)
|
||||
: Instruction(Type::NewRegExp, sizeof(*this))
|
||||
: Instruction(Type::NewRegExp)
|
||||
, m_dst(dst)
|
||||
, m_source_index(source_index)
|
||||
, m_flags_index(flags_index)
|
||||
|
|
@ -186,7 +186,7 @@ private:
|
|||
class New##ErrorName final : public Instruction { \
|
||||
public: \
|
||||
New##ErrorName(Operand dst, StringTableIndex error_string) \
|
||||
: Instruction(Type::New##ErrorName, sizeof(*this)) \
|
||||
: Instruction(Type::New##ErrorName) \
|
||||
, m_dst(dst) \
|
||||
, m_error_string(error_string) \
|
||||
{ \
|
||||
|
|
@ -212,7 +212,7 @@ public:
|
|||
static constexpr bool IsVariableLength = true;
|
||||
|
||||
CopyObjectExcludingProperties(Operand dst, Operand from_object, Vector<Operand> const& excluded_names)
|
||||
: Instruction(Type::CopyObjectExcludingProperties, length_impl(excluded_names.size()))
|
||||
: Instruction(Type::CopyObjectExcludingProperties)
|
||||
, m_dst(dst)
|
||||
, m_from_object(from_object)
|
||||
, m_excluded_names_count(excluded_names.size())
|
||||
|
|
@ -224,9 +224,9 @@ public:
|
|||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
||||
|
||||
size_t length_impl(size_t excluded_names_count) const
|
||||
size_t length_impl() const
|
||||
{
|
||||
return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * excluded_names_count);
|
||||
return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * m_excluded_names_count);
|
||||
}
|
||||
|
||||
Operand dst() const { return m_dst; }
|
||||
|
|
@ -247,14 +247,14 @@ public:
|
|||
static constexpr bool IsVariableLength = true;
|
||||
|
||||
explicit NewArray(Operand dst)
|
||||
: Instruction(Type::NewArray, length_impl(0))
|
||||
: Instruction(Type::NewArray)
|
||||
, m_dst(dst)
|
||||
, m_element_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
NewArray(Operand dst, AK::Array<Operand, 2> const& elements_range)
|
||||
: Instruction(Type::NewArray, length_impl(elements_range[1].index() - elements_range[0].index() + 1))
|
||||
: Instruction(Type::NewArray)
|
||||
, m_dst(dst)
|
||||
, m_element_count(elements_range[1].index() - elements_range[0].index() + 1)
|
||||
{
|
||||
|
|
@ -267,9 +267,9 @@ public:
|
|||
|
||||
Operand dst() const { return m_dst; }
|
||||
|
||||
size_t length_impl(size_t element_count) const
|
||||
size_t length_impl() const
|
||||
{
|
||||
return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * (element_count == 0 ? 0 : 2));
|
||||
return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * (m_element_count == 0 ? 0 : 2));
|
||||
}
|
||||
|
||||
Operand start() const
|
||||
|
|
@ -297,7 +297,7 @@ public:
|
|||
static constexpr bool IsVariableLength = true;
|
||||
|
||||
NewPrimitiveArray(Operand dst, ReadonlySpan<Value> elements)
|
||||
: Instruction(Type::NewPrimitiveArray, length_impl(elements.size()))
|
||||
: Instruction(Type::NewPrimitiveArray)
|
||||
, m_dst(dst)
|
||||
, m_element_count(elements.size())
|
||||
{
|
||||
|
|
@ -305,9 +305,9 @@ public:
|
|||
m_elements[i] = elements[i];
|
||||
}
|
||||
|
||||
size_t length_impl(size_t element_count) const
|
||||
size_t length_impl() const
|
||||
{
|
||||
return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Value) * element_count);
|
||||
return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Value) * m_element_count);
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
|
|
@ -325,7 +325,7 @@ private:
|
|||
class ArrayAppend final : public Instruction {
|
||||
public:
|
||||
ArrayAppend(Operand dst, Operand src, bool is_spread)
|
||||
: Instruction(Type::ArrayAppend, sizeof(*this))
|
||||
: Instruction(Type::ArrayAppend)
|
||||
, m_dst(dst)
|
||||
, m_src(src)
|
||||
, m_is_spread(is_spread)
|
||||
|
|
@ -348,7 +348,7 @@ private:
|
|||
class ImportCall final : public Instruction {
|
||||
public:
|
||||
ImportCall(Operand dst, Operand specifier, Operand options)
|
||||
: Instruction(Type::ImportCall, sizeof(*this))
|
||||
: Instruction(Type::ImportCall)
|
||||
, m_dst(dst)
|
||||
, m_specifier(specifier)
|
||||
, m_options(options)
|
||||
|
|
@ -371,7 +371,7 @@ private:
|
|||
class IteratorToArray final : public Instruction {
|
||||
public:
|
||||
explicit IteratorToArray(Operand dst, Operand iterator)
|
||||
: Instruction(Type::IteratorToArray, sizeof(*this))
|
||||
: Instruction(Type::IteratorToArray)
|
||||
, m_dst(dst)
|
||||
, m_iterator(iterator)
|
||||
{
|
||||
|
|
@ -391,7 +391,7 @@ private:
|
|||
class ConcatString final : public Instruction {
|
||||
public:
|
||||
explicit ConcatString(Operand dst, Operand src)
|
||||
: Instruction(Type::ConcatString, sizeof(*this))
|
||||
: Instruction(Type::ConcatString)
|
||||
, m_dst(dst)
|
||||
, m_src(src)
|
||||
{
|
||||
|
|
@ -416,7 +416,7 @@ enum class EnvironmentMode {
|
|||
class CreateLexicalEnvironment final : public Instruction {
|
||||
public:
|
||||
explicit CreateLexicalEnvironment()
|
||||
: Instruction(Type::CreateLexicalEnvironment, sizeof(*this))
|
||||
: Instruction(Type::CreateLexicalEnvironment)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -427,7 +427,7 @@ public:
|
|||
class EnterObjectEnvironment final : public Instruction {
|
||||
public:
|
||||
explicit EnterObjectEnvironment(Operand object)
|
||||
: Instruction(Type::EnterObjectEnvironment, sizeof(*this))
|
||||
: Instruction(Type::EnterObjectEnvironment)
|
||||
, m_object(object)
|
||||
{
|
||||
}
|
||||
|
|
@ -444,7 +444,7 @@ private:
|
|||
class Catch final : public Instruction {
|
||||
public:
|
||||
explicit Catch(Operand dst)
|
||||
: Instruction(Type::Catch, sizeof(*this))
|
||||
: Instruction(Type::Catch)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
|
@ -461,7 +461,7 @@ private:
|
|||
class LeaveFinally final : public Instruction {
|
||||
public:
|
||||
explicit LeaveFinally()
|
||||
: Instruction(Type::LeaveFinally, sizeof(*this))
|
||||
: Instruction(Type::LeaveFinally)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ public:
|
|||
class RestoreScheduledJump final : public Instruction {
|
||||
public:
|
||||
explicit RestoreScheduledJump()
|
||||
: Instruction(Type::RestoreScheduledJump, sizeof(*this))
|
||||
: Instruction(Type::RestoreScheduledJump)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -483,7 +483,7 @@ public:
|
|||
class CreateVariable final : public Instruction {
|
||||
public:
|
||||
explicit CreateVariable(IdentifierTableIndex identifier, EnvironmentMode mode, bool is_immutable, bool is_global = false, bool is_strict = false)
|
||||
: Instruction(Type::CreateVariable, sizeof(*this))
|
||||
: Instruction(Type::CreateVariable)
|
||||
, m_identifier(identifier)
|
||||
, m_mode(mode)
|
||||
, m_is_immutable(is_immutable)
|
||||
|
|
@ -516,7 +516,7 @@ public:
|
|||
Set,
|
||||
};
|
||||
explicit SetVariable(IdentifierTableIndex identifier, Operand src, u32 cache_index, InitializationMode initialization_mode = InitializationMode::Set, EnvironmentMode mode = EnvironmentMode::Lexical)
|
||||
: Instruction(Type::SetVariable, sizeof(*this))
|
||||
: Instruction(Type::SetVariable)
|
||||
, m_identifier(identifier)
|
||||
, m_src(src)
|
||||
, m_mode(mode)
|
||||
|
|
@ -545,7 +545,7 @@ private:
|
|||
class SetLocal final : public Instruction {
|
||||
public:
|
||||
SetLocal(size_t index, Operand src)
|
||||
: Instruction(Type::SetLocal, sizeof(*this))
|
||||
: Instruction(Type::SetLocal)
|
||||
, m_index(index)
|
||||
, m_src(src)
|
||||
{
|
||||
|
|
@ -566,7 +566,7 @@ private:
|
|||
class GetCalleeAndThisFromEnvironment final : public Instruction {
|
||||
public:
|
||||
explicit GetCalleeAndThisFromEnvironment(Operand callee, Operand this_value, IdentifierTableIndex identifier, u32 cache_index)
|
||||
: Instruction(Type::GetCalleeAndThisFromEnvironment, sizeof(*this))
|
||||
: Instruction(Type::GetCalleeAndThisFromEnvironment)
|
||||
, m_identifier(identifier)
|
||||
, m_callee(callee)
|
||||
, m_this_value(this_value)
|
||||
|
|
@ -592,7 +592,7 @@ private:
|
|||
class GetVariable final : public Instruction {
|
||||
public:
|
||||
explicit GetVariable(Operand dst, IdentifierTableIndex identifier, u32 cache_index)
|
||||
: Instruction(Type::GetVariable, sizeof(*this))
|
||||
: Instruction(Type::GetVariable)
|
||||
, m_dst(dst)
|
||||
, m_identifier(identifier)
|
||||
, m_cache_index(cache_index)
|
||||
|
|
@ -615,7 +615,7 @@ private:
|
|||
class GetGlobal final : public Instruction {
|
||||
public:
|
||||
GetGlobal(Operand dst, IdentifierTableIndex identifier, u32 cache_index)
|
||||
: Instruction(Type::GetGlobal, sizeof(*this))
|
||||
: Instruction(Type::GetGlobal)
|
||||
, m_dst(dst)
|
||||
, m_identifier(identifier)
|
||||
, m_cache_index(cache_index)
|
||||
|
|
@ -638,7 +638,7 @@ private:
|
|||
class DeleteVariable final : public Instruction {
|
||||
public:
|
||||
explicit DeleteVariable(Operand dst, IdentifierTableIndex identifier)
|
||||
: Instruction(Type::DeleteVariable, sizeof(*this))
|
||||
: Instruction(Type::DeleteVariable)
|
||||
, m_dst(dst)
|
||||
, m_identifier(identifier)
|
||||
{
|
||||
|
|
@ -658,7 +658,7 @@ private:
|
|||
class GetById final : public Instruction {
|
||||
public:
|
||||
GetById(Operand dst, Operand base, IdentifierTableIndex property, Optional<IdentifierTableIndex> base_identifier, u32 cache_index)
|
||||
: Instruction(Type::GetById, sizeof(*this))
|
||||
: Instruction(Type::GetById)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
|
|
@ -686,7 +686,7 @@ private:
|
|||
class GetByIdWithThis final : public Instruction {
|
||||
public:
|
||||
GetByIdWithThis(Operand dst, Operand base, IdentifierTableIndex property, Operand this_value, u32 cache_index)
|
||||
: Instruction(Type::GetByIdWithThis, sizeof(*this))
|
||||
: Instruction(Type::GetByIdWithThis)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
|
|
@ -715,7 +715,7 @@ private:
|
|||
class GetPrivateById final : public Instruction {
|
||||
public:
|
||||
explicit GetPrivateById(Operand dst, Operand base, IdentifierTableIndex property)
|
||||
: Instruction(Type::GetPrivateById, sizeof(*this))
|
||||
: Instruction(Type::GetPrivateById)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
|
|
@ -738,7 +738,7 @@ private:
|
|||
class HasPrivateId final : public Instruction {
|
||||
public:
|
||||
HasPrivateId(Operand dst, Operand base, IdentifierTableIndex property)
|
||||
: Instruction(Type::HasPrivateId, sizeof(*this))
|
||||
: Instruction(Type::HasPrivateId)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
|
|
@ -770,7 +770,7 @@ enum class PropertyKind {
|
|||
class PutById final : public Instruction {
|
||||
public:
|
||||
explicit PutById(Operand base, IdentifierTableIndex property, Operand src, PropertyKind kind, u32 cache_index, Optional<IdentifierTableIndex> base_identifier = {})
|
||||
: Instruction(Type::PutById, sizeof(*this))
|
||||
: Instruction(Type::PutById)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
, m_src(src)
|
||||
|
|
@ -801,7 +801,7 @@ private:
|
|||
class PutByIdWithThis final : public Instruction {
|
||||
public:
|
||||
PutByIdWithThis(Operand base, Operand this_value, IdentifierTableIndex property, Operand src, PropertyKind kind, u32 cache_index)
|
||||
: Instruction(Type::PutByIdWithThis, sizeof(*this))
|
||||
: Instruction(Type::PutByIdWithThis)
|
||||
, m_base(base)
|
||||
, m_this_value(this_value)
|
||||
, m_property(property)
|
||||
|
|
@ -833,7 +833,7 @@ private:
|
|||
class PutPrivateById final : public Instruction {
|
||||
public:
|
||||
explicit PutPrivateById(Operand base, IdentifierTableIndex property, Operand src, PropertyKind kind = PropertyKind::KeyValue)
|
||||
: Instruction(Type::PutPrivateById, sizeof(*this))
|
||||
: Instruction(Type::PutPrivateById)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
, m_src(src)
|
||||
|
|
@ -858,7 +858,7 @@ private:
|
|||
class DeleteById final : public Instruction {
|
||||
public:
|
||||
explicit DeleteById(Operand dst, Operand base, IdentifierTableIndex property)
|
||||
: Instruction(Type::DeleteById, sizeof(*this))
|
||||
: Instruction(Type::DeleteById)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
|
|
@ -881,7 +881,7 @@ private:
|
|||
class DeleteByIdWithThis final : public Instruction {
|
||||
public:
|
||||
DeleteByIdWithThis(Operand dst, Operand base, Operand this_value, IdentifierTableIndex property)
|
||||
: Instruction(Type::DeleteByIdWithThis, sizeof(*this))
|
||||
: Instruction(Type::DeleteByIdWithThis)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_this_value(this_value)
|
||||
|
|
@ -907,7 +907,7 @@ private:
|
|||
class GetByValue final : public Instruction {
|
||||
public:
|
||||
GetByValue(Operand dst, Operand base, Operand property, Optional<IdentifierTableIndex> base_identifier = {})
|
||||
: Instruction(Type::GetByValue, sizeof(*this))
|
||||
: Instruction(Type::GetByValue)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
|
|
@ -934,7 +934,7 @@ private:
|
|||
class GetByValueWithThis final : public Instruction {
|
||||
public:
|
||||
GetByValueWithThis(Operand dst, Operand base, Operand property, Operand this_value)
|
||||
: Instruction(Type::GetByValueWithThis, sizeof(*this))
|
||||
: Instruction(Type::GetByValueWithThis)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
|
|
@ -960,7 +960,7 @@ private:
|
|||
class PutByValue final : public Instruction {
|
||||
public:
|
||||
PutByValue(Operand base, Operand property, Operand src, PropertyKind kind = PropertyKind::KeyValue, Optional<IdentifierTableIndex> base_identifier = {})
|
||||
: Instruction(Type::PutByValue, sizeof(*this))
|
||||
: Instruction(Type::PutByValue)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
, m_src(src)
|
||||
|
|
@ -988,7 +988,7 @@ private:
|
|||
class PutByValueWithThis final : public Instruction {
|
||||
public:
|
||||
PutByValueWithThis(Operand base, Operand property, Operand this_value, Operand src, PropertyKind kind = PropertyKind::KeyValue)
|
||||
: Instruction(Type::PutByValueWithThis, sizeof(*this))
|
||||
: Instruction(Type::PutByValueWithThis)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
, m_this_value(this_value)
|
||||
|
|
@ -1017,7 +1017,7 @@ private:
|
|||
class DeleteByValue final : public Instruction {
|
||||
public:
|
||||
DeleteByValue(Operand dst, Operand base, Operand property)
|
||||
: Instruction(Type::DeleteByValue, sizeof(*this))
|
||||
: Instruction(Type::DeleteByValue)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_property(property)
|
||||
|
|
@ -1040,7 +1040,7 @@ private:
|
|||
class DeleteByValueWithThis final : public Instruction {
|
||||
public:
|
||||
DeleteByValueWithThis(Operand dst, Operand base, Operand this_value, Operand property)
|
||||
: Instruction(Type::DeleteByValueWithThis, sizeof(*this))
|
||||
: Instruction(Type::DeleteByValueWithThis)
|
||||
, m_dst(dst)
|
||||
, m_base(base)
|
||||
, m_this_value(this_value)
|
||||
|
|
@ -1068,7 +1068,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit Jump(Label target)
|
||||
: Instruction(Type::Jump, sizeof(*this))
|
||||
: Instruction(Type::Jump)
|
||||
, m_target(target)
|
||||
{
|
||||
}
|
||||
|
|
@ -1091,7 +1091,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit JumpIf(Operand condition, Label true_target, Label false_target)
|
||||
: Instruction(Type::JumpIf, sizeof(*this))
|
||||
: Instruction(Type::JumpIf)
|
||||
, m_condition(condition)
|
||||
, m_true_target(true_target)
|
||||
, m_false_target(false_target)
|
||||
|
|
@ -1121,7 +1121,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit JumpTrue(Operand condition, Label target)
|
||||
: Instruction(Type::JumpTrue, sizeof(*this))
|
||||
: Instruction(Type::JumpTrue)
|
||||
, m_condition(condition)
|
||||
, m_target(target)
|
||||
{
|
||||
|
|
@ -1147,7 +1147,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit JumpFalse(Operand condition, Label target)
|
||||
: Instruction(Type::JumpFalse, sizeof(*this))
|
||||
: Instruction(Type::JumpFalse)
|
||||
, m_condition(condition)
|
||||
, m_target(target)
|
||||
{
|
||||
|
|
@ -1173,7 +1173,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit JumpNullish(Operand condition, Label true_target, Label false_target)
|
||||
: Instruction(Type::JumpNullish, sizeof(*this))
|
||||
: Instruction(Type::JumpNullish)
|
||||
, m_condition(condition)
|
||||
, m_true_target(true_target)
|
||||
, m_false_target(false_target)
|
||||
|
|
@ -1203,7 +1203,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit JumpUndefined(Operand condition, Label true_target, Label false_target)
|
||||
: Instruction(Type::JumpUndefined, sizeof(*this))
|
||||
: Instruction(Type::JumpUndefined)
|
||||
, m_condition(condition)
|
||||
, m_true_target(true_target)
|
||||
, m_false_target(false_target)
|
||||
|
|
@ -1239,7 +1239,7 @@ public:
|
|||
static constexpr bool IsVariableLength = true;
|
||||
|
||||
Call(CallType type, Operand dst, Operand callee, Operand this_value, ReadonlySpan<Operand> arguments, Optional<StringTableIndex> expression_string = {}, Optional<Builtin> builtin = {})
|
||||
: Instruction(Type::Call, length_impl(arguments.size()))
|
||||
: Instruction(Type::Call)
|
||||
, m_dst(dst)
|
||||
, m_callee(callee)
|
||||
, m_this_value(this_value)
|
||||
|
|
@ -1252,9 +1252,9 @@ public:
|
|||
m_arguments[i] = arguments[i];
|
||||
}
|
||||
|
||||
size_t length_impl(size_t argument_count) const
|
||||
size_t length_impl() const
|
||||
{
|
||||
return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * argument_count);
|
||||
return round_up_to_power_of_two(alignof(void*), sizeof(*this) + sizeof(Operand) * m_argument_count);
|
||||
}
|
||||
|
||||
CallType call_type() const { return m_type; }
|
||||
|
|
@ -1284,7 +1284,7 @@ private:
|
|||
class CallWithArgumentArray final : public Instruction {
|
||||
public:
|
||||
CallWithArgumentArray(CallType type, Operand dst, Operand callee, Operand this_value, Operand arguments, Optional<StringTableIndex> expression_string = {})
|
||||
: Instruction(Type::CallWithArgumentArray, sizeof(*this))
|
||||
: Instruction(Type::CallWithArgumentArray)
|
||||
, m_dst(dst)
|
||||
, m_callee(callee)
|
||||
, m_this_value(this_value)
|
||||
|
|
@ -1316,7 +1316,7 @@ private:
|
|||
class SuperCallWithArgumentArray : public Instruction {
|
||||
public:
|
||||
explicit SuperCallWithArgumentArray(Operand dst, Operand arguments, bool is_synthetic)
|
||||
: Instruction(Type::SuperCallWithArgumentArray, sizeof(*this))
|
||||
: Instruction(Type::SuperCallWithArgumentArray)
|
||||
, m_dst(dst)
|
||||
, m_arguments(arguments)
|
||||
, m_is_synthetic(is_synthetic)
|
||||
|
|
@ -1339,7 +1339,7 @@ private:
|
|||
class NewClass final : public Instruction {
|
||||
public:
|
||||
explicit NewClass(Operand dst, Optional<Operand> super_class, ClassExpression const& class_expression, Optional<IdentifierTableIndex> lhs_name)
|
||||
: Instruction(Type::NewClass, sizeof(*this))
|
||||
: Instruction(Type::NewClass)
|
||||
, m_dst(dst)
|
||||
, m_super_class(super_class)
|
||||
, m_class_expression(class_expression)
|
||||
|
|
@ -1365,7 +1365,7 @@ private:
|
|||
class NewFunction final : public Instruction {
|
||||
public:
|
||||
explicit NewFunction(Operand dst, FunctionExpression const& function_node, Optional<IdentifierTableIndex> lhs_name, Optional<Operand> home_object = {})
|
||||
: Instruction(Type::NewFunction, sizeof(*this))
|
||||
: Instruction(Type::NewFunction)
|
||||
, m_dst(dst)
|
||||
, m_function_node(function_node)
|
||||
, m_lhs_name(lhs_name)
|
||||
|
|
@ -1391,7 +1391,7 @@ private:
|
|||
class BlockDeclarationInstantiation final : public Instruction {
|
||||
public:
|
||||
explicit BlockDeclarationInstantiation(ScopeNode const& scope_node)
|
||||
: Instruction(Type::BlockDeclarationInstantiation, sizeof(*this))
|
||||
: Instruction(Type::BlockDeclarationInstantiation)
|
||||
, m_scope_node(scope_node)
|
||||
{
|
||||
}
|
||||
|
|
@ -1410,7 +1410,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit Return(Optional<Operand> value = {})
|
||||
: Instruction(Type::Return, sizeof(*this))
|
||||
: Instruction(Type::Return)
|
||||
, m_value(value)
|
||||
{
|
||||
}
|
||||
|
|
@ -1427,7 +1427,7 @@ private:
|
|||
class Increment final : public Instruction {
|
||||
public:
|
||||
explicit Increment(Operand dst)
|
||||
: Instruction(Type::Increment, sizeof(*this))
|
||||
: Instruction(Type::Increment)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
|
@ -1444,7 +1444,7 @@ private:
|
|||
class PostfixIncrement final : public Instruction {
|
||||
public:
|
||||
explicit PostfixIncrement(Operand dst, Operand src)
|
||||
: Instruction(Type::PostfixIncrement, sizeof(*this))
|
||||
: Instruction(Type::PostfixIncrement)
|
||||
, m_dst(dst)
|
||||
, m_src(src)
|
||||
{
|
||||
|
|
@ -1464,7 +1464,7 @@ private:
|
|||
class Decrement final : public Instruction {
|
||||
public:
|
||||
explicit Decrement(Operand dst)
|
||||
: Instruction(Type::Decrement, sizeof(*this))
|
||||
: Instruction(Type::Decrement)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
|
@ -1481,7 +1481,7 @@ private:
|
|||
class PostfixDecrement final : public Instruction {
|
||||
public:
|
||||
explicit PostfixDecrement(Operand dst, Operand src)
|
||||
: Instruction(Type::PostfixDecrement, sizeof(*this))
|
||||
: Instruction(Type::PostfixDecrement)
|
||||
, m_dst(dst)
|
||||
, m_src(src)
|
||||
{
|
||||
|
|
@ -1503,7 +1503,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit Throw(Operand src)
|
||||
: Instruction(Type::Throw, sizeof(*this))
|
||||
: Instruction(Type::Throw)
|
||||
, m_src(src)
|
||||
{
|
||||
}
|
||||
|
|
@ -1520,7 +1520,7 @@ private:
|
|||
class ThrowIfNotObject final : public Instruction {
|
||||
public:
|
||||
ThrowIfNotObject(Operand src)
|
||||
: Instruction(Type::ThrowIfNotObject, sizeof(*this))
|
||||
: Instruction(Type::ThrowIfNotObject)
|
||||
, m_src(src)
|
||||
{
|
||||
}
|
||||
|
|
@ -1537,7 +1537,7 @@ private:
|
|||
class ThrowIfNullish final : public Instruction {
|
||||
public:
|
||||
explicit ThrowIfNullish(Operand src)
|
||||
: Instruction(Type::ThrowIfNullish, sizeof(*this))
|
||||
: Instruction(Type::ThrowIfNullish)
|
||||
, m_src(src)
|
||||
{
|
||||
}
|
||||
|
|
@ -1554,7 +1554,7 @@ private:
|
|||
class ThrowIfTDZ final : public Instruction {
|
||||
public:
|
||||
explicit ThrowIfTDZ(Operand src)
|
||||
: Instruction(Type::ThrowIfTDZ, sizeof(*this))
|
||||
: Instruction(Type::ThrowIfTDZ)
|
||||
, m_src(src)
|
||||
{
|
||||
}
|
||||
|
|
@ -1573,7 +1573,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
EnterUnwindContext(Label entry_point)
|
||||
: Instruction(Type::EnterUnwindContext, sizeof(*this))
|
||||
: Instruction(Type::EnterUnwindContext)
|
||||
, m_entry_point(move(entry_point))
|
||||
{
|
||||
}
|
||||
|
|
@ -1605,7 +1605,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
ScheduleJump(Label target)
|
||||
: Instruction(Type::ScheduleJump, sizeof(*this))
|
||||
: Instruction(Type::ScheduleJump)
|
||||
, m_target(target)
|
||||
{
|
||||
}
|
||||
|
|
@ -1626,7 +1626,7 @@ private:
|
|||
class LeaveLexicalEnvironment final : public Instruction {
|
||||
public:
|
||||
LeaveLexicalEnvironment()
|
||||
: Instruction(Type::LeaveLexicalEnvironment, sizeof(*this))
|
||||
: Instruction(Type::LeaveLexicalEnvironment)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -1637,7 +1637,7 @@ public:
|
|||
class LeaveUnwindContext final : public Instruction {
|
||||
public:
|
||||
LeaveUnwindContext()
|
||||
: Instruction(Type::LeaveUnwindContext, sizeof(*this))
|
||||
: Instruction(Type::LeaveUnwindContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -1650,7 +1650,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit ContinuePendingUnwind(Label resume_target)
|
||||
: Instruction(Type::ContinuePendingUnwind, sizeof(*this))
|
||||
: Instruction(Type::ContinuePendingUnwind)
|
||||
, m_resume_target(resume_target)
|
||||
{
|
||||
}
|
||||
|
|
@ -1673,14 +1673,14 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit Yield(Label continuation_label, Operand value)
|
||||
: Instruction(Type::Yield, sizeof(*this))
|
||||
: Instruction(Type::Yield)
|
||||
, m_continuation_label(continuation_label)
|
||||
, m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
explicit Yield(nullptr_t, Operand value)
|
||||
: Instruction(Type::Yield, sizeof(*this))
|
||||
: Instruction(Type::Yield)
|
||||
, m_value(value)
|
||||
{
|
||||
}
|
||||
|
|
@ -1706,7 +1706,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit Await(Label continuation_label, Operand argument)
|
||||
: Instruction(Type::Await, sizeof(*this))
|
||||
: Instruction(Type::Await)
|
||||
, m_continuation_label(continuation_label)
|
||||
, m_argument(argument)
|
||||
{
|
||||
|
|
@ -1730,7 +1730,7 @@ private:
|
|||
class GetIterator final : public Instruction {
|
||||
public:
|
||||
GetIterator(Operand dst, Operand iterable, IteratorHint hint = IteratorHint::Sync)
|
||||
: Instruction(Type::GetIterator, sizeof(*this))
|
||||
: Instruction(Type::GetIterator)
|
||||
, m_dst(dst)
|
||||
, m_iterable(iterable)
|
||||
, m_hint(hint)
|
||||
|
|
@ -1753,7 +1753,7 @@ private:
|
|||
class GetObjectFromIteratorRecord final : public Instruction {
|
||||
public:
|
||||
GetObjectFromIteratorRecord(Operand object, Operand iterator_record)
|
||||
: Instruction(Type::GetObjectFromIteratorRecord, sizeof(*this))
|
||||
: Instruction(Type::GetObjectFromIteratorRecord)
|
||||
, m_object(object)
|
||||
, m_iterator_record(iterator_record)
|
||||
{
|
||||
|
|
@ -1773,7 +1773,7 @@ private:
|
|||
class GetNextMethodFromIteratorRecord final : public Instruction {
|
||||
public:
|
||||
GetNextMethodFromIteratorRecord(Operand next_method, Operand iterator_record)
|
||||
: Instruction(Type::GetNextMethodFromIteratorRecord, sizeof(*this))
|
||||
: Instruction(Type::GetNextMethodFromIteratorRecord)
|
||||
, m_next_method(next_method)
|
||||
, m_iterator_record(iterator_record)
|
||||
{
|
||||
|
|
@ -1793,7 +1793,7 @@ private:
|
|||
class GetMethod final : public Instruction {
|
||||
public:
|
||||
GetMethod(Operand dst, Operand object, IdentifierTableIndex property)
|
||||
: Instruction(Type::GetMethod, sizeof(*this))
|
||||
: Instruction(Type::GetMethod)
|
||||
, m_dst(dst)
|
||||
, m_object(object)
|
||||
, m_property(property)
|
||||
|
|
@ -1816,7 +1816,7 @@ private:
|
|||
class GetObjectPropertyIterator final : public Instruction {
|
||||
public:
|
||||
GetObjectPropertyIterator(Operand dst, Operand object)
|
||||
: Instruction(Type::GetObjectPropertyIterator, sizeof(*this))
|
||||
: Instruction(Type::GetObjectPropertyIterator)
|
||||
, m_dst(dst)
|
||||
, m_object(object)
|
||||
{
|
||||
|
|
@ -1836,7 +1836,7 @@ private:
|
|||
class IteratorClose final : public Instruction {
|
||||
public:
|
||||
IteratorClose(Operand iterator_record, Completion::Type completion_type, Optional<Value> completion_value)
|
||||
: Instruction(Type::IteratorClose, sizeof(*this))
|
||||
: Instruction(Type::IteratorClose)
|
||||
, m_iterator_record(iterator_record)
|
||||
, m_completion_type(completion_type)
|
||||
, m_completion_value(completion_value)
|
||||
|
|
@ -1859,7 +1859,7 @@ private:
|
|||
class AsyncIteratorClose final : public Instruction {
|
||||
public:
|
||||
AsyncIteratorClose(Operand iterator_record, Completion::Type completion_type, Optional<Value> completion_value)
|
||||
: Instruction(Type::AsyncIteratorClose, sizeof(*this))
|
||||
: Instruction(Type::AsyncIteratorClose)
|
||||
, m_iterator_record(iterator_record)
|
||||
, m_completion_type(completion_type)
|
||||
, m_completion_value(completion_value)
|
||||
|
|
@ -1882,7 +1882,7 @@ private:
|
|||
class IteratorNext final : public Instruction {
|
||||
public:
|
||||
IteratorNext(Operand dst, Operand iterator_record)
|
||||
: Instruction(Type::IteratorNext, sizeof(*this))
|
||||
: Instruction(Type::IteratorNext)
|
||||
, m_dst(dst)
|
||||
, m_iterator_record(iterator_record)
|
||||
{
|
||||
|
|
@ -1902,7 +1902,7 @@ private:
|
|||
class ResolveThisBinding final : public Instruction {
|
||||
public:
|
||||
explicit ResolveThisBinding(Operand dst)
|
||||
: Instruction(Type::ResolveThisBinding, sizeof(*this))
|
||||
: Instruction(Type::ResolveThisBinding)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
|
@ -1919,7 +1919,7 @@ private:
|
|||
class ResolveSuperBase final : public Instruction {
|
||||
public:
|
||||
explicit ResolveSuperBase(Operand dst)
|
||||
: Instruction(Type::ResolveSuperBase, sizeof(*this))
|
||||
: Instruction(Type::ResolveSuperBase)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
|
@ -1936,7 +1936,7 @@ private:
|
|||
class GetNewTarget final : public Instruction {
|
||||
public:
|
||||
explicit GetNewTarget(Operand dst)
|
||||
: Instruction(Type::GetNewTarget, sizeof(*this))
|
||||
: Instruction(Type::GetNewTarget)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
|
@ -1953,7 +1953,7 @@ private:
|
|||
class GetImportMeta final : public Instruction {
|
||||
public:
|
||||
explicit GetImportMeta(Operand dst)
|
||||
: Instruction(Type::GetImportMeta, sizeof(*this))
|
||||
: Instruction(Type::GetImportMeta)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
|
@ -1970,7 +1970,7 @@ private:
|
|||
class TypeofVariable final : public Instruction {
|
||||
public:
|
||||
TypeofVariable(Operand dst, IdentifierTableIndex identifier)
|
||||
: Instruction(Type::TypeofVariable, sizeof(*this))
|
||||
: Instruction(Type::TypeofVariable)
|
||||
, m_dst(dst)
|
||||
, m_identifier(identifier)
|
||||
{
|
||||
|
|
@ -1992,7 +1992,7 @@ public:
|
|||
constexpr static bool IsTerminator = true;
|
||||
|
||||
explicit End(Operand value)
|
||||
: Instruction(Type::End, sizeof(*this))
|
||||
: Instruction(Type::End)
|
||||
, m_value(value)
|
||||
{
|
||||
}
|
||||
|
|
@ -2009,7 +2009,7 @@ private:
|
|||
class Dump final : public Instruction {
|
||||
public:
|
||||
explicit Dump(StringView text, Operand value)
|
||||
: Instruction(Type::Dump, sizeof(*this))
|
||||
: Instruction(Type::Dump)
|
||||
, m_text(text)
|
||||
, m_value(value)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue