Commit fa32f3f
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: #60580
PR-URL: #60620
Signed-off-by: Juan José Arboleda <[email protected]>1 parent dd9a117 commit fa32f3f
File tree
4 files changed
+79
-10
lines changed- deps/v8
- src/debug
- test/inspector/regress
4 files changed
+79
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
434 | 450 | | |
435 | 451 | | |
436 | 452 | | |
| |||
475 | 491 | | |
476 | 492 | | |
477 | 493 | | |
478 | | - | |
| 494 | + | |
479 | 495 | | |
480 | 496 | | |
481 | 497 | | |
| |||
538 | 554 | | |
539 | 555 | | |
540 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
541 | 562 | | |
542 | 563 | | |
543 | 564 | | |
| |||
547 | 568 | | |
548 | 569 | | |
549 | 570 | | |
550 | | - | |
551 | | - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
552 | 574 | | |
553 | 575 | | |
554 | | - | |
| 576 | + | |
555 | 577 | | |
556 | 578 | | |
557 | 579 | | |
558 | | - | |
559 | | - | |
| 580 | + | |
| 581 | + | |
560 | 582 | | |
561 | 583 | | |
562 | | - | |
| 584 | + | |
563 | 585 | | |
564 | 586 | | |
565 | 587 | | |
566 | 588 | | |
567 | 589 | | |
568 | 590 | | |
569 | | - | |
| 591 | + | |
570 | 592 | | |
571 | 593 | | |
572 | | - | |
| 594 | + | |
573 | 595 | | |
574 | 596 | | |
575 | | - | |
| 597 | + | |
576 | 598 | | |
577 | 599 | | |
578 | 600 | | |
| |||
962 | 984 | | |
963 | 985 | | |
964 | 986 | | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
965 | 993 | | |
966 | 994 | | |
967 | 995 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 35 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 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments