Version 2.18.0-285.0.dev

Merge commit '386ad2ff469ef0554fe85acceae200e1794b9a6c' into 'dev'
diff --git a/pkg/compiler/lib/src/js_backend/annotations.dart b/pkg/compiler/lib/src/js_backend/annotations.dart
index 677a87e..1879291 100644
--- a/pkg/compiler/lib/src/js_backend/annotations.dart
+++ b/pkg/compiler/lib/src/js_backend/annotations.dart
@@ -317,14 +317,6 @@
   /// annotation.
   bool hasNoSideEffects(MemberEntity member);
 
-  /// Calls [f] for all functions with a `@pragma('dart2js:noThrows')`
-  /// annotation.
-  void forEachNoThrows(void f(FunctionEntity function));
-
-  /// Calls [f] for all functions with a `@pragma('dart2js:noSideEffects')`
-  /// annotation.
-  void forEachNoSideEffects(void f(FunctionEntity function));
-
   /// What the compiler should do with parameter type assertions in [member].
   ///
   /// If [member] is `null`, the default policy is returned.
@@ -443,26 +435,6 @@
       _hasPragma(member, PragmaAnnotation.noSideEffects);
 
   @override
-  void forEachNoThrows(void f(FunctionEntity function)) {
-    pragmaAnnotations
-        .forEach((MemberEntity member, EnumSet<PragmaAnnotation> set) {
-      if (set.contains(PragmaAnnotation.noThrows)) {
-        f(member as FunctionEntity);
-      }
-    });
-  }
-
-  @override
-  void forEachNoSideEffects(void f(FunctionEntity function)) {
-    pragmaAnnotations
-        .forEach((MemberEntity member, EnumSet<PragmaAnnotation> set) {
-      if (set.contains(PragmaAnnotation.noSideEffects)) {
-        f(member as FunctionEntity);
-      }
-    });
-  }
-
-  @override
   CheckPolicy getParameterCheckPolicy(MemberEntity? member) {
     if (member != null) {
       EnumSet<PragmaAnnotation>? annotations = pragmaAnnotations[member];
diff --git a/pkg/compiler/lib/src/js_backend/inferred_data.dart b/pkg/compiler/lib/src/js_backend/inferred_data.dart
index 93ee68b..74c8bc0 100644
--- a/pkg/compiler/lib/src/js_backend/inferred_data.dart
+++ b/pkg/compiler/lib/src/js_backend/inferred_data.dart
@@ -49,9 +49,6 @@
 }
 
 abstract class InferredDataBuilder {
-  /// Registers the executing of [element] as without side effects.
-  void registerSideEffectsFree(FunctionEntity element);
-
   /// Returns the [SideEffectBuilder] associated with [element].
   SideEffectsBuilder getSideEffectsBuilder(FunctionEntity member);
 
@@ -68,9 +65,6 @@
   // TODO(johnniwinther): Is this 'potentially called' or 'known to be called'?
   void addFunctionCalledInLoop(MemberEntity element);
 
-  /// Registers that [element] is guaranteed not to throw an exception.
-  void registerCannotThrow(FunctionEntity element);
-
   /// Create a [InferredData] object for the collected information.
   InferredData close(JClosedWorld closedWorld);
 }
@@ -84,8 +78,6 @@
   final Set<MemberEntity> _functionsCalledInLoop;
   final Map<FunctionEntity, SideEffects> _sideEffects;
 
-  final Set<FunctionEntity> _sideEffectsFreeElements;
-
   final Set<FunctionEntity> _elementsThatCannotThrow;
 
   final Set<FunctionEntity> _functionsThatMightBePassedToApply;
@@ -94,7 +86,6 @@
       this._closedWorld,
       this._functionsCalledInLoop,
       this._sideEffects,
-      this._sideEffectsFreeElements,
       this._elementsThatCannotThrow,
       this._functionsThatMightBePassedToApply);
 
@@ -104,20 +95,13 @@
     Set<MemberEntity> functionsCalledInLoop = source.readMembers().toSet();
     Map<FunctionEntity, SideEffects> sideEffects = source.readMemberMap(
         (MemberEntity member) => SideEffects.readFromDataSource(source));
-    Set<FunctionEntity> sideEffectsFreeElements =
-        source.readMembers<FunctionEntity>().toSet();
     Set<FunctionEntity> elementsThatCannotThrow =
         source.readMembers<FunctionEntity>().toSet();
     Set<FunctionEntity> functionsThatMightBePassedToApply =
         source.readMembers<FunctionEntity>().toSet();
     source.end(tag);
-    return InferredDataImpl(
-        closedWorld,
-        functionsCalledInLoop,
-        sideEffects,
-        sideEffectsFreeElements,
-        elementsThatCannotThrow,
-        functionsThatMightBePassedToApply);
+    return InferredDataImpl(closedWorld, functionsCalledInLoop, sideEffects,
+        elementsThatCannotThrow, functionsThatMightBePassedToApply);
   }
 
   @override
@@ -129,7 +113,6 @@
         _sideEffects,
         (MemberEntity member, SideEffects sideEffects) =>
             sideEffects.writeToDataSink(sink));
-    sink.writeMembers(_sideEffectsFreeElements);
     sink.writeMembers(_elementsThatCannotThrow);
     sink.writeMembers(_functionsThatMightBePassedToApply);
     sink.end(tag);
@@ -206,27 +189,24 @@
   Map<MemberEntity, SideEffectsBuilder>? _sideEffectsBuilders = {};
   final Set<FunctionEntity> prematureSideEffectAccesses = {};
 
-  final Set<FunctionEntity> _sideEffectsFreeElements = {};
-
   final Set<FunctionEntity> _elementsThatCannotThrow = {};
 
   final Set<FunctionEntity> _functionsThatMightBePassedToApply = {};
 
-  InferredDataBuilderImpl(AnnotationsData annotationsData) {
-    annotationsData.forEachNoThrows(registerCannotThrow);
-    annotationsData.forEachNoSideEffects(registerSideEffectsFree);
-  }
+  AnnotationsData? _annotationsData;
+
+  InferredDataBuilderImpl(AnnotationsData this._annotationsData);
 
   @override
   SideEffectsBuilder getSideEffectsBuilder(MemberEntity member) {
-    return _sideEffectsBuilders![member] ??= SideEffectsBuilder(member);
+    return _sideEffectsBuilders![member] ??= _createSideEffectsBuilder(member);
   }
 
