diff --git a/boa_engine/src/vm/mod.rs b/boa_engine/src/vm/mod.rs index 9e7ea405033..dfc67ef7cb3 100644 --- a/boa_engine/src/vm/mod.rs +++ b/boa_engine/src/vm/mod.rs @@ -180,9 +180,7 @@ impl Context<'_> { let completion = loop { let completion = self.run_next_instruction(|opcode, context| { - total_cost = total_cost - .checked_add(usize::from(opcode.cost())) - .unwrap_or(usize::MAX); + total_cost = total_cost.saturating_add(usize::from(opcode.cost())); opcode.execute(context) }); if let ControlFlow::Break(completion) = completion {