LibJS: Add bytecode instructions for multiplication and division

This commit is contained in:
Gunnar Beutner 2021-06-07 19:17:20 +02:00 committed by Andreas Kling
commit 3c5ce9b5b7
Notes: sideshowbarker 2024-07-18 12:41:29 +09:00
4 changed files with 66 additions and 0 deletions

View file

@ -49,6 +49,12 @@ Optional<Bytecode::Register> BinaryExpression::generate_bytecode(Bytecode::Gener
case BinaryOp::Subtraction:
generator.emit<Bytecode::Op::Sub>(dst_reg, *lhs_reg, *rhs_reg);
return dst_reg;
case BinaryOp::Multiplication:
generator.emit<Bytecode::Op::Mul>(dst_reg, *lhs_reg, *rhs_reg);
return dst_reg;
case BinaryOp::Division:
generator.emit<Bytecode::Op::Div>(dst_reg, *lhs_reg, *rhs_reg);
return dst_reg;
case BinaryOp::LessThan:
generator.emit<Bytecode::Op::LessThan>(dst_reg, *lhs_reg, *rhs_reg);
return dst_reg;