Instead of keeping offsets of bytecode declarations in a map,
offset is now stored in a field of a base class for all declarations.
This saves certain number of map lookups while serializing bytecode.
Also, calls to a rather expensive Map.putIfAbsent are removed.
Change-Id: I036fbb0e1d8afc6e402709a0a1eafb0e50a2c25a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122170
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Sometimes we need to stop at the first CheckStack and scan call stack in
the debugger, so debugger needs to know initial context level on function
entry, even before setting up initial context.
This change moves the first scope declaration before the first CheckStack.
Parameters which are not captured are also declared in the initial scope.
After creating an initial context we may add the 2nd scope, along with
captured parameters.
Fixes flaky crashes due to context level mismatch in
service/async_generator_breakpoint_test/1 with bytecode in debug mode.
Change-Id: I11ce1407ee58954b167e51a25302272b05365386
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117296
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Even if a scope doesn't have variables, it may define a context
level different from enclosing scope. As debugger needs to know
context level at any point, bytecode generator should not elide
such scopes.
Change-Id: I2f97deae55285b758f91aee852338432dcddf373
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109898
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>