mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Add new operand type for function arguments
This allows us to directly access passed arguments instead of copying them to register/local first using GetArgument instruction.
This commit is contained in:
committed by
Andreas Kling
parent
81a3bfd492
commit
3f04d18ef7
Notes:
github-actions[bot]
2025-04-26 09:03:30 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/3f04d18ef7e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4481
@@ -775,52 +775,6 @@ private:
|
||||
mutable EnvironmentCoordinate m_cache;
|
||||
};
|
||||
|
||||
class SetArgument final : public Instruction {
|
||||
public:
|
||||
SetArgument(size_t index, Operand src)
|
||||
: Instruction(Type::SetArgument)
|
||||
, m_index(index)
|
||||
, m_src(src)
|
||||
{
|
||||
}
|
||||
|
||||
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
||||
void visit_operands_impl(Function<void(Operand&)> visitor)
|
||||
{
|
||||
visitor(m_src);
|
||||
}
|
||||
|
||||
size_t index() const { return m_index; }
|
||||
Operand src() const { return m_src; }
|
||||
|
||||
private:
|
||||
u32 m_index;
|
||||
Operand m_src;
|
||||
};
|
||||
|
||||
class GetArgument final : public Instruction {
|
||||
public:
|
||||
GetArgument(Operand dst, size_t index)
|
||||
: Instruction(Type::GetArgument)
|
||||
, m_index(index)
|
||||
, m_dst(dst)
|
||||
{
|
||||
}
|
||||
|
||||
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
|
||||
void visit_operands_impl(Function<void(Operand&)> visitor)
|
||||
{
|
||||
visitor(m_dst);
|
||||
}
|
||||
|
||||
u32 index() const { return m_index; }
|
||||
Operand dst() const { return m_dst; }
|
||||
|
||||
private:
|
||||
u32 m_index;
|
||||
Operand m_dst;
|
||||
};
|
||||
|
||||
class GetCalleeAndThisFromEnvironment final : public Instruction {
|
||||
public:
|
||||
explicit GetCalleeAndThisFromEnvironment(Operand callee, Operand this_value, IdentifierTableIndex identifier)
|
||||
|
||||
Reference in New Issue
Block a user