You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'.
R=leszeks@chromium.org
Fixed: 384413079,399002824
Change-Id: Ia2d0008d574e7eaf6c06b640053df696014d37f8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6507402
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#100029}
Refs: v8/v8@5ba9200Fixes: nodejs#60580
PR-URL: nodejs#60620
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
0 commit comments