Handle Finally Block When Jitting a loop in a Generator or Async function #7043
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The OpCode TryFinallyWithYield is intended for Finally {} blocks where either the try or finally statement contains a Yield or Await. BUT was being used for all Finally {} blocks occurring in Generator or Async functions.
This OpCode is not implemented in the JIT. This results in an Abort when jitting a Generator or async function (or a loop inside a generator or async function) that contained a finally block.
The for...of construction includes an implicit finally block, it was the trigger for the Abort in issue 7034.
As we currently only try and Jit loops inside Async/Generator functions that do not contain Yield/Await, nothing we currently Jit ought to need the TryFInallyWithYield OpCode. Fix the issue by detecting when a Try/Finally statement actually contains a Yield or Await and only using the TryFinallyWithYield OpCode in those cases (Which are not due to be Jitted anyway), in cases without Yield/Await use the alternative Opcode TryFinally (which the Jit does support).
Fix:#7016
Fix:#7034