mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibJS: Add PutById bytecode instruction for object property assignment
Note that this is only used for non-computed accesses. Computed access is not yet implemented. :^)
This commit is contained in:
parent
bea6e31ddc
commit
14cfc44855
3 changed files with 44 additions and 0 deletions
|
@ -56,6 +56,12 @@ void SetVariable::execute(Bytecode::Interpreter& interpreter) const
|
|||
interpreter.vm().set_variable(m_identifier, interpreter.reg(m_src), interpreter.global_object());
|
||||
}
|
||||
|
||||
void PutById::execute(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
if (auto* object = interpreter.reg(m_base).to_object(interpreter.global_object()))
|
||||
object->put(m_property, interpreter.reg(m_src));
|
||||
}
|
||||
|
||||
void Jump::execute(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
interpreter.jump(m_target);
|
||||
|
@ -122,6 +128,11 @@ String SetVariable::to_string() const
|
|||
return String::formatted("SetVariable identifier:{}, src:{}", m_identifier, m_src);
|
||||
}
|
||||
|
||||
String PutById::to_string() const
|
||||
{
|
||||
return String::formatted("PutById base:{}, property:{}, src:{}", m_base, m_property, m_src);
|
||||
}
|
||||
|
||||
String Jump::to_string() const
|
||||
{
|
||||
return String::formatted("Jump {}", m_target);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue