mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00: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:
parent
81a3bfd492
commit
3f04d18ef7
Notes:
github-actions[bot]
2025-04-26 09:03:30 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 3f04d18ef7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4481
7 changed files with 27 additions and 93 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue