instructionBudget
How much work one call may do before the engine gives up. Zero, the default, means no limit. This is how you stop a script that never returns. The Promise reactions a call queues run within the same budget, and when the engine stops a script the reactions still queued are dropped, so the abandoned work does not run on the next call.
What one unit is belongs to the engine. Rhino counts interpreter instructions; QuickJS counts the checks it makes at every loop iteration and call, which come about one for every ten of Rhino's instructions. Either way a budget in the hundreds of thousands stops a runaway loop in well under a second and leaves ordinary scripts alone.