v8/test/debugger/regress
Simon Zünd 6a8b90c303 [debug] Fix source position around class literals
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/+/3827871
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82473}
2022-08-16 07:16:47 +00:00
..
regress-1639-2.js
regress-2318.js
regress-5575-1.js
regress-5575-2.js
regress-5575-3.js
regress-5610.js [debug][cleanup] Use consistent StepInto and StepOver naming. 2021-06-01 11:26:57 +00:00
regress-5901-1.js [debug][cleanup] Use consistent StepInto and StepOver naming. 2021-06-01 11:26:57 +00:00
regress-5901-2.js
regress-5950.js
regress-6085.js [debug][cleanup] Use consistent StepInto and StepOver naming. 2021-06-01 11:26:57 +00:00
regress-6526.js
regress-7421.js Revert "[turbofan] Making OSR concurrent" 2022-02-21 14:02:43 +00:00
regress-9482.js Add test for debug evaluating a previously non-whitelisted variable 2019-09-11 09:45:33 +00:00
regress-1145119.js [debugger] Throw exception if var x fails in debug eval 2021-11-22 13:35:29 +00:00
regress-crbug-10132.js [debug] Collect source positions Debug::PrintBreakLocation 2020-01-21 12:07:03 +00:00
regress-crbug-507070.js
regress-crbug-724858.js [debug][cleanup] Use consistent StepInto and StepOver naming. 2021-06-01 11:26:57 +00:00
regress-crbug-736758.js
regress-crbug-760225.js [debugger] Fix debug-evaluate for context-allocated this. 2019-07-05 12:14:35 +00:00
regress-crbug-808973.js [d8] Exit with error code upon unhandled promise rejection 2020-06-24 07:21:58 +00:00
regress-crbug-835973.js [debug][cleanup] Use consistent StepInto and StepOver naming. 2021-06-01 11:26:57 +00:00
regress-crbug-840288.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
regress-crbug-882664.js
regress-crbug-1032042.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
regress-crbug-1156498.js [debug] Include Token::CLASS in class scopes and ContainsPosition 2021-04-29 08:43:23 +00:00
regress-crbug-1199681.js [sparkplug][debugger] Fix deopt of inlined function in debugger 2021-04-23 15:15:52 +00:00
regress-crbug-1259878.js [bytecode-generator] Move source code position for classes 2021-11-17 09:40:32 +00:00
regress-crbug-1350842.js [debug] Fix source position around class literals 2022-08-16 07:16:47 +00:00