• Simon Zünd's avatar
    [debug] Report variables in TDZ as 'value unavailable' · e417b339
    Simon Zünd authored
    Consider the function:
    
    function foo() {
      debugger;
      let y = 1;
    }
    
    V8 will elide the hole initialization for 'y'. When we pause at the
    debugger statement, then 'y' evaluates to 'undefined'.
    
    This CL fixes this in the ScopeIterator. When we encounter local
    variables with an `undefined` value we check the static scope
    information if we are stopped *before* the variable's initializer.
    If yes, then we are in the variable's TDZ and report
    "value unavailable".
    
    Drive-by: Mark `GetSourcePosition()` as `const` to make it available
    in the visitor method.
    
    R=bmeurer@chromium.org
    
    Bug: chromium:1328681
    Change-Id: I8b966eaa2af64a35a58095a744440851760921a0
    Fixed: chromium:1303493
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3829539
    Commit-Queue: Simon Zünd <szuend@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#82483}
    e417b339
Name
Last commit
Last update
..
benchmarks Loading commit data...
bigint Loading commit data...
cctest Loading commit data...
common Loading commit data...
debugger Loading commit data...
debugging Loading commit data...
fuzzer Loading commit data...
fuzzilli Loading commit data...
inspector Loading commit data...
intl Loading commit data...
js-perf-test Loading commit data...
memory Loading commit data...
message Loading commit data...
mjsunit Loading commit data...
mkgrokdump Loading commit data...
mozilla Loading commit data...
test262 Loading commit data...
torque Loading commit data...
unittests Loading commit data...
wasm-api-tests Loading commit data...
wasm-js Loading commit data...
wasm-spec-tests Loading commit data...
webkit Loading commit data...
BUILD.gn Loading commit data...
OWNERS Loading commit data...