Commit 2f4af40
committed
deps: cherry-pick 5ba9200 from V8 upstream
Original commit message:
Fix crash when pausing in for-of loop header
Given a for-of loop:
for (const each of subject) {
The bytecode generator emits the iterator.next call + done check +
assigning to `each` all into the source position of `const each`.
The pseudo-desugared code looks something like:
var tmp;
loop {
var result = iterator.next();
if (result.done) break;
tmp = result.value;
PushBlockContext;
const each = tmp;
// rest of the loop.
}
This is a problem, as the parser starts the block scope already on
the `const each`. If the scope requires a context we can pause on
bytecode that has or has not pushed the block context yet, while
the source position looks the same.
The recent addition of per-script unique scope IDs lets us fix
this problem in the debugger: We can check if the scope ID of
the runtime scope matches the parser scope. If not, the context
was not pushed yet.
The debugger already has a `HasContext` helper. We extend it to
also check for matching scope IDs and then use `HasContext` where
we would read variable values off the context. If the context was
not pushed yet, we report them as 'unavailable'.
[email protected]
Fixed: 384413079,399002824
Change-Id: Ia2d0008d574e7eaf6c06b640053df696014d37f8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6507402
Reviewed-by: Leszek Swirski <[email protected]>
Commit-Queue: Simon Zünd <[email protected]>
Cr-Commit-Position: refs/heads/main@{#100029}
Refs: v8/v8@5ba9200
Fixes: nodejs#60580
PR-URL: nodejs#60620
Signed-off-by: Juan José Arboleda <[email protected]>1 parent 2703db7 commit 2f4af40
2 files changed
+9
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
440 | 445 | | |
441 | 446 | | |
442 | 447 | | |
| |||
549 | 554 | | |
550 | 555 | | |
551 | 556 | | |
552 | | - | |
| 557 | + | |
| 558 | + | |
553 | 559 | | |
554 | 560 | | |
555 | 561 | | |
| |||
0 commit comments