LibJS: Implement 'this' in the bytecode VM

ThisExpression now emits a "ResolveThisBinding" bytecode op, which
simply loads the VM's current 'this' binding into the accumulator.
This commit is contained in:
Andreas Kling 2021-10-24 14:43:00 +02:00
commit 3117182c2e
Notes: sideshowbarker 2024-07-18 01:56:46 +09:00
5 changed files with 29 additions and 0 deletions

View file

@ -1298,4 +1298,9 @@ void ClassDeclaration::generate_bytecode(Bytecode::Generator& generator) const
generator.emit<Bytecode::Op::SetVariable>(generator.intern_string(m_class_expression.ptr()->name()));
}
void ThisExpression::generate_bytecode(Bytecode::Generator& generator) const
{
generator.emit<Bytecode::Op::ResolveThisBinding>();
}
}