Commit 653db92
committed
[MERGE #5851 @boingoing] Parser m_nextFunctionId is set incorrectly when skipping over nested function with functions in parameter scope
Merge pull request #5851 from boingoing:skipped_function_correct_id
Parser m_nextFunctionId is set incorrectly when skipping over nested function with functions in parameter scope
We use the deferred stubs to skip over nested functions and as part of skipping them, we adjust m_nextFunctionId so that other nested functions following the one we just skipped will have their function ids set correctly. We use the RestorePoint in the deferred stub to advance m_nextFunctionId by the function id increment amount.
That's all fine unless the function we want to skip has nested functions in the parameter scope. Default argument assignments, for example. In that case, parsing or skipping the functions in the parameter scope would have already advanced m_nextFunctionId and so we end up setting it too high here. When we subsequently try and undefer one of the functions below the skipped one (one of the functions with a wrong function id), it might have a function id greater than the count of functions in the bytecode cache. Executing that function hits an assert in the bitvector we use to mark functions executed.File tree
3 files changed
+25
-0
lines changed- lib/Parser
- test/Bugs
3 files changed
+25
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6175 | 6175 | | |
6176 | 6176 | | |
6177 | 6177 | | |
| 6178 | + | |
| 6179 | + | |
| 6180 | + | |
| 6181 | + | |
| 6182 | + | |
6178 | 6183 | | |
6179 | 6184 | | |
6180 | 6185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
499 | 506 | | |
500 | 507 | | |
501 | 508 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments