• Simon Zünd's avatar
    [debug] Fix bug in locals blocklist and refactor scope iterator · 98880d5d
    Simon Zünd authored
    This CL shuffles around some code in `ScopeIterator` to better reflect
    the two (internal) iteration modes:
    
      - While "inside" the paused function we iterate based on lexical
        scopes.
      - Once we move past the paused function we iterate based on runtime
        contexts.
    
    This CL renames the advancing functions to `AdvanceScope` and
    `AdvanceContext` respectively which operate in the following way:
    
      - `AdvanceScope` first checks if the current lexical scope requires
        a context. If so, we move one context up the chain, since the next
        lexical scope belongs to that next context. Then we move up one
        lexical scope.
    
      - `AdvanceContext` moves one context up the context chain. Then we
        we move up through all the lexical scopes until we find the next
        lexical scope that requires a context.
    
    The tricky bit is the transition from scope iteration mode to context
    iteration mode. This is where the bug fix comes in. After doing one
    standard `AdvanceScope` from the `closure_scope_` to the next
    lexical scope, we need to keep moving up through the lexical scope
    until we find the next lexical scope that requires a context.
    
    The CL also changes how we collect the locals blocklist. The
    locals blocklist is always put on the current context. So every
    time we move up one context we reset the locals blocklist and
    every time we move up the lexical scope we collect the scope
    locals into the blocklist.
    
    
    R=bmeurer@chromium.org, jarin@chromium.org
    
    Fixed: chromium:1354464
    Change-Id: I7b37687a8827c20d0660a25413d2c9117b5fe5ba
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3842158
    Commit-Queue: Simon Zünd <szuend@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#82615}
    98880d5d
debug-evaluate-shadowed-context-4.js 836 Bytes