mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 15:44:45 +00:00
LibJS: Add LoadArgument bytecode instruction for fast argument access
This is generated for Identifier nodes that represent a function argument variable. It loads a given argument index from the current call frame into the accumulator.
This commit is contained in:
@@ -260,7 +260,10 @@ void StringLiteral::generate_bytecode(Bytecode::Generator& generator) const
|
||||
|
||||
void Identifier::generate_bytecode(Bytecode::Generator& generator) const
|
||||
{
|
||||
generator.emit<Bytecode::Op::GetVariable>(generator.intern_string(m_string));
|
||||
if (m_argument_index.has_value())
|
||||
generator.emit<Bytecode::Op::LoadArgument>(m_argument_index.value());
|
||||
else
|
||||
generator.emit<Bytecode::Op::GetVariable>(generator.intern_string(m_string));
|
||||
}
|
||||
|
||||
void AssignmentExpression::generate_bytecode(Bytecode::Generator& generator) const
|
||||
|
||||
Reference in New Issue
Block a user