1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

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
parent 5183952d1d
commit 3c5ce9b5b7
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;