-  @override
-  void registerSideEffectsFree(FunctionEntity element) {
-    _sideEffectsFreeElements.add(element);
-    assert(!_sideEffectsBuilders!.containsKey(element));
-    _sideEffectsBuilders![element] = SideEffectsBuilder.free(element);
+  SideEffectsBuilder _createSideEffectsBuilder(MemberEntity member) {
+    if (_annotationsData!.hasNoSideEffects(member)) {
+      return SideEffectsBuilder.free(member);
+    }
+    return SideEffectsBuilder(member);
   }
 
   /// Compute [SideEffects] for all registered [SideEffectBuilder]s.
@@ -238,19 +218,22 @@
     Iterable<SideEffectsBuilder> sideEffectsBuilders =
         _sideEffectsBuilders!.values;
     emptyWorkList(sideEffectsBuilders);
-    for (SideEffectsBuilder sideEffectsBuilder in sideEffectsBuilders) {
-      _sideEffects[sideEffectsBuilder.member as FunctionEntity] =
-          sideEffectsBuilder.sideEffects;
+    for (SideEffectsBuilder builder in sideEffectsBuilders) {
+      final function = builder.member as FunctionEntity;
+      _sideEffects[function] = builder.sideEffects;
+
+      // TODO(sra): We should also infer whether the function cannot throw. This
+      // might be conveniently computed with the closure of the side effects
+      // over the call graph. For now we just use the annotations.
+      if (_annotationsData!.hasNoThrows(function)) {
+        _elementsThatCannotThrow.add(function);
+      }
     }
     _sideEffectsBuilders = null;
+    _annotationsData = null;
 
-    return InferredDataImpl(
-        closedWorld,
-        _functionsCalledInLoop,
-        _sideEffects,
-        _sideEffectsFreeElements,
-        _elementsThatCannotThrow,
-        _functionsThatMightBePassedToApply);
+    return InferredDataImpl(closedWorld, _functionsCalledInLoop, _sideEffects,
+        _elementsThatCannotThrow, _functionsThatMightBePassedToApply);
   }
 
   static void emptyWorkList(Iterable<SideEffectsBuilder> sideEffectsBuilders) {
@@ -281,11 +264,6 @@
   }
 
   @override
-  void registerCannotThrow(FunctionEntity element) {
-    _elementsThatCannotThrow.add(element);
-  }
-
-  @override
   void registerMightBePassedToApply(FunctionEntity element) {
     _functionsThatMightBePassedToApply.add(element);
   }
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index f27676d..4eb1c89 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -103,12 +103,12 @@
 
   /// [FeatureOption]s which default to enabled.
   late final List<FeatureOption> shipping = [
-    deferredSerialization,
     useContentSecurityPolicy,
   ];
 
   /// [FeatureOption]s which default to disabled.
   late final List<FeatureOption> canary = [
+    deferredSerialization,
     writeUtf8,
     newDumpInfo,
     simpleAsyncToFuture,
diff --git a/pkg/compiler/test/dump_info/data/deferred/main.dart b/pkg/compiler/test/dump_info/data/deferred/main.dart
index c4f9945..2ab399c 100644
--- a/pkg/compiler/test/dump_info/data/deferred/main.dart
+++ b/pkg/compiler/test/dump_info/data/deferred/main.dart
@@ -4,122 +4,7 @@
 
 // @dart = 2.7
 
-/*spec.library: 
- constant=[
-  {
-  "id": "constant/B.C_Deferred = A.lib__funky$closure();\n",
-  "kind": "constant",
-  "name": "",
-  "size": 39,
-  "outputUnit": "outputUnit/1",
-  "code": "B.C_Deferred = A.lib__funky$closure();\n"
-},
-  {
-  "id": "constant/B.C_JS_CONST = function getTagFallback(o) {\n  var s = Object.prototype.toString.call(o);\n  return s.substring(8, s.length - 1);\n};\n",
-  "kind": "constant",
-  "name": "",
-  "size": 131,
-  "outputUnit": "outputUnit/main",
-  "code": "B.C_JS_CONST = function getTagFallback(o) {\n  var s = Object.prototype.toString.call(o);\n  return s.substring(8, s.length - 1);\n};\n"
-},
-  {
-  "id": "constant/B.C__RootZone = new A._RootZone();\n",
-  "kind": "constant",
-  "name": "",
-  "size": 35,
-  "outputUnit": "outputUnit/main",
-  "code": "B.C__RootZone = new A._RootZone();\n"
-},
-  {
-  "id": "constant/B.C__StringStackTrace = new A._StringStackTrace();\n",
-  "kind": "constant",
-  "name": "",
-  "size": 51,
-  "outputUnit": "outputUnit/main",
-  "code": "B.C__StringStackTrace = new A._StringStackTrace();\n"
-},
-  {
-  "id": "constant/B.Interceptor_methods = J.Interceptor.prototype;\n",
-  "kind": "constant",
-  "name": "",
-  "size": 49,
-  "outputUnit": "outputUnit/main",
-  "code": "B.Interceptor_methods = J.Interceptor.prototype;\n"
-},
-  {
-  "id": "constant/B.JSArray_methods = J.JSArray.prototype;\n",
-  "kind": "constant",
-  "name": "",
-  "size": 41,
-  "outputUnit": "outputUnit/main",
-  "code": "B.JSArray_methods = J.JSArray.prototype;\n"
-},
-  {
-  "id": "constant/B.JSInt_methods = J.JSInt.prototype;\n",
-  "kind": "constant",
-  "name": "",
-  "size": 37,
-  "outputUnit": "outputUnit/main",
-  "code": "B.JSInt_methods = J.JSInt.prototype;\n"
-},
-  {
-  "id": "constant/B.JSString_methods = J.JSString.prototype;\n",
-  "kind": "constant",
-  "name": "",
-  "size": 43,
-  "outputUnit": "outputUnit/main",
-  "code": "B.JSString_methods = J.JSString.prototype;\n"
-},
-  {
-  "id": "constant/B.JavaScriptObject_methods = J.JavaScriptObject.prototype;\n",
-  "kind": "constant",
-  "name": "",
-  "size": 59,
-  "outputUnit": "outputUnit/main",
-  "code": "B.JavaScriptObject_methods = J.JavaScriptObject.prototype;\n"
-}],
- deferredFiles=[{
-  "main.dart": {
-    "name": "<unnamed>",
-    "imports": {
-      "lib": [
-        "out_1.part.js"
-      ]
-    }
-  }
-}],
- dependencies=[{}],
- library=[{
-  "id": "library/memory:sdk/tests/web/native/main.dart::",
-  "kind": "library",
-  "name": "<unnamed>",
-  "size": 301,
-  "children": [
-    "function/memory:sdk/tests/web/native/main.dart::main"
-  ],
-  "canonicalUri": "memory:sdk/tests/web/native/main.dart"
-}],
- outputUnits=[
-  {
-  "id": "outputUnit/1",
-  "kind": "outputUnit",
-  "name": "1",
-  "size": 1087,
-  "filename": "out_1.part.js",
-  "imports": [
-    "lib"
-  ]
-},
-  {
-  "id": "outputUnit/main",
-  "kind": "outputUnit",
-  "name": "main",
-  "filename": "out",
-  "imports": []
-}]
-*/
-
-/*canary.library: 
+/*library: 
  constant=[
   {
   "id": "constant/B.C_Deferred = A.lib__funky$closure();\n",
diff --git a/pkg/compiler/test/dump_info/data/deferred_future/main.dart b/pkg/compiler/test/dump_info/data/deferred_future/main.dart
index f9347fc..ed843d7 100644
--- a/pkg/compiler/test/dump_info/data/deferred_future/main.dart
+++ b/pkg/compiler/test/dump_info/data/deferred_future/main.dart
@@ -110,7 +110,7 @@
   "id": "outputUnit/1",
   "kind": "outputUnit",
   "name": "1",
-  "size": 870,
+  "size": 846,
   "filename": "out_1.part.js",
   "imports": [
     "lib1"
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 6e82679..dbbaa95 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -153,7 +153,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/aot/aot_call_specializer.cc b/runtime/vm/compiler/aot/aot_call_specializer.cc
index d4aa2e9..c1488d8 100644
--- a/runtime/vm/compiler/aot/aot_call_specializer.cc
+++ b/runtime/vm/compiler/aot/aot_call_specializer.cc
@@ -126,10 +126,7 @@
     const intptr_t receiver_index = call->FirstArgIndex();
     RedefinitionInstr* redefinition = new (Z)
         RedefinitionInstr(new (Z) Value(call->ArgumentAt(receiver_index)));
-    redefinition->set_ssa_temp_index(flow_graph()->alloc_ssa_temp_index());
-    if (FlowGraph::NeedsPairLocation(redefinition->representation())) {
-      flow_graph()->alloc_ssa_temp_index();
-    }
+    flow_graph()->AllocateSSAIndex(redefinition);
     redefinition->InsertAfter(call);
     // Replace all uses of the receiver dominated by this call.
     FlowGraph::RenameDominatedUses(call->ArgumentAt(receiver_index),
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/backend/block_builder.h b/runtime/vm/compiler/backend/block_builder.h
index 9c4dc68..4a36631 100644
--- a/runtime/vm/compiler/backend/block_builder.h
+++ b/runtime/vm/compiler/backend/block_builder.h
@@ -31,10 +31,7 @@
   }
 
   Definition* AddToInitialDefinitions(Definition* def) {
-    def->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index());
-    if (FlowGraph::NeedsPairLocation(def->representation())) {
-      flow_graph_->alloc_ssa_temp_index();
-    }
+    flow_graph_->AllocateSSAIndex(def);
     auto normal_entry = flow_graph_->graph_entry()->normal_entry();
     flow_graph_->AddToInitialDefinitions(normal_entry, def);
     return def;
@@ -42,7 +39,7 @@
 
   template <typename T>
   T* AddDefinition(T* def) {
-    flow_graph_->AllocateSSAIndexes(def);
+    flow_graph_->AllocateSSAIndex(def);
     AddInstruction(def);
     return def;
   }
@@ -134,10 +131,7 @@
   }
 
   void AddPhi(PhiInstr* phi) {
-    phi->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index());
-    if (FlowGraph::NeedsPairLocation(phi->representation())) {
-      flow_graph_->alloc_ssa_temp_index();
-    }
+    flow_graph_->AllocateSSAIndex(phi);
     phi->mark_alive();
     entry_->AsJoinEntry()->InsertPhi(phi);
   }
diff --git a/runtime/vm/compiler/backend/constant_propagator.cc b/runtime/vm/compiler/backend/constant_propagator.cc
index 85595e1..69e28a7 100644
--- a/runtime/vm/compiler/backend/constant_propagator.cc
+++ b/runtime/vm/compiler/backend/constant_propagator.cc
@@ -35,9 +35,8 @@
       unknown_(Object::unknown_constant()),
       non_constant_(Object::non_constant()),
       constant_value_(Object::Handle(Z)),
-      reachable_(new (Z) BitVector(Z, graph->preorder().length())),
-      unwrapped_phis_(new (Z)
-                          BitVector(Z, graph->max_virtual_register_number())),
+      reachable_(new(Z) BitVector(Z, graph->preorder().length())),
+      unwrapped_phis_(new(Z) BitVector(Z, graph->current_ssa_temp_index())),
       block_worklist_(),
       definition_worklist_(graph, 10) {}
 
diff --git a/runtime/vm/compiler/backend/flow_graph.cc b/runtime/vm/compiler/backend/flow_graph.cc
index fd20143..95691ce 100644
--- a/runtime/vm/compiler/backend/flow_graph.cc
+++ b/runtime/vm/compiler/backend/flow_graph.cc
@@ -67,7 +67,7 @@
 
 void FlowGraph::EnsureSSATempIndex(Definition* defn, Definition* replacement) {
   if ((replacement->ssa_temp_index() == -1) && (defn->ssa_temp_index() != -1)) {
-    AllocateSSAIndexes(replacement);
+    AllocateSSAIndex(replacement);
   }
 }
 
@@ -191,10 +191,7 @@
     } else {
       constant = new (zone()) UnboxedConstantInstr(zone_object, representation);
     }
-    constant->set_ssa_temp_index(alloc_ssa_temp_index());
-    if (NeedsPairLocation(constant->representation())) {
-      alloc_ssa_temp_index();
-    }
+    AllocateSSAIndex(constant);
     AddToGraphInitialDefinitions(constant);
     constant_instr_pool_.Insert(constant);
   }
@@ -271,7 +268,7 @@
                             UseKind use_kind) {
   if (use_kind == kValue) {
     ASSERT(instr->IsDefinition());
-    AllocateSSAIndexes(instr->AsDefinition());
+    AllocateSSAIndex(instr->AsDefinition());
   }
   instr->InsertAfter(prev);
   ASSERT(instr->env() == NULL);
@@ -296,7 +293,7 @@
                                  UseKind use_kind) {
   if (use_kind == kValue) {
     ASSERT(instr->IsDefinition());
-    AllocateSSAIndexes(instr->AsDefinition());
+    AllocateSSAIndex(instr->AsDefinition());
   }
   ASSERT(instr->env() == NULL);
   if (env != NULL) {
@@ -1215,8 +1212,7 @@
           new (zone()) ParameterInstr(i, param_offset, function_entry, kTagged);
       param_offset++;
     }
-    param->set_ssa_temp_index(alloc_ssa_temp_index());
-    if (NeedsPairLocation(param->representation())) alloc_ssa_temp_index();
+    AllocateSSAIndex(param);
     AddToInitialDefinitions(function_entry, param);
     (*env)[i] = param;
   }
@@ -1228,7 +1224,7 @@
     if (inlining_parameters != NULL) {
       for (intptr_t i = 0; i < function().NumParameters(); ++i) {
         Definition* defn = (*inlining_parameters)[inlined_type_args_param + i];
-        AllocateSSAIndexes(defn);
+        AllocateSSAIndex(defn);
         AddToInitialDefinitions(function_entry, defn);
 
         intptr_t index = EnvIndex(parsed_function_.RawParameterVariable(i));
@@ -1250,7 +1246,7 @@
       } else {
         defn = (*inlining_parameters)[0];
       }
-      AllocateSSAIndexes(defn);
+      AllocateSSAIndex(defn);
       AddToInitialDefinitions(function_entry, defn);
       (*env)[RawTypeArgumentEnvIndex()] = defn;
     }
@@ -1260,7 +1256,7 @@
       Definition* defn =
           new (Z) SpecialParameterInstr(SpecialParameterInstr::kArgDescriptor,
                                         DeoptId::kNone, function_entry);
-      AllocateSSAIndexes(defn);
+      AllocateSSAIndex(defn);
       AddToInitialDefinitions(function_entry, defn);
       (*env)[ArgumentDescriptorEnvIndex()] = defn;
     }
@@ -1279,7 +1275,7 @@
   for (intptr_t i = 0; i < parameter_count; i++) {
     ParameterInstr* param =
         new (zone()) ParameterInstr(i, i, osr_entry, kTagged);
-    param->set_ssa_temp_index(alloc_ssa_temp_index());
+    AllocateSSAIndex(param);
     AddToInitialDefinitions(osr_entry, param);
     (*env)[i] = param;
   }
@@ -1313,7 +1309,7 @@
       param = new (Z) ParameterInstr(i, i, catch_entry, kTagged);
     }
 
-    param->set_ssa_temp_index(alloc_ssa_temp_index());  // New SSA temp.
+    AllocateSSAIndex(param);  // New SSA temp.
     (*env)[i] = param;
     AddToInitialDefinitions(catch_entry, param);
   }
@@ -1346,7 +1342,7 @@
         PhiInstr* phi = (*join->phis())[i];
         if (phi != nullptr) {
           (*env)[i] = phi;
-          AllocateSSAIndexes(phi);  // New SSA temp.
+          AllocateSSAIndex(phi);  // New SSA temp.
           if (block_entry->InsideTryBlock() && !phi->is_alive()) {
             // This is a safe approximation.  Inside try{} all locals are
             // used at every call implicitly, so we mark all phis as live
@@ -1549,7 +1545,7 @@
         if (Definition* definition = current->AsDefinition()) {
           if (definition->HasTemp()) {
             // Assign fresh SSA temporary and update expression stack.
-            AllocateSSAIndexes(definition);
+            AllocateSSAIndex(definition);
             env->Add(definition);
           }
         }
@@ -2573,7 +2569,7 @@
         Value* redefined = definition->RedefinedValue();
         if (redefined != nullptr) {
           if (!definition->HasSSATemp()) {
-            AllocateSSAIndexes(definition);
+            AllocateSSAIndex(definition);
           }
           Definition* original = redefined->definition();
           RenameDominatedUses(original, definition, definition);
@@ -2821,7 +2817,7 @@
 
   // Short-circuit second comparison and connect through phi.
   condition.oper2->InsertAfter(bt);
-  AllocateSSAIndexes(condition.oper2);
+  AllocateSSAIndex(condition.oper2);
   condition.oper2->InheritDeoptTarget(zone(), inherit);  // must inherit
   PhiInstr* phi =
       AddPhi(mid_point, condition.oper2, GetConstant(Bool::False()));
@@ -2841,7 +2837,7 @@
   Value* v1 = new (zone()) Value(d1);
   Value* v2 = new (zone()) Value(d2);
 
-  AllocateSSAIndexes(phi);
+  AllocateSSAIndex(phi);
 
   phi->mark_alive();
   phi->SetInputAt(0, v1);
diff --git a/runtime/vm/compiler/backend/flow_graph.h b/runtime/vm/compiler/backend/flow_graph.h
index 98341177..3782e75 100644
--- a/runtime/vm/compiler/backend/flow_graph.h
+++ b/runtime/vm/compiler/backend/flow_graph.h
@@ -200,11 +200,6 @@
             env_index == SuspendStateEnvIndex());
   }
 
-  static bool NeedsPairLocation(Representation representation) {
-    return representation == kUnboxedInt64 &&
-           compiler::target::kIntSpillFactor == 2;
-  }
-
   // Flow graph orders.
   const GrowableArray<BlockEntryInstr*>& preorder() const { return preorder_; }
   const GrowableArray<BlockEntryInstr*>& postorder() const {
@@ -246,8 +241,8 @@
     current_ssa_temp_index_ = index;
   }
 
-  intptr_t max_virtual_register_number() const {
-    return current_ssa_temp_index();
+  intptr_t max_vreg() const {
+    return current_ssa_temp_index() * kMaxLocationCount;
   }
 
   enum class ToCheck { kNoCheck, kCheckNull, kCheckCid };
@@ -272,14 +267,9 @@
 
   ConstantInstr* constant_dead() const { return constant_dead_; }
 
-  intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; }
-
-  void AllocateSSAIndexes(Definition* def) {
-    ASSERT(def);
-    def->set_ssa_temp_index(alloc_ssa_temp_index());
-    // Always allocate a second index. This index is unused except
-    // for Definitions with register pair outputs.
-    alloc_ssa_temp_index();
+  void AllocateSSAIndex(Definition* def) {
+    def->set_ssa_temp_index(current_ssa_temp_index_);
+    current_ssa_temp_index_++;
   }
 
   intptr_t InstructionCount() const;
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 5506aec..bee10a9 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -2321,14 +2321,14 @@
   }
   bool HasSSATemp() const { return ssa_temp_index_ >= 0; }
   void ClearSSATempIndex() { ssa_temp_index_ = -1; }
-  bool HasPairRepresentation() const {
-    if (compiler::target::kWordSize == 8) {
-      return representation() == kPairOfTagged;
-    } else {
-      return (representation() == kPairOfTagged) ||
-             (representation() == kUnboxedInt64);
-    }
+
+  intptr_t vreg(intptr_t index) const {
+    ASSERT((index >= 0) && (index < location_count()));
+    if (ssa_temp_index_ == -1) return -1;
+    return ssa_temp_index_ * kMaxLocationCount + index;
   }
+  intptr_t location_count() const { return LocationCount(representation()); }
+  bool HasPairRepresentation() const { return location_count() == 2; }
 
   // Compile time type of the definition, which may be requested before type
   // propagation during graph building.
diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc
index 10f9fa5..076755b 100644
--- a/runtime/vm/compiler/backend/il_printer.cc
+++ b/runtime/vm/compiler/backend/il_printer.cc
@@ -439,12 +439,7 @@
 
 static void PrintUse(BaseTextBuffer* f, const Definition& definition) {
   if (definition.HasSSATemp()) {
-    if (definition.HasPairRepresentation()) {
-      f->Printf("(v%" Pd ", v%" Pd ")", definition.ssa_temp_index(),
-                definition.ssa_temp_index() + 1);
-    } else {
-      f->Printf("v%" Pd "", definition.ssa_temp_index());
-    }
+    f->Printf("v%" Pd "", definition.ssa_temp_index());
   } else if (definition.HasTemp()) {
     f->Printf("t%" Pd "", definition.temp_index());
   }
@@ -1142,12 +1137,7 @@
 }
 
 void PhiInstr::PrintTo(BaseTextBuffer* f) const {
-  if (HasPairRepresentation()) {
-    f->Printf("(v%" Pd ", v%" Pd ") <- phi(", ssa_temp_index(),
-              ssa_temp_index() + 1);
-  } else {
-    f->Printf("v%" Pd " <- phi(", ssa_temp_index());
-  }
+  f->Printf("v%" Pd " <- phi(", ssa_temp_index());
   for (intptr_t i = 0; i < inputs_.length(); ++i) {
     if (inputs_[i] != NULL) inputs_[i]->PrintTo(f);
     if (i < inputs_.length() - 1) f->AddString(", ");
diff --git a/runtime/vm/compiler/backend/inliner.cc b/runtime/vm/compiler/backend/inliner.cc
index 4c8e06f..4de28c1 100644
--- a/runtime/vm/compiler/backend/inliner.cc
+++ b/runtime/vm/compiler/backend/inliner.cc
@@ -782,10 +782,7 @@
             callee_signature, first_arg_index, i)) {
       RedefinitionInstr* redefinition =
           new (zone) RedefinitionInstr(actual->Copy(zone));
-      redefinition->set_ssa_temp_index(caller_graph->alloc_ssa_temp_index());
-      if (FlowGraph::NeedsPairLocation(redefinition->representation())) {
-        caller_graph->alloc_ssa_temp_index();
-      }
+      caller_graph->AllocateSSAIndex(redefinition);
       if (is_polymorphic_receiver && target_info->IsSingleCid()) {
         redefinition->UpdateType(CompileType::FromCid(target_info->cid_start));
       }
@@ -831,11 +828,7 @@
           LoadFieldInstr* context_load = new (zone) LoadFieldInstr(
               new Value((*arguments)[first_arg_index]->definition()),
               Slot::Closure_context(), call_data->call->source());
-          context_load->set_ssa_temp_index(
-              caller_graph->alloc_ssa_temp_index());
-          if (FlowGraph::NeedsPairLocation(context_load->representation())) {
-            caller_graph->alloc_ssa_temp_index();
-          }
+          caller_graph->AllocateSSAIndex(context_load);
           context_load->InsertBefore(callee_entry->next());
           param->ReplaceUsesWith(context_load);
           break;
@@ -1290,7 +1283,7 @@
         {
           // Compute SSA on the callee graph, catching bailouts.
           COMPILER_TIMINGS_TIMER_SCOPE(thread(), ComputeSSA);
-          callee_graph->ComputeSSA(caller_graph_->max_virtual_register_number(),
+          callee_graph->ComputeSSA(caller_graph_->current_ssa_temp_index(),
                                    param_stubs);
 #if defined(DEBUG)
           // The inlining IDs of instructions in the callee graph are unset
@@ -1977,11 +1970,7 @@
   Definition* receiver = call_->Receiver()->definition();
   RedefinitionInstr* redefinition =
       new (Z) RedefinitionInstr(new (Z) Value(receiver));
-  redefinition->set_ssa_temp_index(
-      owner_->caller_graph()->alloc_ssa_temp_index());
-  if (FlowGraph::NeedsPairLocation(redefinition->representation())) {
-    owner_->caller_graph()->alloc_ssa_temp_index();
-  }
+  owner_->caller_graph()->AllocateSSAIndex(redefinition);
   if (FlowGraphInliner::TryInlineRecognizedMethod(
           owner_->caller_graph(), receiver_cid, target, call_, redefinition,
           call_->source(), call_->ic_data(), graph_entry, &entry, &last,
@@ -2038,7 +2027,7 @@
   // at least one branch on the class id.
   LoadClassIdInstr* load_cid =
       new (Z) LoadClassIdInstr(new (Z) Value(receiver));
-  load_cid->set_ssa_temp_index(owner_->caller_graph()->alloc_ssa_temp_index());
+  owner_->caller_graph()->AllocateSSAIndex(load_cid);
   cursor = AppendInstruction(cursor, load_cid);
   for (intptr_t i = 0; i < inlined_variants_.length(); ++i) {
     const CidRange& variant = inlined_variants_[i];
@@ -2054,8 +2043,7 @@
       if (!call_->complete()) {
         RedefinitionInstr* cid_redefinition =
             new RedefinitionInstr(new (Z) Value(load_cid));
-        cid_redefinition->set_ssa_temp_index(
-            owner_->caller_graph()->alloc_ssa_temp_index());
+        owner_->caller_graph()->AllocateSSAIndex(cid_redefinition);
         cursor = AppendInstruction(cursor, cid_redefinition);
         CheckClassIdInstr* check_class_id = new (Z) CheckClassIdInstr(
             new (Z) Value(cid_redefinition), variant, call_->deopt_id());
@@ -2242,11 +2230,7 @@
     PolymorphicInstanceCallInstr* fallback_call =
         PolymorphicInstanceCallInstr::FromCall(Z, call_, *non_inlined_variants_,
                                                call_->complete());
-    fallback_call->set_ssa_temp_index(
-        owner_->caller_graph()->alloc_ssa_temp_index());
-    if (FlowGraph::NeedsPairLocation(fallback_call->representation())) {
-      owner_->caller_graph()->alloc_ssa_temp_index();
-    }
+    owner_->caller_graph()->AllocateSSAIndex(fallback_call);
     fallback_call->InheritDeoptTarget(zone(), call_);
     fallback_call->set_total_call_count(call_->CallCount());
     ReturnInstr* fallback_return = new ReturnInstr(
diff --git a/runtime/vm/compiler/backend/linearscan.cc b/runtime/vm/compiler/backend/linearscan.cc
index 68e5b3e..3597362 100644
--- a/runtime/vm/compiler/backend/linearscan.cc
+++ b/runtime/vm/compiler/backend/linearscan.cc
@@ -33,19 +33,6 @@
 static const intptr_t kTempVirtualRegister = -2;
 static const intptr_t kIllegalPosition = -1;
 static const intptr_t kMaxPosition = 0x7FFFFFFF;
-static const intptr_t kPairVirtualRegisterOffset = 1;
-
-// Definitions which have pair representations
-// (kPairOfTagged) use two virtual register names.
-// At SSA index allocation time each definition reserves two SSA indexes,
-// the second index is only used for pairs. This function maps from the first
-// SSA index to the second.
-static intptr_t ToSecondPairVreg(intptr_t vreg) {
-  // Map vreg to its pair vreg.
-  ASSERT((vreg == kNoVirtualRegister) || vreg >= 0);
-  return (vreg == kNoVirtualRegister) ? kNoVirtualRegister
-                                      : (vreg + kPairVirtualRegisterOffset);
-}
 
 static intptr_t MinPosition(intptr_t a, intptr_t b) {
   return (a < b) ? a : b;
@@ -93,15 +80,15 @@
                                        bool intrinsic_mode)
     : flow_graph_(flow_graph),
       reaching_defs_(flow_graph),
-      value_representations_(flow_graph.max_virtual_register_number()),
+      value_representations_(flow_graph.max_vreg()),
       block_order_(flow_graph.reverse_postorder()),
       postorder_(flow_graph.postorder()),
       instructions_(),
       block_entries_(),
       extra_loop_info_(),
       liveness_(flow_graph),
-      vreg_count_(flow_graph.max_virtual_register_number()),
-      live_ranges_(flow_graph.max_virtual_register_number()),
+      vreg_count_(flow_graph.max_vreg()),
+      live_ranges_(flow_graph.max_vreg()),
       unallocated_cpu_(),
       unallocated_fpu_(),
       cpu_regs_(),
@@ -165,7 +152,7 @@
       if (inner_mat != NULL) {
         DeepLiveness(inner_mat, live_in);
       } else {
-        intptr_t idx = defn->ssa_temp_index();
+        intptr_t idx = defn->vreg(0);
         live_in->Add(idx);
       }
     }
@@ -195,11 +182,11 @@
       // Handle definitions.
       Definition* current_def = current->AsDefinition();
       if ((current_def != NULL) && current_def->HasSSATemp()) {
-        kill->Add(current_def->ssa_temp_index());
-        live_in->Remove(current_def->ssa_temp_index());
+        kill->Add(current_def->vreg(0));
+        live_in->Remove(current_def->vreg(0));
         if (current_def->HasPairRepresentation()) {
-          kill->Add(ToSecondPairVreg(current_def->ssa_temp_index()));
-          live_in->Remove(ToSecondPairVreg(current_def->ssa_temp_index()));
+          kill->Add(current_def->vreg(1));
+          live_in->Remove(current_def->vreg(1));
         }
       }
 
@@ -211,9 +198,9 @@
         ASSERT(!locs->in(j).IsConstant() || input->BindsToConstant());
         if (locs->in(j).IsConstant()) continue;
 
-        live_in->Add(input->definition()->ssa_temp_index());
+        live_in->Add(input->definition()->vreg(0));
         if (input->definition()->HasPairRepresentation()) {
-          live_in->Add(ToSecondPairVreg(input->definition()->ssa_temp_index()));
+          live_in->Add(input->definition()->vreg(1));
         }
       }
 
@@ -228,9 +215,9 @@
             // Treat its inputs as part of the environment.
             DeepLiveness(defn->AsMaterializeObject(), live_in);
           } else if (!defn->IsPushArgument() && !defn->IsConstant()) {
-            live_in->Add(defn->ssa_temp_index());
+            live_in->Add(defn->vreg(0));
             if (defn->HasPairRepresentation()) {
-              live_in->Add(ToSecondPairVreg(defn->ssa_temp_index()));
+              live_in->Add(defn->vreg(1));
             }
           }
         }
@@ -243,11 +230,11 @@
       for (PhiIterator it(join); !it.Done(); it.Advance()) {
         PhiInstr* phi = it.Current();
         ASSERT(phi != NULL);
-        kill->Add(phi->ssa_temp_index());
-        live_in->Remove(phi->ssa_temp_index());
+        kill->Add(phi->vreg(0));
+        live_in->Remove(phi->vreg(0));
         if (phi->HasPairRepresentation()) {
-          kill->Add(ToSecondPairVreg(phi->ssa_temp_index()));
-          live_in->Remove(ToSecondPairVreg(phi->ssa_temp_index()));
+          kill->Add(phi->vreg(1));
+          live_in->Remove(phi->vreg(1));
         }
 
         // If a phi input is not defined by the corresponding predecessor it
@@ -257,12 +244,12 @@
           if (val->BindsToConstant()) continue;
 
           BlockEntryInstr* pred = block->PredecessorAt(k);
-          const intptr_t use = val->definition()->ssa_temp_index();
+          const intptr_t use = val->definition()->vreg(0);
           if (!kill_[pred->postorder_number()]->Contains(use)) {
             live_in_[pred->postorder_number()]->Add(use);
           }
           if (phi->HasPairRepresentation()) {
-            const intptr_t second_use = ToSecondPairVreg(use);
+            const intptr_t second_use = val->definition()->vreg(1);
             if (!kill_[pred->postorder_number()]->Contains(second_use)) {
               live_in_[pred->postorder_number()]->Add(second_use);
             }
@@ -273,12 +260,12 @@
       // Process initial definitions, i.e. parameters and special parameters.
       for (intptr_t i = 0; i < entry->initial_definitions()->length(); i++) {
         Definition* def = (*entry->initial_definitions())[i];
-        const intptr_t vreg = def->ssa_temp_index();
+        const intptr_t vreg = def->vreg(0);
         kill_[entry->postorder_number()]->Add(vreg);
         live_in_[entry->postorder_number()]->Remove(vreg);
         if (def->HasPairRepresentation()) {
-          kill_[entry->postorder_number()]->Add(ToSecondPairVreg((vreg)));
-          live_in_[entry->postorder_number()]->Remove(ToSecondPairVreg(vreg));
+          kill_[entry->postorder_number()]->Add(def->vreg(1));
+          live_in_[entry->postorder_number()]->Remove(def->vreg(1));
         }
       }
     }
@@ -598,8 +585,8 @@
       } else {
         // All values flowing into the loop header are live at the
         // back edge and can interfere with phi moves.
-        current_interference_set = new (zone)
-            BitVector(zone, flow_graph_.max_virtual_register_number());
+        current_interference_set =
+            new (zone) BitVector(zone, flow_graph_.max_vreg());
         current_interference_set->AddAll(
             liveness_.GetLiveInSet(loop_info->header()));
         extra_loop_info_[loop_info->id()]->backedge_interference =
@@ -643,7 +630,7 @@
       for (intptr_t i = 0; i < catch_entry->initial_definitions()->length();
            i++) {
         Definition* defn = (*catch_entry->initial_definitions())[i];
-        LiveRange* range = GetLiveRange(defn->ssa_temp_index());
+        LiveRange* range = GetLiveRange(defn->vreg(0));
         range->DefineAt(catch_entry->start_pos());  // Defined at block entry.
         ProcessInitialDefinition(defn, range, catch_entry, i);
       }
@@ -654,14 +641,13 @@
         Definition* defn = initial_definitions[i];
         if (defn->HasPairRepresentation()) {
           // The lower bits are pushed after the higher bits
-          LiveRange* range =
-              GetLiveRange(ToSecondPairVreg(defn->ssa_temp_index()));
+          LiveRange* range = GetLiveRange(defn->vreg(1));
           range->AddUseInterval(entry->start_pos(), entry->start_pos() + 2);
           range->DefineAt(entry->start_pos());
           ProcessInitialDefinition(defn, range, entry, i,
                                    /*second_location_for_definition=*/true);
         }
-        LiveRange* range = GetLiveRange(defn->ssa_temp_index());
+        LiveRange* range = GetLiveRange(defn->vreg(0));
         range->AddUseInterval(entry->start_pos(), entry->start_pos() + 2);
         range->DefineAt(entry->start_pos());
         ProcessInitialDefinition(defn, range, entry, i);
@@ -676,13 +662,13 @@
     Definition* defn = (*graph_entry->initial_definitions())[i];
     if (defn->HasPairRepresentation()) {
       // The lower bits are pushed after the higher bits
-      LiveRange* range = GetLiveRange(ToSecondPairVreg(defn->ssa_temp_index()));
+      LiveRange* range = GetLiveRange(defn->vreg(1));
       range->AddUseInterval(graph_entry->start_pos(), graph_entry->end_pos());
       range->DefineAt(graph_entry->start_pos());
       ProcessInitialDefinition(defn, range, graph_entry, i,
                                /*second_location_for_definition=*/true);
     }
-    LiveRange* range = GetLiveRange(defn->ssa_temp_index());
+    LiveRange* range = GetLiveRange(defn->vreg(0));
     range->AddUseInterval(graph_entry->start_pos(), graph_entry->end_pos());
     range->DefineAt(graph_entry->start_pos());
     ProcessInitialDefinition(defn, range, graph_entry, i);
@@ -920,27 +906,25 @@
     //                 g  g'
     //      value    --*
     //
-    intptr_t vreg = val->definition()->ssa_temp_index();
+    intptr_t vreg = val->definition()->vreg(0);
     LiveRange* range = GetLiveRange(vreg);
     if (interfere_at_backedge != NULL) interfere_at_backedge->Add(vreg);
 
     range->AddUseInterval(block->start_pos(), pos);
-    range->AddHintedUse(
-        pos, move->src_slot(),
-        GetLiveRange(phi->ssa_temp_index())->assigned_location_slot());
+    range->AddHintedUse(pos, move->src_slot(),
+                        GetLiveRange(phi->vreg(0))->assigned_location_slot());
     move->set_src(Location::PrefersRegister());
 
     if (val->definition()->HasPairRepresentation()) {
       move = parallel_move->MoveOperandsAt(move_index++);
-      vreg = ToSecondPairVreg(vreg);
+      vreg = val->definition()->vreg(1);
       range = GetLiveRange(vreg);
       if (interfere_at_backedge != NULL) {
         interfere_at_backedge->Add(vreg);
       }
       range->AddUseInterval(block->start_pos(), pos);
       range->AddHintedUse(pos, move->src_slot(),
-                          GetLiveRange(ToSecondPairVreg(phi->ssa_temp_index()))
-                              ->assigned_location_slot());
+                          GetLiveRange(phi->vreg(1))->assigned_location_slot());
       move->set_src(Location::PrefersRegister());
     }
   }
