mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibJS: Add Sub bytecode instruction (subtract values)
This commit is contained in:
parent
23a4448862
commit
2b9fbd10ed
3 changed files with 35 additions and 3 deletions
|
@ -21,6 +21,11 @@ void Add::execute(Bytecode::Interpreter& interpreter) const
|
|||
interpreter.reg(m_dst) = add(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
|
||||
}
|
||||
|
||||
void Sub::execute(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
interpreter.reg(m_dst) = sub(interpreter.global_object(), interpreter.reg(m_src1), interpreter.reg(m_src2));
|
||||
}
|
||||
|
||||
void NewString::execute(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
interpreter.reg(m_dst) = js_string(interpreter.vm(), m_string);
|
||||
|
@ -46,6 +51,11 @@ String Add::to_string() const
|
|||
return String::formatted("Add dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
|
||||
}
|
||||
|
||||
String Sub::to_string() const
|
||||
{
|
||||
return String::formatted("Sub dst:{}, src1:{}, src2:{}", m_dst, m_src1, m_src2);
|
||||
}
|
||||
|
||||
String NewString::to_string() const
|
||||
{
|
||||
return String::formatted("NewString dst:{}, string:\"{}\"", m_dst, m_string);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue