Version 2.18.0-242.0.dev

Merge commit '0036dc7c573d6e782a6b40257d8c701c02cbb5f6' into 'dev'
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index f9f9301..f553073 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -1004,8 +1004,6 @@
   void _handleResolvedUnitResult(ResolvedUnitResult result) {
     var path = result.path;
 
-    analysisServer.getDocumentationCacheFor(result)?.cacheFromResult(result);
-
     var unit = result.unit;
     if (analysisServer._hasAnalysisServiceSubscription(
         AnalysisService.HIGHLIGHTS, path)) {
diff --git a/pkg/analysis_server/lib/src/analysis_server_abstract.dart b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
index acfa949..6cb4994 100644
--- a/pkg/analysis_server/lib/src/analysis_server_abstract.dart
+++ b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
@@ -17,7 +17,6 @@
 import 'package:analysis_server/src/server/diagnostic_server.dart';
 import 'package:analysis_server/src/server/performance.dart';
 import 'package:analysis_server/src/services/completion/completion_performance.dart';
-import 'package:analysis_server/src/services/completion/dart/documentation_cache.dart';
 import 'package:analysis_server/src/services/correction/namespace.dart';
 import 'package:analysis_server/src/services/pub/pub_api.dart';
 import 'package:analysis_server/src/services/pub/pub_command.dart';
@@ -30,7 +29,6 @@
 import 'package:analysis_server/src/utilities/process.dart';
 import 'package:analysis_server/src/utilities/request_statistics.dart';
 import 'package:analysis_server/src/utilities/tee_string_sink.dart';
-import 'package:analyzer/dart/analysis/analysis_context.dart';
 import 'package:analyzer/dart/analysis/results.dart';
 import 'package:analyzer/dart/analysis/session.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -96,10 +94,6 @@
   DeclarationsTracker? declarationsTracker;
   DeclarationsTrackerData? declarationsTrackerData;
 
-  /// A map from analysis contexts to the documentation cache associated with
-  /// each context.
-  Map<AnalysisContext, DocumentationCache> documentationForContext = {};
-
   /// The DiagnosticServer for this AnalysisServer. If available, it can be used
   /// to start an http diagnostics server or return the port for an existing
   /// server.
@@ -262,7 +256,6 @@
 
   void addContextsToDeclarationsTracker() {
     declarationsTracker?.discardContexts();
-    documentationForContext.clear();
     for (var driver in driverMap.values) {
       declarationsTracker?.addContext(driver.analysisContext!);
     }
@@ -338,26 +331,6 @@
         DartdocDirectiveInfo();
   }
 
-  /// Return the object used to cache the documentation for elements in the
-  /// context that produced the [result], or `null` if there is no cache for the
-  /// context.
-  DocumentationCache? getDocumentationCacheFor(ResolvedUnitResult result) {
-    return getDocumentationCacheForSession(result.session);
-  }
-
-  /// Return the object used to cache the documentation for elements in the
-  /// context that produced the [session], or `null` if there is no cache for
-  /// the context.
-  DocumentationCache? getDocumentationCacheForSession(AnalysisSession session) {
-    var context = session.analysisContext;
-    var tracker = declarationsTracker?.getContext(context);
-    if (tracker == null) {
-      return null;
-    }
-    return documentationForContext.putIfAbsent(
-        context, () => DocumentationCache(tracker.dartdocDirectiveInfo));
-  }
-
   /// Return a [Future] that completes with the [Element] at the given
   /// [offset] of the given [file], or with `null` if there is no node at the
   /// [offset] or the node does not have an element.
diff --git a/pkg/analysis_server/lib/src/cider/completion.dart b/pkg/analysis_server/lib/src/cider/completion.dart
index e9a515d..8a6c056 100644
--- a/pkg/analysis_server/lib/src/cider/completion.dart
+++ b/pkg/analysis_server/lib/src/cider/completion.dart
@@ -85,7 +85,6 @@
         enclosingNode: enclosingNode,
         offset: offset,
         dartdocDirectiveInfo: null,
-        documentationCache: null,
       );
 
       var suggestions = await performance.runAsync(
diff --git a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions.dart b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions.dart
index 570ccb6..62907af 100644
--- a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions.dart
+++ b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions.dart
@@ -114,7 +114,6 @@
           dartdocDirectiveInfo: server.getDartdocDirectiveInfoFor(
             resolvedUnit,
           ),
-          documentationCache: server.getDocumentationCacheFor(resolvedUnit),
         );
 
         var completionId =
diff --git a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart
index 0fbc2f7..d889bbd 100644
--- a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart
+++ b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart
@@ -195,8 +195,6 @@
           offset: offset,
           dartdocDirectiveInfo:
               server.getDartdocDirectiveInfoForSession(analysisSession),
-          documentationCache:
-              server.getDocumentationCacheForSession(analysisSession),
         );
         setNewRequest(completionRequest);
 
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index 044ae3f..49cc0b8 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -1006,8 +1006,6 @@
   void _handleResolvedUnitResult(ResolvedUnitResult result) {
     var path = result.path;
 
-    analysisServer.getDocumentationCacheFor(result)?.cacheFromResult(result);
-
     final unit = result.unit;
     if (analysisServer.shouldSendClosingLabelsFor(path)) {
       final labels = DartUnitClosingLabelsComputer(result.lineInfo, unit)
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index 8e1cc46..e8241d4 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -8,7 +8,6 @@
 import 'package:analysis_server/src/services/completion/dart/arglist_contributor.dart';
 import 'package:analysis_server/src/services/completion/dart/closure_contributor.dart';
 import 'package:analysis_server/src/services/completion/dart/combinator_contributor.dart';
-import 'package:analysis_server/src/services/completion/dart/documentation_cache.dart';
 import 'package:analysis_server/src/services/completion/dart/enum_constant_constructor_contributor.dart';
 import 'package:analysis_server/src/services/completion/dart/extension_member_contributor.dart';
 import 'package:analysis_server/src/services/completion/dart/feature_computer.dart';
@@ -296,8 +295,6 @@
   /// Return the object used to resolve macros in Dartdoc comments.
   final DartdocDirectiveInfo dartdocDirectiveInfo;
 
-  final DocumentationCache? documentationCache;
-
   /// Return the object used to compute the values of the features used to
   /// compute relevance scores for suggestions.
   final FeatureComputer featureComputer;
@@ -340,7 +337,6 @@
     required int offset,
     DartdocDirectiveInfo? dartdocDirectiveInfo,
     CompletionPreference completionPreference = CompletionPreference.insert,
-    DocumentationCache? documentationCache,
   }) {
     var target = CompletionTarget.forOffset(enclosingNode, offset);
 
@@ -366,7 +362,6 @@
       content: fileContent,
       contextType: contextType,
       dartdocDirectiveInfo: dartdocDirectiveInfo ?? DartdocDirectiveInfo(),
-      documentationCache: documentationCache,
       featureComputer: featureComputer,
       libraryElement: libraryElement,
       offset: offset,
@@ -383,7 +378,6 @@
     required int offset,
     DartdocDirectiveInfo? dartdocDirectiveInfo,
     CompletionPreference completionPreference = CompletionPreference.insert,
-    DocumentationCache? documentationCache,
   }) {
     return DartCompletionRequest(
       analysisSession: resolvedUnit.session,
@@ -394,7 +388,6 @@
       offset: offset,
       dartdocDirectiveInfo: dartdocDirectiveInfo,
       completionPreference: completionPreference,
-      documentationCache: documentationCache,
     );
   }
 
@@ -404,7 +397,6 @@
     required this.content,
     required this.contextType,
     required this.dartdocDirectiveInfo,
-    required this.documentationCache,
     required this.featureComputer,
     required this.libraryElement,
     required this.offset,
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/documentation_cache.dart b/pkg/analysis_server/lib/src/services/completion/dart/documentation_cache.dart
deleted file mode 100644
index 9ceca57..0000000
--- a/pkg/analysis_server/lib/src/services/completion/dart/documentation_cache.dart
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analysis_server/src/computer/computer_hover.dart';
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart';
-
-/// Cached data about the documentation associated with the elements declared in
-/// a single analysis context.
-class DocumentationCache {
-  /// A shared instance for elements that have no documentation.
-  static final DocumentationWithSummary _emptyDocs =
-      DocumentationWithSummary(full: '', summary: '');
-
-  /// The object used to compute the documentation associated with a single
-  /// element.
-  final DartdocDirectiveInfo dartdocDirectiveInfo;
-
-  /// The documentation associated with the elements that have been cached. The
-  /// cache is keyed by the path of the file containing the declaration of the
-  /// element and the qualified name of the element.
-  final Map<String, Map<String, DocumentationWithSummary>> documentationCache =
-      {};
-
-  /// Initialize a newly created cache.
-  DocumentationCache(this.dartdocDirectiveInfo);
-
-  /// Fill the cache with data from the [result].
-  void cacheFromResult(ResolvedUnitResult result) {
-    var compilationUnit = result.unit.declaredElement;
-    if (compilationUnit != null) {
-      documentationCache.remove(_keyForUnit(compilationUnit));
-      _cacheFromElement(compilationUnit);
-      for (var library in result.libraryElement.importedLibraries) {
-        _cacheLibrary(library);
-      }
-    }
-  }
-
-  /// Return the data cached for the given [element], or `null` if there is no
-  /// cached data.
-  DocumentationWithSummary? dataFor(Element element) {
-    var parent = element.enclosingElement;
-    if (parent == null) {
-      return null;
-    }
-    var key = element.name;
-    if (key == null) {
-      return null;
-    }
-    if (parent is! CompilationUnitElement) {
-      var parentName = parent.name;
-      if (parentName == null) {
-        return null;
-      }
-      key = '$parentName.$key';
-      parent = parent.enclosingElement;
-    }
-    if (parent is CompilationUnitElement) {
-      var elementMap = documentationCache[_keyForUnit(parent)];
-      return elementMap?[key];
-    }
-    return null;
-  }
-
-  /// Fill the cache with data from the [compilationUnit].
-  void _cacheFromElement(CompilationUnitElement compilationUnit) {
-    var elementMap =
-        documentationCache.putIfAbsent(_keyForUnit(compilationUnit), () => {});
-    for (var element in compilationUnit.accessors) {
-      if (!element.isSynthetic) {
-        elementMap.cacheTopLevelElement(dartdocDirectiveInfo, element);
-      }
-    }
-    for (var element in compilationUnit.enums) {
-      var parentKey =
-          elementMap.cacheTopLevelElement(dartdocDirectiveInfo, element);
-      if (parentKey != null) {
-        for (var member in element.fields) {
-          elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
-        }
-      }
-    }
-    for (var element in compilationUnit.extensions) {
-      var parentKey =
-          elementMap.cacheTopLevelElement(dartdocDirectiveInfo, element);
-      if (parentKey != null) {
-        for (var member in element.accessors) {
-          if (!member.isSynthetic) {
-            elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
-          }
-        }
-        for (var member in element.fields) {
-          if (!member.isSynthetic) {
-            elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
-          }
-        }
-        for (var member in element.methods) {
-          elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
-        }
-      }
-    }
-    for (var element in compilationUnit.functions) {
-      elementMap.cacheTopLevelElement(dartdocDirectiveInfo, element);
-    }
-    for (var element in [
-      ...compilationUnit.mixins,
-      ...compilationUnit.classes
-    ]) {
-      var parentKey =
-          elementMap.cacheTopLevelElement(dartdocDirectiveInfo, element);
-      if (parentKey != null) {
-        for (var member in element.accessors) {
-          if (!element.isSynthetic) {
-            elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
-          }
-        }
-        for (var member in element.fields) {
-          if (!element.isSynthetic) {
-            elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
-          }
-        }
-        for (var member in element.methods) {
-          elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
-        }
-      }
-    }
-    for (var element in compilationUnit.topLevelVariables) {
-      if (!element.isSynthetic) {
-        elementMap.cacheTopLevelElement(dartdocDirectiveInfo, element);
-      }
-    }
-    for (var element in compilationUnit.typeAliases) {
-      elementMap.cacheTopLevelElement(dartdocDirectiveInfo, element);
-    }
-  }
-
-  /// Cache the data for the given [library] and every library exported from it
-  /// if it hasn't already been cached.
-  void _cacheLibrary(LibraryElement library) {
-    if (_hasDataFor(library.definingCompilationUnit)) {
-      return;
-    }
-    for (var unit in library.units) {
-      _cacheFromElement(unit);
-    }
-    for (var exported in library.exportedLibraries) {
-      _cacheLibrary(exported);
-    }
-  }
-
-  /// Return `true` if the cache contains data for the [compilationUnit].
-  bool _hasDataFor(CompilationUnitElement compilationUnit) {
-    return documentationCache.containsKey(_keyForUnit(compilationUnit));
-  }
-
-  /// Return the key used in the [documentationCache] for the [compilationUnit].
-  String _keyForUnit(CompilationUnitElement compilationUnit) =>
-      compilationUnit.source.fullName;
-}
-
-extension on Map<String, DocumentationWithSummary> {
-  /// Cache the data associated with the [element], using the given [key].
-  DocumentationWithSummary? cacheElement(
-      DartdocDirectiveInfo dartdocDirectiveInfo, String key, Element element) {
-    var documentation = DartUnitHoverComputer.computeDocumentation(
-        dartdocDirectiveInfo, element,
-        includeSummary: true);
-    if (documentation is DocumentationWithSummary) {
-      return this[key] = documentation;
-    }
-    return this[key] = DocumentationCache._emptyDocs;
-  }
-
-  /// Cache the data associated with the [member] element given that the key
-  /// associated with the member's parent is [parentKey].
-  void cacheMember(DartdocDirectiveInfo dartdocDirectiveInfo, String parentKey,
-      Element member) {
-    var name = member.name;
-    if (name == null) {
-      return;
-    }
-    cacheElement(dartdocDirectiveInfo, '$parentKey.$name', member);
-  }
-
-  /// Cache the data associated with the top-level [element], and return the
-  /// [key] used for the element. This does not cache any data associated with
-  /// any other elements, including children of the [element].
-  String? cacheTopLevelElement(
-      DartdocDirectiveInfo dartdocDirectiveInfo, Element element) {
-    var key = element.name;
-    if (key == null) {
-      return null;
-    }
-    cacheElement(dartdocDirectiveInfo, key, element);
-    return key;
-  }
-}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index 322ebfa..ad77b39 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -1354,14 +1354,6 @@
 
   /// If the [element] has a documentation comment, return it.
   _ElementDocumentation? _getDocumentation(Element element) {
-    var documentationCache = request.documentationCache;
-    var data = documentationCache?.dataFor(element);
-    if (data != null) {
-      return _ElementDocumentation(
-        full: data.full,
-        summary: data.summary,
-      );
-    }
     var doc = DartUnitHoverComputer.computeDocumentation(
       request.dartdocDirectiveInfo,
       element,
@@ -1452,13 +1444,6 @@
   /// If the [element] has a documentation comment, fill the [suggestion]'s
   /// documentation fields.
   void _setDocumentation(CompletionSuggestion suggestion, Element element) {
-    var documentationCache = request.documentationCache;
-    var data = documentationCache?.dataFor(element);
-    if (data != null) {
-      suggestion.docComplete = data.full;
-      suggestion.docSummary = data.summary;
-      return;
-    }
     var doc = DartUnitHoverComputer.computeDocumentation(
         request.dartdocDirectiveInfo, element,
         includeSummary: true);
diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics.dart b/pkg/analysis_server/tool/code_completion/completion_metrics.dart
index 0520b3f..3cd822f 100644
--- a/pkg/analysis_server/tool/code_completion/completion_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/completion_metrics.dart
@@ -12,7 +12,6 @@
 import 'package:analysis_server/src/protocol/protocol_internal.dart';
 import 'package:analysis_server/src/protocol_server.dart' as protocol;
 import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
-import 'package:analysis_server/src/services/completion/dart/documentation_cache.dart';
 import 'package:analysis_server/src/services/completion/dart/feature_computer.dart';
 import 'package:analysis_server/src/services/completion/dart/probability_range.dart';
 import 'package:analysis_server/src/services/completion/dart/relevance_tables.g.dart';
@@ -836,7 +835,6 @@
   Future<void> computeSuggestionsAndMetrics(
     ExpectedCompletion expectedCompletion,
     AnalysisContext context,
-    DocumentationCache documentationCache,
   ) async {
     // As this point the completion suggestions are computed,
     // and results are collected with varying settings for
@@ -850,7 +848,6 @@
       var request = DartCompletionRequest.forResolvedUnit(
         resolvedUnit: resolvedUnitResult,
         offset: expectedCompletion.offset,
-        documentationCache: documentationCache,
       );
 
       var opType = OpType.forCompletion(request.target, request.offset);
diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics_base.dart b/pkg/analysis_server/tool/code_completion/completion_metrics_base.dart
index 34056c4..3e13f79 100644
--- a/pkg/analysis_server/tool/code_completion/completion_metrics_base.dart
+++ b/pkg/analysis_server/tool/code_completion/completion_metrics_base.dart
@@ -5,7 +5,6 @@
 import 'dart:io' show stdout;
 import 'dart:math' as math;
 
-import 'package:analysis_server/src/services/completion/dart/documentation_cache.dart';
 import 'package:analyzer/dart/analysis/analysis_context.dart';
 import 'package:analyzer/dart/analysis/context_root.dart';
 import 'package:analyzer/dart/analysis/results.dart';
@@ -14,7 +13,6 @@
 import 'package:analyzer/file_system/overlay_file_system.dart';
 import 'package:analyzer/file_system/physical_file_system.dart';
 import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
-import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart';
 import 'package:analyzer/src/util/file_paths.dart' as file_paths;
 import 'package:args/args.dart';
 import 'package:cli_util/cli_logging.dart';
@@ -60,11 +58,9 @@
     setupForResolution(context);
 
     logger.write('Computing completions at root: ${root.root.path}\n');
-    var documentationCache = DocumentationCache(DartdocDirectiveInfo());
 
     var results = await resolveAnalyzedFiles(
       context: context,
-      documentationCache: documentationCache,
     );
 
     logger.write('Analyzing completion suggestions...\n');
@@ -84,7 +80,6 @@
         await computeSuggestionsAndMetrics(
           expectedCompletion,
           context,
-          documentationCache,
         );
 
         await removeOverlay(filePath);
@@ -109,7 +104,6 @@
   Future<void> computeSuggestionsAndMetrics(
     ExpectedCompletion expectedCompletion,
     AnalysisContext context,
-    DocumentationCache documentationCache,
   );
 
   /// Removes the overlay which has been applied to [filePath].
@@ -118,7 +112,6 @@
   /// Resolves all analyzed files within [context].
   Future<List<ResolvedUnitResult>> resolveAnalyzedFiles({
     required AnalysisContext context,
-    required DocumentationCache documentationCache,
   }) async {
     final analyzedFileCount = context.contextRoot.analyzedFiles().length;
     logger.write('Resolving $analyzedFileCount files...\n');
@@ -141,7 +134,6 @@
             continue;
           } else {
             results.add(result);
-            documentationCache.cacheFromResult(result);
           }
         } catch (exception, stackTrace) {
           progress.clear();
diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart b/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart
index 00e636e..0fa0e39 100644
--- a/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart
+++ b/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart
@@ -9,7 +9,6 @@
 import 'package:analysis_server/protocol/protocol_generated.dart';
 import 'package:analysis_server/src/protocol/protocol_internal.dart';
 import 'package:analysis_server/src/server/driver.dart';
-import 'package:analysis_server/src/services/completion/dart/documentation_cache.dart';
 import 'package:analyzer/dart/analysis/analysis_context.dart';
 import 'package:args/args.dart';
 import 'package:path/path.dart' as path;
@@ -506,7 +505,6 @@
   Future<void> computeSuggestionsAndMetrics(
     ExpectedCompletion expectedCompletion,
     AnalysisContext context,
-    DocumentationCache documentationCache,
   ) async {
     var stopwatch = Stopwatch()..start();
     var suggestionsData = await client.requestCompletion(
diff --git a/pkg/compiler/lib/src/serialization/indexed_sink_source.dart b/pkg/compiler/lib/src/serialization/indexed_sink_source.dart
index 58d1849..ec54310 100644
--- a/pkg/compiler/lib/src/serialization/indexed_sink_source.dart
+++ b/pkg/compiler/lib/src/serialization/indexed_sink_source.dart
@@ -88,7 +88,8 @@
 
   UnorderedIndexedSource(this._sourceReader, {this.previousSource})
       // [cache] slot 1 is pre-allocated to `null`.
-      : _cache = previousSource?._cache ?? {1: null};
+      : _cache =
+            previousSource != null ? {...previousSource._cache} : {1: null};
 
   /// Reads a reference to an [E?] value from the data source.
   ///
diff --git a/pkg/compiler/lib/src/serialization/source.dart b/pkg/compiler/lib/src/serialization/source.dart
index 7fab209..bd55802 100644
--- a/pkg/compiler/lib/src/serialization/source.dart
+++ b/pkg/compiler/lib/src/serialization/source.dart
@@ -96,11 +96,15 @@
 
   DataSourceReader(this._sourceReader, CompilerOptions options,
       {this.useDataKinds = false,
-      this.importedIndices,
+      DataSourceIndices? importedIndices,
       this.interner,
       this.useDeferredStrategy = false})
       : enableDeferredStrategy =
             (options.features.deferredSerialization.isEnabled),
+        this.importedIndices = importedIndices == null
+            ? null
+            : (DataSourceIndices(importedIndices.previousSourceReader)
+              ..caches.addAll(importedIndices.caches)),
         endOffset = (importedIndices?.previousSourceReader?.endOffset ?? 0) +
             _sourceReader.length {
     if (!enableDeferredStrategy) {
diff --git a/pkg/kernel/lib/src/constant_replacer.dart b/pkg/kernel/lib/src/constant_replacer.dart
new file mode 100644
index 0000000..7661867
--- /dev/null
+++ b/pkg/kernel/lib/src/constant_replacer.dart
@@ -0,0 +1,208 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+import '../ast.dart';
+
+/// Replacement visitor to clone a Constant if a subnode is replaced, and
+/// otherwise returns `null`.
+class ConstantReplacer implements ConstantVisitor<Constant?> {
+  ConstantReplacer();
+  final Map<Constant, Constant?> cache = {};
+
+  /// Like with Constants, `null` is used to signal that the [type] has not
+  /// changed.
+  DartType? visitDartType(DartType type) => null;
+
+  /// Unlike Constants and DartTypes, TreeNodes' equality checks are not
+  /// structural and therefore can be checked directly without needing `null`.
+  TreeNode visitTreeNode(TreeNode node) => node;
+
+  /// Returns a new type list that contains the recursively visited [types].
+  ///
+  /// Returns `null` if a recursive visit of [types] does not change the list.
+  List<DartType>? visitDartTypeList(List<DartType> types) {
+    List<DartType>? newTypes;
+    for (int i = 0; i < types.length; i++) {
+      DartType? result = visitDartType(types[i]);
+      if (result != null) {
+        (newTypes ??= List.of(types))[i] = result;
+      }
+    }
+    return newTypes;
+  }
+
+  /// Returns a new Constant list that contains the recursively visited
+  /// [constants].
+  ///
+  /// Returns `null` if a recursive visit of [constants] does not change the
+  /// list.
+  List<Constant>? visitConstantList(List<Constant> constants) {
+    List<Constant>? newConstants;
+    for (int i = 0; i < constants.length; i++) {
+      Constant? result = visitConstant(constants[i]);
+      if (result != null) {
+        (newConstants ??= List.of(constants))[i] = result;
+      }
+    }
+    return newConstants;
+  }
+
+  /// By default, don't change the [node].
+  @override
+  Constant? defaultConstant(Constant node) => null;
+
+  /// Visits [node] if not already visited to compute a value for [node].
+  ///
+  /// If the value has already been computed the cached value is returned
+  /// immediately.
+  ///
+  /// Call this method to compute values for subnodes recursively, while only
+  /// visiting each subnode once.
+  Constant? visitConstant(Constant node) {
+    return cache[node] ??= node.accept(this);
+  }
+
+  @override
+  Constant? visitBoolConstant(BoolConstant node) => defaultConstant(node);
+
+  @override
+  Constant? visitConstructorTearOffConstant(ConstructorTearOffConstant node) =>
+      defaultConstant(node);
+
+  @override
+  Constant? visitDoubleConstant(DoubleConstant node) => defaultConstant(node);
+
+  @override
+  Constant? visitIntConstant(IntConstant node) => defaultConstant(node);
+
+  @override
+  Constant? visitNullConstant(NullConstant node) => defaultConstant(node);
+
+  @override
+  Constant? visitRedirectingFactoryTearOffConstant(
+          RedirectingFactoryTearOffConstant node) =>
+      defaultConstant(node);
+
+  @override
+  Constant? visitStaticTearOffConstant(StaticTearOffConstant node) =>
+      defaultConstant(node);
+
+  @override
+  Constant? visitStringConstant(StringConstant node) => defaultConstant(node);
+
+  @override
+  Constant? visitSymbolConstant(SymbolConstant node) => defaultConstant(node);
+
+  @override
+  Constant? visitInstanceConstant(InstanceConstant node) {
+    List<DartType>? typeArguments = visitDartTypeList(node.typeArguments);
+    Map<Reference, Constant>? fieldValues;
+    for (Reference reference in node.fieldValues.keys) {
+      Constant? result = visitConstant(node.fieldValues[reference]!);
+      if (result != null) {
+        (fieldValues ??= Map.of(node.fieldValues))[reference] = result;
+      }
+    }
+    if (typeArguments == null && fieldValues == null) {
+      return null;
+    } else {
+      return InstanceConstant(node.classReference,
+          typeArguments ?? node.typeArguments, fieldValues ?? node.fieldValues);
+    }
+  }
+
+  @override
+  Constant? visitInstantiationConstant(InstantiationConstant node) {
+    List<DartType>? types = visitDartTypeList(node.types);
+    Constant? tearOffConstant = visitConstant(node.tearOffConstant);
+    if (types == null && tearOffConstant == null) {
+      return null;
+    } else {
+      return InstantiationConstant(
+          tearOffConstant ?? node.tearOffConstant, types ?? node.types);
+    }
+  }
+
+  @override
+  Constant? visitListConstant(ListConstant node) {
+    DartType? typeArgument = visitDartType(node.typeArgument);
+    List<Constant>? entries = visitConstantList(node.entries);
+    if (typeArgument == null && entries == null) {
+      return null;
+    } else {
+      return ListConstant(
+          typeArgument ?? node.typeArgument, entries ?? node.entries);
+    }
+  }
+
+  @override
+  Constant? visitMapConstant(MapConstant node) {
+    DartType? keyType = visitDartType(node.keyType);
+    DartType? valueType = visitDartType(node.valueType);
+    List<ConstantMapEntry>? entries;
+    for (int i = 0; i < node.entries.length; i++) {
+      ConstantMapEntry entry = node.entries[i];
+      Constant? key = visitConstant(entry.key);
+      Constant? value = visitConstant(entry.value);
+      if (key != null || value != null) {
+        (entries ??= List.of(node.entries))[i] =
+            ConstantMapEntry(key ?? entry.key, value ?? entry.value);
+      }
+    }
+    if (keyType == null && valueType == null && entries == null) {
+      return null;
+    } else {
+      return MapConstant(keyType ?? node.keyType, valueType ?? node.valueType,
+          entries ?? node.entries);
+    }
+  }
+
+  @override
+  Constant? visitSetConstant(SetConstant node) {
+    DartType? typeArgument = visitDartType(node.typeArgument);
+    List<Constant>? entries = visitConstantList(node.entries);
+    if (typeArgument == null && entries == null) {
+      return null;
+    } else {
+      return SetConstant(
+          typeArgument ?? node.typeArgument, entries ?? node.entries);
+    }
+  }
+
+  @override
+  Constant? visitTypeLiteralConstant(TypeLiteralConstant node) {
+    DartType? type = visitDartType(node.type);
+    return type == null ? null : TypeLiteralConstant(type);
+  }
+
+  @override
+  Constant? visitTypedefTearOffConstant(TypedefTearOffConstant node) {
+    TearOffConstant? tearOffConstant =
+        visitConstant(node.tearOffConstant) as TearOffConstant?;
+    List<DartType>? types = visitDartTypeList(node.types);
+    List<TypeParameter>? parameters;
+    for (int i = 0; i < node.parameters.length; i++) {
+      TypeParameter result = visitTreeNode(node.parameters[i]) as TypeParameter;
+      if (result != node.parameters[i]) {
+        (parameters ??= List.of(node.parameters))[i] = result;
+      }
+    }
+    if (tearOffConstant == null && types == null && parameters == null) {
+      return null;
+    } else {
+      return TypedefTearOffConstant(parameters ?? node.parameters,
+          tearOffConstant ?? node.tearOffConstant, types ?? node.types);
+    }
+  }
+
+  @override
+  Constant? visitUnevaluatedConstant(UnevaluatedConstant node) {
+    Expression expression = visitTreeNode(node.expression) as Expression;
+    if (expression == node.expression) {
+      return null;
+    } else {
+      return UnevaluatedConstant(expression);
+    }
+  }
+}
diff --git a/runtime/lib/timeline.cc b/runtime/lib/timeline.cc
index 0b3816c..7deea5c 100644
--- a/runtime/lib/timeline.cc
+++ b/runtime/lib/timeline.cc
@@ -24,15 +24,11 @@
   return Bool::False().ptr();
 }
 
-DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0, 0) {
+DEFINE_NATIVE_ENTRY(Timeline_getNextTaskId, 0, 0) {
 #if !defined(SUPPORT_TIMELINE)
   return Integer::New(0);
 #else
-  TimelineEventRecorder* recorder = Timeline::recorder();
-  if (recorder == NULL) {
-    return Integer::New(0);
-  }
-  return Integer::New(recorder->GetNextAsyncId());
+  return Integer::New(thread->GetNextTaskId());
 #endif
 }
 
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index 00a3c4c..c2b2ddc 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -152,7 +152,7 @@
   V(TypeError_throwNew, 4)                                                     \
   V(Stopwatch_now, 0)                                                          \
   V(Stopwatch_frequency, 0)                                                    \
-  V(Timeline_getNextAsyncId, 0)                                                \
+  V(Timeline_getNextTaskId, 0)                                                 \
   V(Timeline_getTraceClock, 0)                                                 \
   V(Timeline_isDartStreamEnabled, 0)                                           \
   V(Timeline_reportFlowEvent, 5)                                               \
diff --git a/runtime/vm/compiler/asm_intrinsifier_arm.cc b/runtime/vm/compiler/asm_intrinsifier_arm.cc
index 5bd61d7..c061a93 100644
--- a/runtime/vm/compiler/asm_intrinsifier_arm.cc
+++ b/runtime/vm/compiler/asm_intrinsifier_arm.cc
@@ -1900,6 +1900,23 @@
 #endif
 }
 
+void AsmIntrinsifier::Timeline_getNextTaskId(Assembler* assembler,
+                                             Label* normal_ir_body) {
+#if !defined(SUPPORT_TIMELINE)
+  __ LoadImmediate(R0, target::ToRawSmi(0));
+  __ Ret();
+#else
+  __ ldr(R1, Address(THR, target::Thread::next_task_id_offset()));
+  __ ldr(R2, Address(THR, target::Thread::next_task_id_offset() + 4));
+  __ SmiTag(R0, R1);  // Ignore loss of precision.
+  __ adds(R1, R1, Operand(1));
+  __ adcs(R2, R2, Operand(0));
+  __ str(R1, Address(THR, target::Thread::next_task_id_offset()));
+  __ str(R2, Address(THR, target::Thread::next_task_id_offset() + 4));
+  __ Ret();
+#endif
+}
+
 #undef __
 
 }  // namespace compiler
diff --git a/runtime/vm/compiler/asm_intrinsifier_arm64.cc b/runtime/vm/compiler/asm_intrinsifier_arm64.cc
index 2cd0d6e..33e850c 100644
--- a/runtime/vm/compiler/asm_intrinsifier_arm64.cc
+++ b/runtime/vm/compiler/asm_intrinsifier_arm64.cc
@@ -2146,6 +2146,20 @@
 #endif
 }
 
+void AsmIntrinsifier::Timeline_getNextTaskId(Assembler* assembler,
+                                             Label* normal_ir_body) {
+#if !defined(SUPPORT_TIMELINE)
+  __ LoadImmediate(R0, target::ToRawSmi(0));
+  __ ret();
+#else
+  __ ldr(R0, Address(THR, target::Thread::next_task_id_offset()));
+  __ add(R1, R0, Operand(1));
+  __ str(R1, Address(THR, target::Thread::next_task_id_offset()));
+  __ SmiTag(R0);  // Ignore loss of precision.
+  __ ret();
+#endif
+}
+
 #undef __
 
 }  // namespace compiler
diff --git a/runtime/vm/compiler/asm_intrinsifier_ia32.cc b/runtime/vm/compiler/asm_intrinsifier_ia32.cc
index 538ce05..bc39517 100644
--- a/runtime/vm/compiler/asm_intrinsifier_ia32.cc
+++ b/runtime/vm/compiler/asm_intrinsifier_ia32.cc
@@ -1937,6 +1937,24 @@
 #endif
 }
 
+void AsmIntrinsifier::Timeline_getNextTaskId(Assembler* assembler,
+                                             Label* normal_ir_body) {
+#if !defined(SUPPORT_TIMELINE)
+  __ LoadImmediate(EAX, target::ToRawSmi(0));
+  __ ret();
+#else
+  __ movl(EBX, Address(THR, target::Thread::next_task_id_offset()));
+  __ movl(ECX, Address(THR, target::Thread::next_task_id_offset() + 4));
+  __ movl(EAX, EBX);
+  __ SmiTag(EAX);  // Ignore loss of precision.
+  __ addl(EBX, Immediate(1));
+  __ adcl(ECX, Immediate(0));
+  __ movl(Address(THR, target::Thread::next_task_id_offset()), EBX);
+  __ movl(Address(THR, target::Thread::next_task_id_offset() + 4), ECX);
+  __ ret();
+#endif
+}
+
 #undef __
 
 }  // namespace compiler
diff --git a/runtime/vm/compiler/asm_intrinsifier_riscv.cc b/runtime/vm/compiler/asm_intrinsifier_riscv.cc
index a1b94de..e6bdde0 100644
--- a/runtime/vm/compiler/asm_intrinsifier_riscv.cc
+++ b/runtime/vm/compiler/asm_intrinsifier_riscv.cc
@@ -2160,6 +2160,30 @@
 #endif
 }
 
+void AsmIntrinsifier::Timeline_getNextTaskId(Assembler* assembler,
+                                             Label* normal_ir_body) {
+#if !defined(SUPPORT_TIMELINE)
+  __ LoadImmediate(A0, target::ToRawSmi(0));
+  __ ret();
+#elif XLEN == 64
+  __ ld(A0, Address(THR, target::Thread::next_task_id_offset()));
+  __ addi(A1, A0, 1);
+  __ sd(A1, Address(THR, target::Thread::next_task_id_offset()));
+  __ SmiTag(A0);  // Ignore loss of precision.
+  __ ret();
+#else
+  __ lw(T0, Address(THR, target::Thread::next_task_id_offset()));
+  __ lw(T1, Address(THR, target::Thread::next_task_id_offset() + 4));
+  __ SmiTag(A0, T0);  // Ignore loss of precision.
+  __ addi(T2, T0, 1);
+  __ sltu(T3, T2, T0);  // Carry.
+  __ add(T1, T1, T3);
+  __ sw(T2, Address(THR, target::Thread::next_task_id_offset()));
+  __ sw(T1, Address(THR, target::Thread::next_task_id_offset() + 4));
+  __ ret();
+#endif
+}
+
 #undef __
 
 }  // namespace compiler
diff --git a/runtime/vm/compiler/asm_intrinsifier_x64.cc b/runtime/vm/compiler/asm_intrinsifier_x64.cc
index 9ff337a..ad0d3a8 100644
--- a/runtime/vm/compiler/asm_intrinsifier_x64.cc
+++ b/runtime/vm/compiler/asm_intrinsifier_x64.cc
@@ -2034,6 +2034,21 @@
 #endif
 }
 
+void AsmIntrinsifier::Timeline_getNextTaskId(Assembler* assembler,
+                                             Label* normal_ir_body) {
+#if !defined(SUPPORT_TIMELINE)
+  __ xorq(RAX, RAX);  // Return Smi 0.
+  __ ret();
+#else
+  __ movq(RAX, Address(THR, target::Thread::next_task_id_offset()));
+  __ movq(RBX, RAX);
+  __ incq(RBX);
+  __ movq(Address(THR, target::Thread::next_task_id_offset()), RBX);
+  __ SmiTag(RAX);  // Ignore loss of precision.
+  __ ret();
+#endif
+}
+
 #undef __
 
 }  // namespace compiler
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index 010e653..36d758a 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -438,6 +438,7 @@
   V(::, _getDefaultTag, UserTag_defaultTag, 0x6c19c8a5)                        \
   V(::, _getCurrentTag, Profiler_getCurrentTag, 0x70ead08e)                    \
   V(::, _isDartStreamEnabled, Timeline_isDartStreamEnabled, 0xc97aafb3)        \
+  V(::, _getNextTaskId, Timeline_getNextTaskId, 0x5b2b0b0b)                    \
 
 #define INTERNAL_LIB_INTRINSIC_LIST(V)                                         \
   V(::, allocateOneByteString, AllocateOneByteString, 0x9e7745d5)              \
diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h
index fb828f0..ecbf16a 100644
--- a/runtime/vm/compiler/runtime_api.h
+++ b/runtime/vm/compiler/runtime_api.h
@@ -1250,6 +1250,7 @@
   THREAD_XMM_CONSTANT_LIST(DECLARE_CONSTANT_OFFSET_GETTER)
 #undef DECLARE_CONSTANT_OFFSET_GETTER
 
+  static word next_task_id_offset();
   static word random_offset();
 
   static word suspend_state_init_async_entry_point_offset();
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index fe183da..fea08a0 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -322,13 +322,13 @@
     Thread_call_to_runtime_entry_point_offset = 300;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 904;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 912;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 880;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 908;
+    Thread_service_extension_stream_offset = 916;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 252;
@@ -372,7 +372,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     872;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 912;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 920;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -486,10 +486,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 864;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 868;
-static constexpr dart::compiler::target::word Thread_random_offset = 888;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 888;
+static constexpr dart::compiler::target::word Thread_random_offset = 896;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 352;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 896;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 904;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -990,13 +991,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1792;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1800;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1760;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1800;
+    Thread_service_extension_stream_offset = 1808;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -1041,7 +1042,7 @@
     1744;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1808;
+    1816;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -1156,10 +1157,11 @@
     1728;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1736;
-static constexpr dart::compiler::target::word Thread_random_offset = 1768;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1768;
+static constexpr dart::compiler::target::word Thread_random_offset = 1776;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1776;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1784;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -1659,13 +1661,13 @@
     Thread_call_to_runtime_entry_point_offset = 300;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 872;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 880;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 848;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 876;
+    Thread_service_extension_stream_offset = 884;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 252;
@@ -1709,7 +1711,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     840;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 880;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 888;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -1823,10 +1825,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 832;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 836;
-static constexpr dart::compiler::target::word Thread_random_offset = 856;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 856;
+static constexpr dart::compiler::target::word Thread_random_offset = 864;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 352;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 864;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 872;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -2324,13 +2327,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1856;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1864;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1824;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1864;
+    Thread_service_extension_stream_offset = 1872;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -2375,7 +2378,7 @@
     1808;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1872;
+    1880;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -2490,10 +2493,11 @@
     1792;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1800;
-static constexpr dart::compiler::target::word Thread_random_offset = 1832;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1832;
+static constexpr dart::compiler::target::word Thread_random_offset = 1840;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1840;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1848;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -2996,13 +3000,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1792;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1800;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1760;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1800;
+    Thread_service_extension_stream_offset = 1808;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -3047,7 +3051,7 @@
     1744;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1808;
+    1816;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -3162,10 +3166,11 @@
     1728;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1736;
-static constexpr dart::compiler::target::word Thread_random_offset = 1768;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1768;
+static constexpr dart::compiler::target::word Thread_random_offset = 1776;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1776;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1784;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -3667,13 +3672,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1856;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1864;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1824;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1864;
+    Thread_service_extension_stream_offset = 1872;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -3718,7 +3723,7 @@
     1808;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1872;
+    1880;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -3833,10 +3838,11 @@
     1792;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1800;
-static constexpr dart::compiler::target::word Thread_random_offset = 1832;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1832;
+static constexpr dart::compiler::target::word Thread_random_offset = 1840;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1840;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1848;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -4337,13 +4343,13 @@
     Thread_call_to_runtime_entry_point_offset = 300;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 944;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 952;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 920;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 948;
+    Thread_service_extension_stream_offset = 956;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 252;
@@ -4387,7 +4393,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     912;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 952;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 960;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -4501,10 +4507,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 904;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 908;
-static constexpr dart::compiler::target::word Thread_random_offset = 928;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 928;
+static constexpr dart::compiler::target::word Thread_random_offset = 936;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 352;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 936;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 944;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -5007,13 +5014,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1848;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1856;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1816;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1856;
+    Thread_service_extension_stream_offset = 1864;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -5058,7 +5065,7 @@
     1800;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1864;
+    1872;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -5173,10 +5180,11 @@
     1784;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1792;
-static constexpr dart::compiler::target::word Thread_random_offset = 1824;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1824;
+static constexpr dart::compiler::target::word Thread_random_offset = 1832;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1832;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1840;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -5671,13 +5679,13 @@
     Thread_call_to_runtime_entry_point_offset = 300;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 904;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 912;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 880;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 908;
+    Thread_service_extension_stream_offset = 916;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 252;
@@ -5721,7 +5729,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     872;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 912;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 920;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -5835,10 +5843,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 864;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 868;
-static constexpr dart::compiler::target::word Thread_random_offset = 888;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 888;
+static constexpr dart::compiler::target::word Thread_random_offset = 896;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 352;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 896;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 904;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -6331,13 +6340,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1792;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1800;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1760;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1800;
+    Thread_service_extension_stream_offset = 1808;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -6382,7 +6391,7 @@
     1744;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1808;
+    1816;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -6497,10 +6506,11 @@
     1728;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1736;
-static constexpr dart::compiler::target::word Thread_random_offset = 1768;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1768;
+static constexpr dart::compiler::target::word Thread_random_offset = 1776;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1776;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1784;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -6992,13 +7002,13 @@
     Thread_call_to_runtime_entry_point_offset = 300;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 872;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 880;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 848;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 876;
+    Thread_service_extension_stream_offset = 884;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 252;
@@ -7042,7 +7052,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     840;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 880;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 888;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -7156,10 +7166,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 832;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 836;
-static constexpr dart::compiler::target::word Thread_random_offset = 856;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 856;
+static constexpr dart::compiler::target::word Thread_random_offset = 864;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 352;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 864;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 872;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -7649,13 +7660,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1856;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1864;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1824;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1864;
+    Thread_service_extension_stream_offset = 1872;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -7700,7 +7711,7 @@
     1808;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1872;
+    1880;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -7815,10 +7826,11 @@
     1792;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1800;
-static constexpr dart::compiler::target::word Thread_random_offset = 1832;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1832;
+static constexpr dart::compiler::target::word Thread_random_offset = 1840;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1840;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1848;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -8313,13 +8325,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1792;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1800;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1760;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1800;
+    Thread_service_extension_stream_offset = 1808;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -8364,7 +8376,7 @@
     1744;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1808;
+    1816;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -8479,10 +8491,11 @@
     1728;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1736;
-static constexpr dart::compiler::target::word Thread_random_offset = 1768;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1768;
+static constexpr dart::compiler::target::word Thread_random_offset = 1776;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1776;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1784;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -8976,13 +8989,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1856;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1864;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1824;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1864;
+    Thread_service_extension_stream_offset = 1872;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -9027,7 +9040,7 @@
     1808;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1872;
+    1880;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -9142,10 +9155,11 @@
     1792;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1800;
-static constexpr dart::compiler::target::word Thread_random_offset = 1832;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1832;
+static constexpr dart::compiler::target::word Thread_random_offset = 1840;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1840;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1848;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -9638,13 +9652,13 @@
     Thread_call_to_runtime_entry_point_offset = 300;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 944;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 952;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 920;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 948;
+    Thread_service_extension_stream_offset = 956;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 252;
@@ -9688,7 +9702,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     912;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 952;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 960;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -9802,10 +9816,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 904;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 908;
-static constexpr dart::compiler::target::word Thread_random_offset = 928;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 928;
+static constexpr dart::compiler::target::word Thread_random_offset = 936;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 352;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 936;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 944;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -10300,13 +10315,13 @@
     Thread_call_to_runtime_entry_point_offset = 576;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1848;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1856;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1816;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1856;
+    Thread_service_extension_stream_offset = 1864;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 480;
@@ -10351,7 +10366,7 @@
     1800;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1864;
+    1872;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -10466,10 +10481,11 @@
     1784;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1792;
-static constexpr dart::compiler::target::word Thread_random_offset = 1824;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1824;
+static constexpr dart::compiler::target::word Thread_random_offset = 1832;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 680;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1832;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1840;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -11002,13 +11018,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 140;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    904;
+    912;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 880;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 908;
+    AOT_Thread_service_extension_stream_offset = 916;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -11054,7 +11070,7 @@
     AOT_Thread_exit_through_ffi_offset = 872;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 40;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    912;
+    920;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 64;
 static constexpr dart::compiler::target::word
@@ -11174,11 +11190,13 @@
     864;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 868;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 888;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    888;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 896;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 352;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    896;
+    904;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -11741,13 +11759,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1760;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1800;
+    AOT_Thread_service_extension_stream_offset = 1808;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -11793,7 +11811,7 @@
     AOT_Thread_exit_through_ffi_offset = 1744;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1808;
+    1816;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -11914,11 +11932,13 @@
     1728;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1736;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1768;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1768;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1776;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1776;
+    1784;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -12486,13 +12506,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1824;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1864;
+    AOT_Thread_service_extension_stream_offset = 1872;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -12538,7 +12558,7 @@
     AOT_Thread_exit_through_ffi_offset = 1808;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1872;
+    1880;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -12659,11 +12679,13 @@
     1792;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1800;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1832;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1832;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1840;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1840;
+    1848;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -13228,13 +13250,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1760;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1800;
+    AOT_Thread_service_extension_stream_offset = 1808;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -13280,7 +13302,7 @@
     AOT_Thread_exit_through_ffi_offset = 1744;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1808;
+    1816;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -13401,11 +13423,13 @@
     1728;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1736;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1768;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1768;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1776;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1776;
+    1784;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -13969,13 +13993,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1824;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1864;
+    AOT_Thread_service_extension_stream_offset = 1872;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -14021,7 +14045,7 @@
     AOT_Thread_exit_through_ffi_offset = 1808;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1872;
+    1880;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -14142,11 +14166,13 @@
     1792;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1800;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1832;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1832;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1840;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1840;
+    1848;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -14711,13 +14737,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 140;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    944;
+    952;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 920;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 948;
+    AOT_Thread_service_extension_stream_offset = 956;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -14763,7 +14789,7 @@
     AOT_Thread_exit_through_ffi_offset = 912;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 40;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    952;
+    960;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 64;
 static constexpr dart::compiler::target::word
@@ -14883,11 +14909,13 @@
     904;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 908;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 928;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    928;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 936;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 352;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    936;
+    944;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -15452,13 +15480,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1848;
+    1856;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1816;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1856;
+    AOT_Thread_service_extension_stream_offset = 1864;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -15504,7 +15532,7 @@
     AOT_Thread_exit_through_ffi_offset = 1800;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1864;
+    1872;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -15625,11 +15653,13 @@
     1784;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1792;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1824;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1824;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1832;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1832;
+    1840;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -16187,13 +16217,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 140;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    904;
+    912;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 880;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 908;
+    AOT_Thread_service_extension_stream_offset = 916;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -16239,7 +16269,7 @@
     AOT_Thread_exit_through_ffi_offset = 872;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 40;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    912;
+    920;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 64;
 static constexpr dart::compiler::target::word
@@ -16359,11 +16389,13 @@
     864;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 868;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 888;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    888;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 896;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 352;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    896;
+    904;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -16917,13 +16949,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1760;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1800;
+    AOT_Thread_service_extension_stream_offset = 1808;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -16969,7 +17001,7 @@
     AOT_Thread_exit_through_ffi_offset = 1744;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1808;
+    1816;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -17090,11 +17122,13 @@
     1728;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1736;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1768;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1768;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1776;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1776;
+    1784;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -17653,13 +17687,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1824;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1864;
+    AOT_Thread_service_extension_stream_offset = 1872;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -17705,7 +17739,7 @@
     AOT_Thread_exit_through_ffi_offset = 1808;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1872;
+    1880;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -17826,11 +17860,13 @@
     1792;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1800;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1832;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1832;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1840;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1840;
+    1848;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -18386,13 +18422,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1760;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1800;
+    AOT_Thread_service_extension_stream_offset = 1808;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -18438,7 +18474,7 @@
     AOT_Thread_exit_through_ffi_offset = 1744;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1808;
+    1816;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -18559,11 +18595,13 @@
     1728;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1736;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1768;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1768;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1776;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1776;
+    1784;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -19118,13 +19156,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1824;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1864;
+    AOT_Thread_service_extension_stream_offset = 1872;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -19170,7 +19208,7 @@
     AOT_Thread_exit_through_ffi_offset = 1808;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1872;
+    1880;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -19291,11 +19329,13 @@
     1792;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1800;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1832;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1832;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1840;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1840;
+    1848;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -19851,13 +19891,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 140;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    944;
+    952;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 920;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 948;
+    AOT_Thread_service_extension_stream_offset = 956;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     340;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -19903,7 +19943,7 @@
     AOT_Thread_exit_through_ffi_offset = 912;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 40;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    952;
+    960;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 64;
 static constexpr dart::compiler::target::word
@@ -20023,11 +20063,13 @@
     904;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 908;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 928;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    928;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 936;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 352;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    936;
+    944;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -20583,13 +20625,13 @@
 static constexpr dart::compiler::target::word
     AOT_Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
-    1848;
+    1856;
 static constexpr dart::compiler::target::word
     AOT_Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     AOT_Thread_double_truncate_round_supported_offset = 1816;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1856;
+    AOT_Thread_service_extension_stream_offset = 1864;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     656;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -20635,7 +20677,7 @@
     AOT_Thread_exit_through_ffi_offset = 1800;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1864;
+    1872;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -20756,11 +20798,13 @@
     1784;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1792;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1824;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1824;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1832;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 680;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1832;
+    1840;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h
index 4b3ba6c..7450b1f 100644
--- a/runtime/vm/compiler/runtime_offsets_list.h
+++ b/runtime/vm/compiler/runtime_offsets_list.h
@@ -321,6 +321,7 @@
   FIELD(Thread, heap_base_offset)                                              \
   FIELD(Thread, callback_code_offset)                                          \
   FIELD(Thread, callback_stack_return_offset)                                  \
+  FIELD(Thread, next_task_id_offset)                                           \
   FIELD(Thread, random_offset)                                                 \
   FIELD(Thread, jump_to_frame_entry_point_offset)                              \
   FIELD(Thread, tsan_utils_offset)                                             \
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 9d66e4d..a12f853 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -307,6 +307,7 @@
 #endif
 
   OSThread::Init();
+  Random::Init();
   Zone::Init();
 #if defined(SUPPORT_TIMELINE)
   Timeline::Init();
@@ -779,6 +780,7 @@
   Timeline::Cleanup();
 #endif
   Zone::Cleanup();
+  Random::Cleanup();
   // Delete the current thread's TLS and set it's TLS to null.
   // If it is the last thread then the destructor would call
   // OSThread::Cleanup.
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index adac74b..1522efb 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -6359,10 +6359,10 @@
   if (event != NULL) {
     switch (type) {
       case Dart_Timeline_Event_Begin:
-        event->Begin(label, timestamp0);
+        event->Begin(label, timestamp0, timestamp1_or_async_id);
         break;
       case Dart_Timeline_Event_End:
-        event->End(label, timestamp0);
+        event->End(label, timestamp0, timestamp1_or_async_id);
         break;
       case Dart_Timeline_Event_Instant:
         event->Instant(label, timestamp0);
diff --git a/runtime/vm/random.cc b/runtime/vm/random.cc
index 2cc2335..e14ab64 100644
--- a/runtime/vm/random.cc
+++ b/runtime/vm/random.cc
@@ -75,4 +75,26 @@
   return static_cast<uint32_t>(NextState() & MASK_32);
 }
 
+static Random* global_random = nullptr;
+static Mutex* global_random_mutex = nullptr;
+
+void Random::Init() {
+  ASSERT(global_random_mutex == nullptr);
+  global_random_mutex = new Mutex(NOT_IN_PRODUCT("global_random_mutex"));
+  ASSERT(global_random == nullptr);
+  global_random = new Random();
+}
+
+void Random::Cleanup() {
+  delete global_random_mutex;
+  global_random_mutex = nullptr;
+  delete global_random;
+  global_random = nullptr;
+}
+
+uint64_t Random::GlobalNextUInt64() {
+  MutexLocker locker(global_random_mutex);
+  return global_random->NextUInt64();
+}
+
 }  // namespace dart
diff --git a/runtime/vm/random.h b/runtime/vm/random.h
index 4af724b..077089b 100644
--- a/runtime/vm/random.h
+++ b/runtime/vm/random.h
@@ -28,6 +28,10 @@
            static_cast<uint64_t>(NextUInt32());
   }
 
+  static uint64_t GlobalNextUInt64();
+  static void Init();
+  static void Cleanup();
+
  private:
   uint64_t NextState();
   void Initialize(uint64_t seed);
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index 9689781..1bc5236 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -143,6 +143,12 @@
   if (!is_vm_isolate) {
     InitVMConstants();
   }
+
+#if defined(DART_HOST_OS_FUCHSIA)
+  next_task_id_ = trace_generate_nonce();
+#else
+  next_task_id_ = Random::GlobalNextUInt64();
+#endif
 }
 
 static const double double_nan_constant = NAN;
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index 5f9660d..ecfeec7 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -1096,6 +1096,10 @@
 
   void InitVMConstants();
 
+  int64_t GetNextTaskId() { return next_task_id_++; }
+  static intptr_t next_task_id_offset() {
+    return OFFSET_OF(Thread, next_task_id_);
+  }
   Random* random() { return &thread_random_; }
   static intptr_t random_offset() { return OFFSET_OF(Thread, thread_random_); }
 
@@ -1209,6 +1213,7 @@
   uword exit_through_ffi_ = 0;
   ApiLocalScope* api_top_scope_;
   uint8_t double_truncate_round_supported_;
+  ALIGN8 int64_t next_task_id_;
   ALIGN8 Random thread_random_;
 
   TsanUtils* tsan_utils_ = nullptr;
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc
index 086b86b..90b0a23 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -498,19 +498,25 @@
 }
 
 void TimelineEvent::Begin(const char* label,
+                          int64_t id,
                           int64_t micros,
                           int64_t thread_micros) {
   Init(kBegin, label);
   set_timestamp0(micros);
   set_thread_timestamp0(thread_micros);
+  // Overload timestamp1_ with the async_id.
+  set_timestamp1(id);
 }
 
 void TimelineEvent::End(const char* label,
+                        int64_t id,
                         int64_t micros,
                         int64_t thread_micros) {
   Init(kEnd, label);
   set_timestamp0(micros);
   set_thread_timestamp0(thread_micros);
+  // Overload timestamp1_ with the async_id.
+  set_timestamp1(id);
 }
 
 void TimelineEvent::Counter(const char* label, int64_t micros) {
@@ -655,31 +661,31 @@
     } break;
     case kAsyncBegin: {
       writer->PrintProperty("ph", "b");
-      writer->PrintfProperty("id", "%" Px64 "", AsyncId());
+      writer->PrintfProperty("id", "%" Px64 "", Id());
     } break;
     case kAsyncInstant: {
       writer->PrintProperty("ph", "n");
-      writer->PrintfProperty("id", "%" Px64 "", AsyncId());
+      writer->PrintfProperty("id", "%" Px64 "", Id());
     } break;
     case kAsyncEnd: {
       writer->PrintProperty("ph", "e");
-      writer->PrintfProperty("id", "%" Px64 "", AsyncId());
+      writer->PrintfProperty("id", "%" Px64 "", Id());
     } break;
     case kCounter: {
       writer->PrintProperty("ph", "C");
     } break;
     case kFlowBegin: {
       writer->PrintProperty("ph", "s");
-      writer->PrintfProperty("id", "%" Px64 "", AsyncId());
+      writer->PrintfProperty("id", "%" Px64 "", Id());
     } break;
     case kFlowStep: {
       writer->PrintProperty("ph", "t");
-      writer->PrintfProperty("id", "%" Px64 "", AsyncId());
+      writer->PrintfProperty("id", "%" Px64 "", Id());
     } break;
     case kFlowEnd: {
       writer->PrintProperty("ph", "f");
       writer->PrintProperty("bp", "e");
-      writer->PrintfProperty("id", "%" Px64 "", AsyncId());
+      writer->PrintfProperty("id", "%" Px64 "", Id());
     } break;
     case kMetadata: {
       writer->PrintProperty("ph", "M");
@@ -728,14 +734,6 @@
   writer->CloseObject();
 }
 
-int64_t TimelineEvent::TimeOrigin() const {
-  return timestamp0_;
-}
-
-int64_t TimelineEvent::AsyncId() const {
-  return timestamp1_;
-}
-
 int64_t TimelineEvent::LowTime() const {
   return timestamp0_;
 }
@@ -841,6 +839,13 @@
     return;
   }
   enabled_ = true;
+  Thread* thread = static_cast<Thread*>(this->thread());
+  if (thread != NULL) {
+    id_ = thread->GetNextTaskId();
+  } else {
+    static RelaxedAtomic<int64_t> next_bootstrap_task_id = {0};
+    id_ = next_bootstrap_task_id.fetch_add(1);
+  }
 }
 
 void TimelineEventScope::SetNumArguments(intptr_t length) {
@@ -919,7 +924,7 @@
   }
   ASSERT(event != NULL);
   // Emit a begin event.
-  event->Begin(label());
+  event->Begin(label(), id());
   event->Complete();
 }
 
@@ -935,7 +940,7 @@
   }
   ASSERT(event != NULL);
   // Emit an end event.
-  event->End(label());
+  event->End(label(), id());
   StealArguments(event);
   event->Complete();
 }
@@ -958,7 +963,7 @@
       isolate_id_(isolate_id) {}
 
 TimelineEventRecorder::TimelineEventRecorder()
-    : async_id_(0), time_low_micros_(0), time_high_micros_(0) {}
+    : time_low_micros_(0), time_high_micros_(0) {}
 
 #ifndef PRODUCT
 void TimelineEventRecorder::PrintJSONMeta(JSONArray* events) const {
@@ -1120,16 +1125,6 @@
 }
 #endif
 
-int64_t TimelineEventRecorder::GetNextAsyncId() {
-  // TODO(johnmccutchan): Gracefully handle wrap around.
-#if defined(DART_HOST_OS_FUCHSIA)
-  return trace_generate_nonce();
-#else
-  uint32_t next = static_cast<uint32_t>(async_id_.fetch_add(1u));
-  return static_cast<int64_t>(next);
-#endif
-}
-
 void TimelineEventRecorder::FinishBlock(TimelineEventBlock* block) {
   if (block == NULL) {
     return;
@@ -1706,10 +1701,10 @@
       event->AsyncEnd(name, id, start);
       break;
     case 'B':
-      event->Begin(name, start, start_cpu);
+      event->Begin(name, id, start, start_cpu);
       break;
     case 'E':
-      event->End(name, start, start_cpu);
+      event->End(name, id, start, start_cpu);
       break;
     default:
       UNREACHABLE();
diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h
index 759e09f..7b89e4b 100644
--- a/runtime/vm/timeline.h
+++ b/runtime/vm/timeline.h
@@ -334,10 +334,12 @@
 
   void Begin(
       const char* label,
+      int64_t id,
       int64_t micros = OS::GetCurrentMonotonicMicrosForTimeline(),
       int64_t thread_micros = OS::GetCurrentThreadCPUMicrosForTimeline());
 
   void End(const char* label,
+           int64_t id,
            int64_t micros = OS::GetCurrentMonotonicMicrosForTimeline(),
            int64_t thread_micros = OS::GetCurrentThreadCPUMicrosForTimeline());
 
@@ -390,8 +392,11 @@
   int64_t ThreadCPUTimeDuration() const;
   int64_t ThreadCPUTimeOrigin() const;
 
-  int64_t TimeOrigin() const;
-  int64_t AsyncId() const;
+  int64_t TimeOrigin() const { return timestamp0_; }
+  int64_t Id() const {
+    ASSERT(event_type() != kDuration);
+    return timestamp1_;
+  }
   int64_t TimeDuration() const;
   int64_t TimeEnd() const {
     ASSERT(IsFinishedDuration());
@@ -598,6 +603,8 @@
 
   const char* label() const { return label_; }
 
+  int64_t id() const { return id_; }
+
   TimelineEventArgument* arguments() const { return arguments_.buffer(); }
 
   intptr_t arguments_length() const { return arguments_.length(); }
@@ -613,6 +620,7 @@
 
   TimelineStream* stream_;
   const char* label_;
+  int64_t id_;
   TimelineEventArguments arguments_;
   bool enabled_;
 
@@ -783,7 +791,6 @@
   virtual void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter) = 0;
 #endif
   virtual const char* name() const = 0;
-  int64_t GetNextAsyncId();
 
   void FinishBlock(TimelineEventBlock* block);
 
@@ -814,7 +821,6 @@
   int64_t TimeExtentMicros() const;
 
   Mutex lock_;
-  RelaxedAtomic<uintptr_t> async_id_;
   int64_t time_low_micros_;
   int64_t time_high_micros_;
 
diff --git a/runtime/vm/timeline_android.cc b/runtime/vm/timeline_android.cc
index f91ee42..37844f7 100644
--- a/runtime/vm/timeline_android.cc
+++ b/runtime/vm/timeline_android.cc
@@ -79,12 +79,12 @@
     }
     case TimelineEvent::kAsyncBegin: {
       length = Utils::SNPrint(buffer, buffer_size, "S|%" Pd64 "|%s|%" Pd64 "",
-                              pid, event->label(), event->AsyncId());
+                              pid, event->label(), event->Id());
       break;
     }
     case TimelineEvent::kAsyncEnd: {
       length = Utils::SNPrint(buffer, buffer_size, "F|%" Pd64 "|%s|%" Pd64 "",
-                              pid, event->label(), event->AsyncId());
+                              pid, event->label(), event->Id());
       break;
     }
     default:
diff --git a/runtime/vm/timeline_fuchsia.cc b/runtime/vm/timeline_fuchsia.cc
index 38bca29..6dd671a 100644
--- a/runtime/vm/timeline_fuchsia.cc
+++ b/runtime/vm/timeline_fuchsia.cc
@@ -78,19 +78,19 @@
           args, num_args);
       break;
     case TimelineEvent::kAsyncBegin:
-      trace_context_write_async_begin_event_record(
-          context, start_time, &thread, &category, &name, event->AsyncId(),
-          args, num_args);
+      trace_context_write_async_begin_event_record(context, start_time, &thread,
+                                                   &category, &name,
+                                                   event->Id(), args, num_args);
       break;
     case TimelineEvent::kAsyncEnd:
-      trace_context_write_async_end_event_record(
-          context, end_time, &thread, &category, &name, event->AsyncId(), args,
-          num_args);
+      trace_context_write_async_end_event_record(context, end_time, &thread,
+                                                 &category, &name, event->Id(),
+                                                 args, num_args);
       break;
     case TimelineEvent::kAsyncInstant:
       trace_context_write_async_instant_event_record(
-          context, start_time, &thread, &category, &name, event->AsyncId(),
-          args, num_args);
+          context, start_time, &thread, &category, &name, event->Id(), args,
+          num_args);
       break;
     case TimelineEvent::kDuration:
       trace_context_write_duration_event_record(context, start_time, end_time,
@@ -98,19 +98,19 @@
                                                 num_args);
       break;
     case TimelineEvent::kFlowBegin:
-      trace_context_write_flow_begin_event_record(
-          context, start_time, &thread, &category, &name, event->AsyncId(),
-          args, num_args);
+      trace_context_write_flow_begin_event_record(context, start_time, &thread,
+                                                  &category, &name, event->Id(),
+                                                  args, num_args);
       break;
     case TimelineEvent::kFlowStep:
-      trace_context_write_flow_step_event_record(
-          context, start_time, &thread, &category, &name, event->AsyncId(),
-          args, num_args);
+      trace_context_write_flow_step_event_record(context, start_time, &thread,
+                                                 &category, &name, event->Id(),
+                                                 args, num_args);
       break;
     case TimelineEvent::kFlowEnd:
