LibJS: Add bytecode instructions for modulo and exponentiation

This commit is contained in:
Gunnar Beutner
2021-06-07 19:37:23 +02:00
committed by Andreas Kling
parent 6af9d87258
commit 55f0791b13
4 changed files with 66 additions and 0 deletions

View File

@@ -55,6 +55,12 @@ Optional<Bytecode::Register> BinaryExpression::generate_bytecode(Bytecode::Gener
case BinaryOp::Division:
generator.emit<Bytecode::Op::Div>(dst_reg, *lhs_reg, *rhs_reg);
return dst_reg;
case BinaryOp::Modulo:
generator.emit<Bytecode::Op::Mod>(dst_reg, *lhs_reg, *rhs_reg);
return dst_reg;
case BinaryOp::Exponentiation:
generator.emit<Bytecode::Op::Exp>(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;