@@ -962,7 +946,7 @@
   for (PhiIterator it(join); !it.Done(); it.Advance()) {
     PhiInstr* phi = it.Current();
     ASSERT(phi != NULL);
-    const intptr_t vreg = phi->ssa_temp_index();
+    const intptr_t vreg = phi->vreg(0);
     ASSERT(vreg >= 0);
     const bool is_pair_phi = phi->HasPairRepresentation();
 
@@ -976,7 +960,7 @@
     if (is_loop_header) range->mark_loop_phi();
 
     if (is_pair_phi) {
-      LiveRange* second_range = GetLiveRange(ToSecondPairVreg(vreg));
+      LiveRange* second_range = GetLiveRange(phi->vreg(1));
       second_range->DefineAt(pos);  // Shorten live range.
       if (is_loop_header) second_range->mark_loop_phi();
     }
@@ -990,7 +974,7 @@
       move->set_dest(Location::PrefersRegister());
       range->AddUse(pos, move->dest_slot());
       if (is_pair_phi) {
-        LiveRange* second_range = GetLiveRange(ToSecondPairVreg(vreg));
+        LiveRange* second_range = GetLiveRange(phi->vreg(1));
         MoveOperands* second_move =
             goto_instr->parallel_move()->MoveOperandsAt(move_idx + 1);
         second_move->set_dest(Location::PrefersRegister());
@@ -1003,7 +987,7 @@
     AssignSafepoints(phi, range);
     CompleteRange(range, phi->RegisterKindForResult());
     if (is_pair_phi) {
-      LiveRange* second_range = GetLiveRange(ToSecondPairVreg(vreg));
+      LiveRange* second_range = GetLiveRange(phi->vreg(1));
       AssignSafepoints(phi, second_range);
       CompleteRange(second_range, phi->RegisterKindForResult());
     }
@@ -1059,7 +1043,7 @@
           // they are still used when resolving control flow.
           ASSERT(def->IsParameter() || def->IsPhi());
           ASSERT(!def->HasPairRepresentation());
-          LiveRange* range = GetLiveRange(def->ssa_temp_index());
+          LiveRange* range = GetLiveRange(def->vreg(0));
           range->AddUseInterval(block_start_pos, use_pos);
         }
         continue;
@@ -1089,19 +1073,18 @@
         PairLocation* location_pair = locations[i].AsPairLocation();
         {
           // First live range.
-          LiveRange* range = GetLiveRange(def->ssa_temp_index());
+          LiveRange* range = GetLiveRange(def->vreg(0));
           range->AddUseInterval(block_start_pos, use_pos);
           range->AddUse(use_pos, location_pair->SlotAt(0));
         }
         {
           // Second live range.
-          LiveRange* range =
-              GetLiveRange(ToSecondPairVreg(def->ssa_temp_index()));
+          LiveRange* range = GetLiveRange(def->vreg(1));
           range->AddUseInterval(block_start_pos, use_pos);
           range->AddUse(use_pos, location_pair->SlotAt(1));
         }
       } else {
-        LiveRange* range = GetLiveRange(def->ssa_temp_index());
+        LiveRange* range = GetLiveRange(def->vreg(0));
         range->AddUseInterval(block_start_pos, use_pos);
         range->AddUse(use_pos, &locations[i]);
       }
@@ -1141,14 +1124,13 @@
       PairLocation* location_pair = locations[i].AsPairLocation();
       {
         // First live range.
-        LiveRange* range = GetLiveRange(def->ssa_temp_index());
+        LiveRange* range = GetLiveRange(def->vreg(0));
         range->AddUseInterval(block_start_pos, use_pos);
         range->AddUse(use_pos, location_pair->SlotAt(0));
       }
       {
         // Second live range.
-        LiveRange* range =
-            GetLiveRange(ToSecondPairVreg(def->ssa_temp_index()));
+        LiveRange* range = GetLiveRange(def->vreg(1));
         range->AddUseInterval(block_start_pos, use_pos);
         range->AddUse(use_pos, location_pair->SlotAt(1));
       }
@@ -1158,7 +1140,7 @@
                                  def->AsMaterializeObject());
     } else {
       locations[i] = Location::Any();
-      LiveRange* range = GetLiveRange(def->ssa_temp_index());
+      LiveRange* range = GetLiveRange(def->vreg(0));
       range->AddUseInterval(block_start_pos, use_pos);
       range->AddUse(use_pos, &locations[i]);
     }
@@ -1323,7 +1305,7 @@
 
     if ((interference_set != NULL) && (range->vreg() >= 0) &&
         interference_set->Contains(range->vreg())) {
-      interference_set->Add(input->ssa_temp_index());
+      interference_set->Add(input->vreg(0));
     }
   } else {
     // Normal unallocated location that requires a register. Expected shape of
@@ -1355,9 +1337,7 @@
   Definition* def = current->AsDefinition();
   if ((def != NULL) && (def->AsConstant() != NULL)) {
     ASSERT(!def->HasPairRepresentation());
-    LiveRange* range = (def->ssa_temp_index() != -1)
-                           ? GetLiveRange(def->ssa_temp_index())
-                           : NULL;
+    LiveRange* range = (def->vreg(0) != -1) ? GetLiveRange(def->vreg(0)) : NULL;
 
     // Drop definitions of constants that have no uses.
     if ((range == NULL) || (range->first_use() == NULL)) {
@@ -1435,16 +1415,15 @@
       if (in_ref->IsPairLocation()) {
         ASSERT(input->definition()->HasPairRepresentation());
         PairLocation* pair = in_ref->AsPairLocation();
-        const intptr_t vreg = input->definition()->ssa_temp_index();
         // Each element of the pair is assigned it's own virtual register number
         // and is allocated its own LiveRange.
-        ProcessOneInput(block, pos, pair->SlotAt(0), input, vreg,
-                        live_registers);
+        ProcessOneInput(block, pos, pair->SlotAt(0), input,
+                        input->definition()->vreg(0), live_registers);
         ProcessOneInput(block, pos, pair->SlotAt(1), input,
-                        ToSecondPairVreg(vreg), live_registers);
+                        input->definition()->vreg(1), live_registers);
       } else {
-        ProcessOneInput(block, pos, in_ref, input,
-                        input->definition()->ssa_temp_index(), live_registers);
+        ProcessOneInput(block, pos, in_ref, input, input->definition()->vreg(0),
+                        live_registers);
       }
     }
   }
@@ -1543,7 +1522,7 @@
   }
 
   if (locs->out(0).IsInvalid()) {
-    ASSERT(def->ssa_temp_index() < 0);
+    ASSERT(def->vreg(0) < 0);
     return;
   }
 
@@ -1559,42 +1538,40 @@
       ASSERT(input->HasPairRepresentation());
       // Each element of the pair is assigned it's own virtual register number
       // and is allocated its own LiveRange.
-      ProcessOneOutput(block, pos,             // BlockEntry, seq.
-                       pair->SlotAt(0), def,   // (output) Location, Definition.
-                       def->ssa_temp_index(),  // (output) virtual register.
-                       true,                   // output mapped to first input.
+      ProcessOneOutput(block, pos,            // BlockEntry, seq.
+                       pair->SlotAt(0), def,  // (output) Location, Definition.
+                       def->vreg(0),          // (output) virtual register.
+                       true,                  // output mapped to first input.
                        in_pair->SlotAt(0), input,  // (input) Location, Def.
-                       input->ssa_temp_index(),    // (input) virtual register.
+                       input->vreg(0),             // (input) virtual register.
                        interference_set);
-      ProcessOneOutput(
-          block, pos, pair->SlotAt(1), def,
-          ToSecondPairVreg(def->ssa_temp_index()), true, in_pair->SlotAt(1),
-          input, ToSecondPairVreg(input->ssa_temp_index()), interference_set);
+      ProcessOneOutput(block, pos, pair->SlotAt(1), def, def->vreg(1), true,
+                       in_pair->SlotAt(1), input, input->vreg(1),
+                       interference_set);
     } else {
       // Each element of the pair is assigned it's own virtual register number
       // and is allocated its own LiveRange.
-      ProcessOneOutput(block, pos, pair->SlotAt(0), def, def->ssa_temp_index(),
+      ProcessOneOutput(block, pos, pair->SlotAt(0), def, def->vreg(0),
                        false,           // output is not mapped to first input.
                        NULL, NULL, -1,  // First input not needed.
                        interference_set);
-      ProcessOneOutput(block, pos, pair->SlotAt(1), def,
-                       ToSecondPairVreg(def->ssa_temp_index()), false, NULL,
-                       NULL, -1, interference_set);
+      ProcessOneOutput(block, pos, pair->SlotAt(1), def, def->vreg(1), false,
+                       NULL, NULL, -1, interference_set);
     }
   } else {
     if (output_same_as_first_input) {
       Location* in_ref = locs->in_slot(0);
       Definition* input = current->InputAt(0)->definition();
       ASSERT(!in_ref->IsPairLocation());
-      ProcessOneOutput(block, pos,             // BlockEntry, Instruction, seq.
-                       out, def,               // (output) Location, Definition.
-                       def->ssa_temp_index(),  // (output) virtual register.
-                       true,                   // output mapped to first input.
-                       in_ref, input,          // (input) Location, Def.
-                       input->ssa_temp_index(),  // (input) virtual register.
+      ProcessOneOutput(block, pos,      // BlockEntry, Instruction, seq.
+                       out, def,        // (output) Location, Definition.
+                       def->vreg(0),    // (output) virtual register.
+                       true,            // output mapped to first input.
+                       in_ref, input,   // (input) Location, Def.
+                       input->vreg(0),  // (input) virtual register.
                        interference_set);
     } else {
-      ProcessOneOutput(block, pos, out, def, def->ssa_temp_index(),
+      ProcessOneOutput(block, pos, out, def, def->vreg(0),
                        false,           // output is not mapped to first input.
                        NULL, NULL, -1,  // First input not needed.
                        interference_set);
@@ -2202,8 +2179,7 @@
 void ReachingDefs::AddPhi(PhiInstr* phi) {
   if (phi->reaching_defs() == NULL) {
     Zone* zone = flow_graph_.zone();
-    phi->set_reaching_defs(
-        new (zone) BitVector(zone, flow_graph_.max_virtual_register_number()));
+    phi->set_reaching_defs(new (zone) BitVector(zone, flow_graph_.max_vreg()));
 
     // Compute initial set reaching defs set.
     bool depends_on_phi = false;
@@ -2212,9 +2188,9 @@
       if (input->IsPhi()) {
         depends_on_phi = true;
       }
-      phi->reaching_defs()->Add(input->ssa_temp_index());
+      phi->reaching_defs()->Add(input->vreg(0));
       if (phi->HasPairRepresentation()) {
-        phi->reaching_defs()->Add(ToSecondPairVreg(input->ssa_temp_index()));
+        phi->reaching_defs()->Add(input->vreg(1));
       }
     }
 
@@ -2329,7 +2305,7 @@
          it.Advance()) {
       PhiInstr* phi = it.Current();
       ASSERT(phi->is_alive());
-      const intptr_t phi_vreg = phi->ssa_temp_index();
+      const intptr_t phi_vreg = phi->vreg(0);
       LiveRange* range = GetLiveRange(phi_vreg);
       if (range->assigned_location().kind() == register_kind_) {
         const intptr_t reg = range->assigned_location().register_code();
@@ -2338,7 +2314,7 @@
         }
       }
       if (phi->HasPairRepresentation()) {
-        const intptr_t second_phi_vreg = ToSecondPairVreg(phi_vreg);
+        const intptr_t second_phi_vreg = phi->vreg(1);
         LiveRange* second_range = GetLiveRange(second_phi_vreg);
         if (second_range->assigned_location().kind() == register_kind_) {
           const intptr_t reg =
@@ -3091,10 +3067,10 @@
   auto initial_definitions = graph_entry->initial_definitions();
   for (intptr_t i = 0; i < initial_definitions->length(); ++i) {
     Definition* def = (*initial_definitions)[i];
-    value_representations_[def->ssa_temp_index()] =
+    value_representations_[def->vreg(0)] =
         RepresentationForRange(def->representation());
     if (def->HasPairRepresentation()) {
-      value_representations_[ToSecondPairVreg(def->ssa_temp_index())] =
+      value_representations_[def->vreg(1)] =
           RepresentationForRange(def->representation());
     }
   }
@@ -3107,21 +3083,21 @@
       initial_definitions = entry->initial_definitions();
       for (intptr_t i = 0; i < initial_definitions->length(); ++i) {
         Definition* def = (*initial_definitions)[i];
-        value_representations_[def->ssa_temp_index()] =
+        value_representations_[def->vreg(0)] =
             RepresentationForRange(def->representation());
         if (def->HasPairRepresentation()) {
-          value_representations_[ToSecondPairVreg(def->ssa_temp_index())] =
+          value_representations_[def->vreg(1)] =
               RepresentationForRange(def->representation());
         }
       }
     } else if (auto join = block->AsJoinEntry()) {
       for (PhiIterator it(join); !it.Done(); it.Advance()) {
         PhiInstr* phi = it.Current();
-        ASSERT(phi != NULL && phi->ssa_temp_index() >= 0);
-        value_representations_[phi->ssa_temp_index()] =
+        ASSERT(phi != NULL && phi->vreg(0) >= 0);
+        value_representations_[phi->vreg(0)] =
             RepresentationForRange(phi->representation());
         if (phi->HasPairRepresentation()) {
-          value_representations_[ToSecondPairVreg(phi->ssa_temp_index())] =
+          value_representations_[phi->vreg(1)] =
               RepresentationForRange(phi->representation());
         }
       }
@@ -3131,12 +3107,12 @@
     for (ForwardInstructionIterator instr_it(block); !instr_it.Done();
          instr_it.Advance()) {
       Definition* def = instr_it.Current()->AsDefinition();
-      if ((def != NULL) && (def->ssa_temp_index() >= 0)) {
-        const intptr_t vreg = def->ssa_temp_index();
+      if ((def != NULL) && (def->vreg(0) >= 0)) {
+        const intptr_t vreg = def->vreg(0);
         value_representations_[vreg] =
             RepresentationForRange(def->representation());
         if (def->HasPairRepresentation()) {
-          value_representations_[ToSecondPairVreg(vreg)] =
+          value_representations_[def->vreg(1)] =
               RepresentationForRange(def->representation());
         }
       }
@@ -3290,10 +3266,10 @@
     if (FunctionEntryInstr* entry = block->AsFunctionEntry()) {
       for (auto defn : *entry->initial_definitions()) {
         if (auto param = defn->AsParameter()) {
-          const auto vreg = param->ssa_temp_index();
+          const auto vreg = param->vreg(0);
           fix_location_for(block, param, vreg, 0);
           if (param->HasPairRepresentation()) {
-            fix_location_for(block, param, ToSecondPairVreg(vreg),
+            fix_location_for(block, param, param->vreg(1),
                              /*pair_index=*/1);
           }
         }
diff --git a/runtime/vm/compiler/backend/linearscan.h b/runtime/vm/compiler/backend/linearscan.h
index ea3fb9c..b165d32 100644
--- a/runtime/vm/compiler/backend/linearscan.h
+++ b/runtime/vm/compiler/backend/linearscan.h
@@ -39,8 +39,7 @@
 class SSALivenessAnalysis : public LivenessAnalysis {
  public:
   explicit SSALivenessAnalysis(const FlowGraph& flow_graph)
-      : LivenessAnalysis(flow_graph.max_virtual_register_number(),
-                         flow_graph.postorder()),
+      : LivenessAnalysis(flow_graph.max_vreg(), flow_graph.postorder()),
         graph_entry_(flow_graph.graph_entry()) {}
 
  private:
diff --git a/runtime/vm/compiler/backend/locations.h b/runtime/vm/compiler/backend/locations.h
index 2c59183..aabd12a 100644
--- a/runtime/vm/compiler/backend/locations.h
+++ b/runtime/vm/compiler/backend/locations.h
@@ -66,6 +66,19 @@
       kNumRepresentations
 };
 
+static const intptr_t kMaxLocationCount = 2;
+
+inline intptr_t LocationCount(Representation rep) {
+  switch (rep) {
+    case kPairOfTagged:
+      return 2;
+    case kUnboxedInt64:
+      return compiler::target::kWordSize == 8 ? 1 : 2;
+    default:
+      return 1;
+  }
+}
+
 struct RepresentationUtils : AllStatic {
   // Whether the representation is for a type of unboxed integer.
   static bool IsUnboxedInteger(Representation rep);
diff --git a/runtime/vm/compiler/backend/redundancy_elimination.cc b/runtime/vm/compiler/backend/redundancy_elimination.cc
index 5edf25f..eb1b922 100644
--- a/runtime/vm/compiler/backend/redundancy_elimination.cc
+++ b/runtime/vm/compiler/backend/redundancy_elimination.cc
@@ -2611,7 +2611,7 @@
       replacement->AddInputUse(input);
     }
 
-    graph_->AllocateSSAIndexes(phi);
+    graph_->AllocateSSAIndex(phi);
     phis_.Add(phi);  // Postpone phi insertion until after load forwarding.
 
     if (FLAG_support_il_printer && FLAG_trace_load_optimization) {
@@ -4259,10 +4259,7 @@
         ConstantInstr* orig = cdefs[j]->AsConstant();
         ConstantInstr* copy =
             new (flow_graph_->zone()) ConstantInstr(orig->value());
-        copy->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index());
-        if (FlowGraph::NeedsPairLocation(copy->representation())) {
-          flow_graph_->alloc_ssa_temp_index();
-        }
+        flow_graph_->AllocateSSAIndex(copy);
         old->ReplaceUsesWith(copy);
         copy->set_previous(old->previous());  // partial link
         (*idefs)[j] = copy;
diff --git a/runtime/vm/compiler/backend/type_propagator.cc b/runtime/vm/compiler/backend/type_propagator.cc
index 02ef88e..30e332c 100644
--- a/runtime/vm/compiler/backend/type_propagator.cc
+++ b/runtime/vm/compiler/backend/type_propagator.cc
@@ -286,7 +286,7 @@
     // motion of the check may still enable valid code motion
     // of the checked code.
     if (check->ssa_temp_index() == -1) {
-      flow_graph_->AllocateSSAIndexes(check);
+      flow_graph_->AllocateSSAIndex(check);
       GrowTypes(check->ssa_temp_index() + 1);
     }
     FlowGraph::RenameDominatedUses(receiver, check, check);
@@ -370,7 +370,7 @@
   auto defn = check->value()->definition();
   SetTypeOf(defn, new (zone()) CompileType(check->ComputeType()));
   if (check->ssa_temp_index() == -1) {
-    flow_graph_->AllocateSSAIndexes(check);
+    flow_graph_->AllocateSSAIndex(check);
     GrowTypes(check->ssa_temp_index() + 1);
   }
   FlowGraph::RenameDominatedUses(defn, check, check);
diff --git a/runtime/vm/compiler/frontend/flow_graph_builder.cc b/runtime/vm/compiler/frontend/flow_graph_builder.cc
index 8b7a394..110dbc0 100644
--- a/runtime/vm/compiler/frontend/flow_graph_builder.cc
+++ b/runtime/vm/compiler/frontend/flow_graph_builder.cc
@@ -41,13 +41,13 @@
   COMPILER_TIMINGS_TIMER_SCOPE(callee_graph->thread(), PrepareGraphs);
   ASSERT(callee_graph->graph_entry()->SuccessorCount() == 1);
   ASSERT(callee_graph->max_block_id() > caller_graph_->max_block_id());
-  ASSERT(callee_graph->max_virtual_register_number() >
-         caller_graph_->max_virtual_register_number());
+  ASSERT(callee_graph->current_ssa_temp_index() >
+         caller_graph_->current_ssa_temp_index());
 
   // Adjust the caller's maximum block id and current SSA temp index.
   caller_graph_->set_max_block_id(callee_graph->max_block_id());
   caller_graph_->set_current_ssa_temp_index(
-      callee_graph->max_virtual_register_number());
+      callee_graph->current_ssa_temp_index());
 
   // Attach the outer environment on each instruction in the callee graph.
   ASSERT(call_->env() != NULL);
@@ -218,7 +218,7 @@
     if (call_->HasUses()) {
       // Add a phi of the return values.
       PhiInstr* phi = new (Z) PhiInstr(join, num_exits);
-      caller_graph_->AllocateSSAIndexes(phi);
+      caller_graph_->AllocateSSAIndex(phi);
       phi->mark_alive();
       for (intptr_t i = 0; i < num_exits; ++i) {
         ReturnAt(i)->RemoveEnvironment();
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index 9fab3a3..b5fa0e5 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -437,6 +437,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 0d77869..f30f579 100644
--- a/runtime/vm/compiler/runtime_api.h
+++ b/runtime/vm/compiler/runtime_api.h
@@ -1249,6 +1249,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 fd7de86..098de96 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -320,13 +320,13 @@
     Thread_call_to_runtime_entry_point_offset = 296;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 896;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 904;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 872;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 900;
+    Thread_service_extension_stream_offset = 908;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 248;
@@ -370,7 +370,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     864;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 904;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 912;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -480,10 +480,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 856;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 860;
-static constexpr dart::compiler::target::word Thread_random_offset = 880;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 880;
+static constexpr dart::compiler::target::word Thread_random_offset = 888;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 348;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 888;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 896;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -982,13 +983,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1776;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1784;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1744;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1784;
+    Thread_service_extension_stream_offset = 1792;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -1033,7 +1034,7 @@
     1728;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -1144,10 +1145,11 @@
     1712;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1720;
-static constexpr dart::compiler::target::word Thread_random_offset = 1752;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1752;
+static constexpr dart::compiler::target::word Thread_random_offset = 1760;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1760;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1768;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -1645,13 +1647,13 @@
     Thread_call_to_runtime_entry_point_offset = 296;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 864;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 872;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 840;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 868;
+    Thread_service_extension_stream_offset = 876;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 248;
@@ -1695,7 +1697,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     832;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 872;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 880;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -1805,10 +1807,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 824;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 828;
-static constexpr dart::compiler::target::word Thread_random_offset = 848;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 848;
+static constexpr dart::compiler::target::word Thread_random_offset = 856;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 348;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 856;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 864;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -2304,13 +2307,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1840;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1848;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1808;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1848;
+    Thread_service_extension_stream_offset = 1856;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -2355,7 +2358,7 @@
     1792;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -2466,10 +2469,11 @@
     1776;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1784;
-static constexpr dart::compiler::target::word Thread_random_offset = 1816;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1816;
+static constexpr dart::compiler::target::word Thread_random_offset = 1824;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1824;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1832;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -2970,13 +2974,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1776;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1784;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1744;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1784;
+    Thread_service_extension_stream_offset = 1792;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -3021,7 +3025,7 @@
     1728;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -3132,10 +3136,11 @@
     1712;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1720;
-static constexpr dart::compiler::target::word Thread_random_offset = 1752;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1752;
+static constexpr dart::compiler::target::word Thread_random_offset = 1760;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1760;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1768;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -3635,13 +3640,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1840;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1848;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1808;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1848;
+    Thread_service_extension_stream_offset = 1856;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -3686,7 +3691,7 @@
     1792;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -3797,10 +3802,11 @@
     1776;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1784;
-static constexpr dart::compiler::target::word Thread_random_offset = 1816;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1816;
+static constexpr dart::compiler::target::word Thread_random_offset = 1824;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1824;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1832;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -4299,13 +4305,13 @@
     Thread_call_to_runtime_entry_point_offset = 296;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 936;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 944;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 912;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 940;
+    Thread_service_extension_stream_offset = 948;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 248;
@@ -4349,7 +4355,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     904;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 944;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 952;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -4459,10 +4465,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 896;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 900;
-static constexpr dart::compiler::target::word Thread_random_offset = 920;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 920;
+static constexpr dart::compiler::target::word Thread_random_offset = 928;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 348;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 928;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 936;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -4963,13 +4970,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1832;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1840;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1800;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1840;
+    Thread_service_extension_stream_offset = 1848;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -5014,7 +5021,7 @@
     1784;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1848;
+    1856;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -5125,10 +5132,11 @@
     1768;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1776;
-static constexpr dart::compiler::target::word Thread_random_offset = 1808;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1808;
+static constexpr dart::compiler::target::word Thread_random_offset = 1816;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1816;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1824;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -5621,13 +5629,13 @@
     Thread_call_to_runtime_entry_point_offset = 296;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 896;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 904;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 872;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 900;
+    Thread_service_extension_stream_offset = 908;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 248;
@@ -5671,7 +5679,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     864;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 904;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 912;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -5781,10 +5789,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 856;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 860;
-static constexpr dart::compiler::target::word Thread_random_offset = 880;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 880;
+static constexpr dart::compiler::target::word Thread_random_offset = 888;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 348;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 888;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 896;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -6275,13 +6284,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1776;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1784;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1744;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1784;
+    Thread_service_extension_stream_offset = 1792;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -6326,7 +6335,7 @@
     1728;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -6437,10 +6446,11 @@
     1712;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1720;
-static constexpr dart::compiler::target::word Thread_random_offset = 1752;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1752;
+static constexpr dart::compiler::target::word Thread_random_offset = 1760;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1760;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1768;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -6930,13 +6940,13 @@
     Thread_call_to_runtime_entry_point_offset = 296;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 864;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 872;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 840;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 868;
+    Thread_service_extension_stream_offset = 876;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 248;
@@ -6980,7 +6990,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     832;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 872;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 880;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -7090,10 +7100,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 824;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 828;
-static constexpr dart::compiler::target::word Thread_random_offset = 848;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 848;
+static constexpr dart::compiler::target::word Thread_random_offset = 856;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 348;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 856;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 864;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -7581,13 +7592,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1840;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1848;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1808;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1848;
+    Thread_service_extension_stream_offset = 1856;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -7632,7 +7643,7 @@
     1792;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -7743,10 +7754,11 @@
     1776;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1784;
-static constexpr dart::compiler::target::word Thread_random_offset = 1816;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1816;
+static constexpr dart::compiler::target::word Thread_random_offset = 1824;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1824;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1832;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -8239,13 +8251,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1776;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1784;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1744;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1784;
+    Thread_service_extension_stream_offset = 1792;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -8290,7 +8302,7 @@
     1728;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -8401,10 +8413,11 @@
     1712;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1720;
-static constexpr dart::compiler::target::word Thread_random_offset = 1752;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1752;
+static constexpr dart::compiler::target::word Thread_random_offset = 1760;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1760;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1768;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -8896,13 +8909,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1840;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1848;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1808;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1848;
+    Thread_service_extension_stream_offset = 1856;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -8947,7 +8960,7 @@
     1792;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -9058,10 +9071,11 @@
     1776;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1784;
-static constexpr dart::compiler::target::word Thread_random_offset = 1816;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1816;
+static constexpr dart::compiler::target::word Thread_random_offset = 1824;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1824;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1832;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -9552,13 +9566,13 @@
     Thread_call_to_runtime_entry_point_offset = 296;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 140;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 936;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 944;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 44;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 912;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 940;
+    Thread_service_extension_stream_offset = 948;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 248;
@@ -9602,7 +9616,7 @@
 static constexpr dart::compiler::target::word Thread_exit_through_ffi_offset =
     904;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 40;
-static constexpr dart::compiler::target::word Thread_isolate_group_offset = 944;
+static constexpr dart::compiler::target::word Thread_isolate_group_offset = 952;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     64;
 static constexpr dart::compiler::target::word
@@ -9712,10 +9726,11 @@
 static constexpr dart::compiler::target::word Thread_callback_code_offset = 896;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 900;
-static constexpr dart::compiler::target::word Thread_random_offset = 920;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 920;
+static constexpr dart::compiler::target::word Thread_random_offset = 928;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 348;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 928;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 936;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -10208,13 +10223,13 @@
     Thread_call_to_runtime_entry_point_offset = 568;
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1832;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1840;
 static constexpr dart::compiler::target::word
     Thread_dispatch_table_array_offset = 88;
 static constexpr dart::compiler::target::word
     Thread_double_truncate_round_supported_offset = 1800;
 static constexpr dart::compiler::target::word
-    Thread_service_extension_stream_offset = 1840;
+    Thread_service_extension_stream_offset = 1848;
 static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 472;
@@ -10259,7 +10274,7 @@
     1784;
 static constexpr dart::compiler::target::word Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word Thread_isolate_group_offset =
-    1848;
+    1856;
 static constexpr dart::compiler::target::word Thread_field_table_values_offset =
     128;
 static constexpr dart::compiler::target::word
@@ -10370,10 +10385,11 @@
     1768;
 static constexpr dart::compiler::target::word
     Thread_callback_stack_return_offset = 1776;
-static constexpr dart::compiler::target::word Thread_random_offset = 1808;
+static constexpr dart::compiler::target::word Thread_next_task_id_offset = 1808;
+static constexpr dart::compiler::target::word Thread_random_offset = 1816;
 static constexpr dart::compiler::target::word
     Thread_jump_to_frame_entry_point_offset = 672;
-static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1816;
+static constexpr dart::compiler::target::word Thread_tsan_utils_offset = 1824;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_function_offset =
     0;
 static constexpr dart::compiler::target::word TsanUtils_setjmp_buffer_offset =
@@ -10904,13 +10920,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 =
-    896;
+    904;
 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 = 872;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 900;
+    AOT_Thread_service_extension_stream_offset = 908;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -10956,7 +10972,7 @@
     AOT_Thread_exit_through_ffi_offset = 864;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 40;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    904;
+    912;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 64;
 static constexpr dart::compiler::target::word
@@ -11073,11 +11089,13 @@
     856;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 860;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 880;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    880;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 888;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 348;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    888;
+    896;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -11638,13 +11656,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 =
-    1776;
+    1784;
 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 = 1744;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1784;
+    AOT_Thread_service_extension_stream_offset = 1792;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -11690,7 +11708,7 @@
     AOT_Thread_exit_through_ffi_offset = 1728;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -11808,11 +11826,13 @@
     1712;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1720;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1752;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1752;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1760;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1760;
+    1768;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -12378,13 +12398,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 =
-    1840;
+    1848;
 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 = 1808;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1848;
+    AOT_Thread_service_extension_stream_offset = 1856;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -12430,7 +12450,7 @@
     AOT_Thread_exit_through_ffi_offset = 1792;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -12548,11 +12568,13 @@
     1776;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1784;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1816;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1816;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1824;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1824;
+    1832;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -13115,13 +13137,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 =
-    1776;
+    1784;
 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 = 1744;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1784;
+    AOT_Thread_service_extension_stream_offset = 1792;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -13167,7 +13189,7 @@
     AOT_Thread_exit_through_ffi_offset = 1728;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -13285,11 +13307,13 @@
     1712;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1720;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1752;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1752;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1760;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1760;
+    1768;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -13851,13 +13875,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 =
-    1840;
+    1848;
 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 = 1808;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1848;
+    AOT_Thread_service_extension_stream_offset = 1856;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -13903,7 +13927,7 @@
     AOT_Thread_exit_through_ffi_offset = 1792;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -14021,11 +14045,13 @@
     1776;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1784;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1816;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1816;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1824;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1824;
+    1832;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -14588,13 +14614,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 =
-    936;
+    944;
 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 = 912;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 940;
+    AOT_Thread_service_extension_stream_offset = 948;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -14640,7 +14666,7 @@
     AOT_Thread_exit_through_ffi_offset = 904;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 40;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    944;
+    952;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 64;
 static constexpr dart::compiler::target::word
@@ -14757,11 +14783,13 @@
     896;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 900;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 920;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    920;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 928;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 348;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    928;
+    936;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -15324,13 +15352,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 =
-    1832;
+    1840;
 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 = 1800;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1840;
+    AOT_Thread_service_extension_stream_offset = 1848;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -15376,7 +15404,7 @@
     AOT_Thread_exit_through_ffi_offset = 1784;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1848;
+    1856;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -15494,11 +15522,13 @@
     1768;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1776;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1808;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1808;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1816;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1816;
+    1824;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -16054,13 +16084,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 =
-    896;
+    904;
 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 = 872;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 900;
+    AOT_Thread_service_extension_stream_offset = 908;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -16106,7 +16136,7 @@
     AOT_Thread_exit_through_ffi_offset = 864;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 40;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    904;
+    912;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 64;
 static constexpr dart::compiler::target::word
@@ -16223,11 +16253,13 @@
     856;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 860;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 880;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    880;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 888;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 348;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    888;
+    896;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -16779,13 +16811,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 =
-    1776;
+    1784;
 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 = 1744;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1784;
+    AOT_Thread_service_extension_stream_offset = 1792;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -16831,7 +16863,7 @@
     AOT_Thread_exit_through_ffi_offset = 1728;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -16949,11 +16981,13 @@
     1712;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1720;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1752;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1752;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1760;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1760;
+    1768;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -17510,13 +17544,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 =
-    1840;
+    1848;
 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 = 1808;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1848;
+    AOT_Thread_service_extension_stream_offset = 1856;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -17562,7 +17596,7 @@
     AOT_Thread_exit_through_ffi_offset = 1792;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -17680,11 +17714,13 @@
     1776;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1784;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1816;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1816;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1824;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1824;
+    1832;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -18238,13 +18274,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 =
-    1776;
+    1784;
 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 = 1744;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1784;
+    AOT_Thread_service_extension_stream_offset = 1792;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -18290,7 +18326,7 @@
     AOT_Thread_exit_through_ffi_offset = 1728;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1792;
+    1800;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -18408,11 +18444,13 @@
     1712;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1720;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1752;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1752;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1760;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1760;
+    1768;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -18965,13 +19003,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 =
-    1840;
+    1848;
 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 = 1808;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1848;
+    AOT_Thread_service_extension_stream_offset = 1856;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -19017,7 +19055,7 @@
     AOT_Thread_exit_through_ffi_offset = 1792;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1856;
+    1864;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -19135,11 +19173,13 @@
     1776;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1784;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1816;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1816;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1824;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1824;
+    1832;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -19693,13 +19733,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 =
-    936;
+    944;
 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 = 912;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 940;
+    AOT_Thread_service_extension_stream_offset = 948;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     336;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -19745,7 +19785,7 @@
     AOT_Thread_exit_through_ffi_offset = 904;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 40;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    944;
+    952;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 64;
 static constexpr dart::compiler::target::word
@@ -19862,11 +19902,13 @@
     896;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 900;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 920;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    920;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 928;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 348;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    928;
+    936;
 static constexpr dart::compiler::target::word
     AOT_TsanUtils_setjmp_function_offset = 0;
 static constexpr dart::compiler::target::word
@@ -20420,13 +20462,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 =
-    1832;
+    1840;
 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 = 1800;
 static constexpr dart::compiler::target::word
-    AOT_Thread_service_extension_stream_offset = 1840;
+    AOT_Thread_service_extension_stream_offset = 1848;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
     648;
 static constexpr dart::compiler::target::word AOT_Thread_optimize_stub_offset =
@@ -20472,7 +20514,7 @@
     AOT_Thread_exit_through_ffi_offset = 1784;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_offset = 80;
 static constexpr dart::compiler::target::word AOT_Thread_isolate_group_offset =
-    1848;
+    1856;
 static constexpr dart::compiler::target::word
     AOT_Thread_field_table_values_offset = 128;
 static constexpr dart::compiler::target::word
@@ -20590,11 +20632,13 @@
     1768;
 static constexpr dart::compiler::target::word
     AOT_Thread_callback_stack_return_offset = 1776;
-static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1808;
+static constexpr dart::compiler::target::word AOT_Thread_next_task_id_offset =
+    1808;
+static constexpr dart::compiler::target::word AOT_Thread_random_offset = 1816;
 static constexpr dart::compiler::target::word
     AOT_Thread_jump_to_frame_entry_point_offset = 672;
 static constexpr dart::compiler::target::word AOT_Thread_tsan_utils_offset =
-    1816;
+    1824;
 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 e1cd318..b651415 100644
--- a/runtime/vm/compiler/runtime_offsets_list.h
+++ b/runtime/vm/compiler/runtime_offsets_list.h
@@ -318,6 +318,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 32954d6..368fab3 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -6361,10 +6361,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 df80a86..bbda502 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -1094,6 +1094,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_); }
 
@@ -1207,6 +1211,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 729dc22..a8f6c4e 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 05db6d6..d8439cc 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 768d7f6..497c25a 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 18
 PATCH 0
-PRERELEASE 284
+PRERELEASE 285
 PRERELEASE_PATCH 0
\ No newline at end of file