• Simon Zünd's avatar
    [debug] Fix source position around class literals · 6a8b90c3
    Simon Zünd authored
    This CL builds upon https://crrev.com/c/3284887 (and partly reverts it).
    
    Class literals are a bit iffy when it comes to source position and
    debugging. Mainly the debugger assumes the following invariant:
    When we are paused inside a class scope, then we expect the class's
    BlockContext to be pushed already. On the other hand, when we are
    paused outside a class scope in a function, we don't expect to find
    the class's BlockContext.
    
    The problem is that there are cases where we can either pause
    "inside" or "outside" the class scope. E.g.:
    
      * `var x = class {};` will break on `class` which is inside
        the class scope, so we expect the BlockContext to be pushed
    
      * `new class x {};` will break on `new` which is outside the
        class scope, so we expect the BlockContext to not be pushed
        yet.
    
    The issue with the fix in https://crrev.com/c/3284887 is that it
    adjusted the break position for the bytecode of class literals to
    ALWAYS be after the BlockContext is pushed. This breaks the
    second example above. We need to tighten the fix a bit and only
    defer the break position if the "current source position" is
    inside the class's scope. This way we always guarantee that the
    BlockContext is pushed or not, depending if the source position
    that corresponds to the break position is inside or outside the
    class's scope.
    
    Note 1: The CL updates a lot of the bytecode expectations. This
    is because the class literals are often the first statement in
    the snippet so we don't need to defer the break position.
    
    Note 2: We add a mirrored debugger test to the inspector test so
    the fuzzer can have some more fun.
    
    Fixed: chromim:1350842
    Change-Id: I9b5a409f77be80db674217a685a3fc9f8a0a71cf
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3827871Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
    Reviewed-by: 's avatarKim-Anh Tran <kimanh@chromium.org>
    Commit-Queue: Simon Zünd <szuend@chromium.org>
    Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#82473}
    6a8b90c3
Name
Last commit
Last update
..
api Loading commit data...
asmjs Loading commit data...
ast Loading commit data...
base Loading commit data...
baseline Loading commit data...
bigint Loading commit data...
builtins Loading commit data...
codegen Loading commit data...
common Loading commit data...
compiler Loading commit data...
compiler-dispatcher Loading commit data...
d8 Loading commit data...
date Loading commit data...
debug Loading commit data...
deoptimizer Loading commit data...
diagnostics Loading commit data...
execution Loading commit data...
extensions Loading commit data...
flags Loading commit data...
handles Loading commit data...
heap Loading commit data...
ic Loading commit data...
init Loading commit data...
inspector Loading commit data...
interpreter Loading commit data...
json Loading commit data...
libplatform Loading commit data...
libsampler Loading commit data...
logging Loading commit data...
maglev Loading commit data...
numbers Loading commit data...
objects Loading commit data...
parsing Loading commit data...
profiler Loading commit data...
protobuf Loading commit data...
regexp Loading commit data...
roots Loading commit data...
runtime Loading commit data...
sandbox Loading commit data...
sanitizer Loading commit data...
snapshot Loading commit data...
strings Loading commit data...
tasks Loading commit data...
temporal Loading commit data...
third_party Loading commit data...
torque Loading commit data...
tracing Loading commit data...
trap-handler Loading commit data...
utils Loading commit data...
wasm Loading commit data...
web-snapshot Loading commit data...
zone Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
OWNERS Loading commit data...