62ee78eeec
In order to support causal-async-stacks, the following synthetic calls are inserted: _asyncStackTraceHelper, _setAsyncThreadStackTrace and _clearAsyncThreadStackTrace. _asyncStackTraceHelper is always generated in the async transformation. _setAsyncThreadStackTrace and _clearAsyncThreadStackTrace are inserted during bytecode generation (or in the flow graph builder in case of AST pipeline). If bytecode generation options are set inconsistently with --causal-async-stacks VM option, then it was possible that _asyncStackTraceHelper was generated but other calls were not generated, causing incorrect (full, non-truncated) async stack traces. This also causes performance regression as collecting full stack traces takes much more time. This change makes generation of all these calls more consistent: if causal async stacks are disabled during bytecode generation, then all three calls are omitted. Also, in case these calls were generated and present in bytecode, but VM option --causal-async-stacks is disabled, then bytecode flow graph builder turns all these three calls into no-ops. Change-Id: I93eb1d83c675ee093799bb8e37ca3d60a3c5c19d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120927 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Régis Crelier <regis@google.com>