-      trace_context_write_flow_end_event_record(
-          context, start_time, &thread, &category, &name, event->AsyncId(),
-          args, num_args);
+      trace_context_write_flow_end_event_record(context, start_time, &thread,
+                                                &category, &name, event->Id(),
+                                                args, num_args);
       break;
     default:
       // TODO(zra): Figure out what to do with kCounter and kMetadata.
diff --git a/runtime/vm/timeline_linux.cc b/runtime/vm/timeline_linux.cc
index a85f9e5..407a790 100644
--- a/runtime/vm/timeline_linux.cc
+++ b/runtime/vm/timeline_linux.cc
@@ -79,12 +79,12 @@
     }
     case TimelineEvent::kAsyncBegin: {
       length = Utils::SNPrint(buffer, buffer_size, "S|%" Pd64 "|%s|%" Pd64 "",
-                              pid, event->label(), event->AsyncId());
+                              pid, event->label(), event->Id());
       break;
     }
     case TimelineEvent::kAsyncEnd: {
       length = Utils::SNPrint(buffer, buffer_size, "F|%" Pd64 "|%s|%" Pd64 "",
-                              pid, event->label(), event->AsyncId());
+                              pid, event->label(), event->Id());
       break;
     }
     default:
diff --git a/runtime/vm/timeline_macos.cc b/runtime/vm/timeline_macos.cc
index cbb2efa..d187617 100644
--- a/runtime/vm/timeline_macos.cc
+++ b/runtime/vm/timeline_macos.cc
@@ -40,28 +40,18 @@
                                        buffer, sizeof(buffer));
       break;
     }
-    case TimelineEvent::kBegin: {
-      _os_signpost_emit_with_name_impl(
-          &__dso_handle, log, OS_SIGNPOST_INTERVAL_BEGIN,
-          OS_SIGNPOST_ID_EXCLUSIVE, label, "", buffer, sizeof(buffer));
-      break;
-    }
-    case TimelineEvent::kEnd: {
-      _os_signpost_emit_with_name_impl(
-          &__dso_handle, log, OS_SIGNPOST_INTERVAL_END,
-          OS_SIGNPOST_ID_EXCLUSIVE, label, "", buffer, sizeof(buffer));
-      break;
-    }
+    case TimelineEvent::kBegin:
     case TimelineEvent::kAsyncBegin: {
-      _os_signpost_emit_with_name_impl(
-          &__dso_handle, log, OS_SIGNPOST_INTERVAL_BEGIN, event->AsyncId(),
-          label, "", buffer, sizeof(buffer));
+      _os_signpost_emit_with_name_impl(&__dso_handle, log,
+                                       OS_SIGNPOST_INTERVAL_BEGIN, event->Id(),
+                                       label, "", buffer, sizeof(buffer));
       break;
     }
+    case TimelineEvent::kEnd:
     case TimelineEvent::kAsyncEnd: {
-      _os_signpost_emit_with_name_impl(
-          &__dso_handle, log, OS_SIGNPOST_INTERVAL_END, event->AsyncId(), label,
-          "", buffer, sizeof(buffer));
+      _os_signpost_emit_with_name_impl(&__dso_handle, log,
+                                       OS_SIGNPOST_INTERVAL_END, event->Id(),
+                                       label, "", buffer, sizeof(buffer));
       break;
     }
     case TimelineEvent::kCounter: {
@@ -69,8 +59,8 @@
       Utils::SNPrint(reinterpret_cast<char*>(buffer), sizeof(buffer), fmt,
                      event->arguments()[0].value);
       _os_signpost_emit_with_name_impl(&__dso_handle, log, OS_SIGNPOST_EVENT,
-                                       event->AsyncId(), label, fmt, buffer,
-                                       sizeof(buffer));
+                                       OS_SIGNPOST_ID_EXCLUSIVE, label, fmt,
+                                       buffer, sizeof(buffer));
       break;
     }
     default:
diff --git a/runtime/vm/timeline_test.cc b/runtime/vm/timeline_test.cc
index 97699cd..3c5ec04 100644
--- a/runtime/vm/timeline_test.cc
+++ b/runtime/vm/timeline_test.cc
@@ -318,8 +318,8 @@
 
   event = stream.StartEvent();
   EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kAsyncBegin));
-  int64_t async_id = override.recorder()->GetNextAsyncId();
-  EXPECT(async_id >= 0);
+  int64_t async_id = thread->GetNextTaskId();
+  EXPECT(async_id != 0);
   event->AsyncBegin("asyncBeginCabbage", async_id);
   EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kAsyncBegin));
   event->Complete();
diff --git a/sdk/lib/_internal/js_dev_runtime/patch/developer_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/developer_patch.dart
index c451d7f..1a7ec1c 100644
--- a/sdk/lib/_internal/js_dev_runtime/patch/developer_patch.dart
+++ b/sdk/lib/_internal/js_dev_runtime/patch/developer_patch.dart
@@ -157,7 +157,7 @@
 }
 
 @patch
-int _getNextAsyncId() {
+int _getNextTaskId() {
   return 0;
 }
 
diff --git a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
index 54f7ca1..5b32bea 100644
--- a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
@@ -80,7 +80,7 @@
 }
 
 @patch
-int _getNextAsyncId() {
+int _getNextTaskId() {
   return 0;
 }
 
diff --git a/sdk/lib/_internal/vm/lib/timeline.dart b/sdk/lib/_internal/vm/lib/timeline.dart
index e3e172c..d65d975 100644
--- a/sdk/lib/_internal/vm/lib/timeline.dart
+++ b/sdk/lib/_internal/vm/lib/timeline.dart
@@ -13,8 +13,8 @@
 external int _getTraceClock();
 
 @patch
-@pragma("vm:external-name", "Timeline_getNextAsyncId")
-external int _getNextAsyncId();
+@pragma("vm:external-name", "Timeline_getNextTaskId")
+external int _getNextTaskId();
 
 @patch
 @pragma("vm:external-name", "Timeline_reportTaskEvent")
diff --git a/sdk/lib/_internal/wasm/lib/developer.dart b/sdk/lib/_internal/wasm/lib/developer.dart
index 32d3050..32eb53d 100644
--- a/sdk/lib/_internal/wasm/lib/developer.dart
+++ b/sdk/lib/_internal/wasm/lib/developer.dart
@@ -49,7 +49,7 @@
 int _traceClock = 0;
 
 @patch
-int _getNextAsyncId() => 0;
+int _getNextTaskId() => 0;
 
 @patch
 void _reportTaskEvent(int taskId, String phase, String category, String name,
diff --git a/sdk/lib/developer/timeline.dart b/sdk/lib/developer/timeline.dart
index a9990a3..fc4abd4 100644
--- a/sdk/lib/developer/timeline.dart
+++ b/sdk/lib/developer/timeline.dart
@@ -60,7 +60,7 @@
   /// If [id] is not provided, an id that conflicts with no other Dart-generated
   /// flow id's will be generated.
   static Flow begin({int? id}) {
-    return new Flow._(_begin, id ?? _getNextAsyncId());
+    return new Flow._(_begin, id ?? _getNextTaskId());
   }
 
   /// A "step" Flow event.
@@ -112,7 +112,8 @@
       _stack.add(null);
       return;
     }
-    var block = new _SyncBlock._(name, arguments: arguments, flow: flow);
+    var block = new _SyncBlock._(name, _getNextTaskId(),
+        arguments: arguments, flow: flow);
     _stack.add(block);
     block._startSync();
   }
@@ -190,7 +191,7 @@
   TimelineTask({TimelineTask? parent, String? filterKey})
       : _parent = parent,
         _filterKey = filterKey,
-        _taskId = _getNextAsyncId() {}
+        _taskId = _getNextTaskId() {}
 
   /// Create a task with an explicit [taskId]. This is useful if you are
   /// passing a task from one isolate to another.
@@ -335,6 +336,9 @@
   /// The name of this block.
   final String name;
 
+  /// Signpost needs help matching begin and end events.
+  final int taskId;
+
   /// An (optional) set of arguments which will be serialized to JSON and
   /// associated with this block.
   final Map? arguments;
@@ -344,18 +348,18 @@
 
   late final String _jsonArguments = _argumentsAsJson(arguments);
 
-  _SyncBlock._(this.name, {this.arguments, this.flow});
+  _SyncBlock._(this.name, this.taskId, {this.arguments, this.flow});
 
   /// Start this block of time.
   void _startSync() {
-    _reportTaskEvent(0, 'B', category, name, _jsonArguments);
+    _reportTaskEvent(taskId, 'B', category, name, _jsonArguments);
   }
 
   /// Finish this block of time. At this point, this block can no longer be
   /// used.
   void finish() {
     // Report event to runtime.
-    _reportTaskEvent(0, 'E', category, name, _jsonArguments);
+    _reportTaskEvent(taskId, 'E', category, name, _jsonArguments);
     final Flow? tempFlow = flow;
     if (tempFlow != null) {
       _reportFlowEvent(category, "${tempFlow.id}", tempFlow._type, tempFlow.id,
@@ -376,8 +380,9 @@
 @pragma("vm:recognized", "asm-intrinsic")
 external bool _isDartStreamEnabled();
 
-/// Returns the next async task id.
-external int _getNextAsyncId();
+/// Returns the next task id.
+@pragma("vm:recognized", "asm-intrinsic")
+external int _getNextTaskId();
 
 /// Returns the current value from the trace clock.
 external int _getTraceClock();
diff --git a/tools/VERSION b/tools/VERSION
index 1a17e19..ef321a3 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 18
 PATCH 0
-PRERELEASE 241
+PRERELEASE 242
 PRERELEASE_PATCH 0
\ No newline at end of file