mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +00:00
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:
@@ -282,6 +282,11 @@ void Jump::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
interpreter.jump(*m_true_target);
|
||||
}
|
||||
|
||||
void ResolveThisBinding::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
interpreter.accumulator() = interpreter.vm().resolve_this_binding(interpreter.global_object());
|
||||
}
|
||||
|
||||
void Jump::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
|
||||
{
|
||||
if (m_true_target.has_value() && &m_true_target->block() == &from)
|
||||
@@ -785,4 +790,9 @@ String IteratorResultValue::to_string_impl(Executable const&) const
|
||||
return "IteratorResultValue";
|
||||
}
|
||||
|
||||
String ResolveThisBinding::to_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "ResolveThisBinding"sv;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user