Version 2.15.0-34.0.dev

Merge commit '0201d761542226cf215e6f8e98ebe38e788f200f' into 'dev'
diff --git a/pkg/front_end/lib/src/fasta/scope.dart b/pkg/front_end/lib/src/fasta/scope.dart
index 34849e8..a04098c 100644
--- a/pkg/front_end/lib/src/fasta/scope.dart
+++ b/pkg/front_end/lib/src/fasta/scope.dart
@@ -343,7 +343,7 @@
         isModifiable: true);
   }
 
-  void recordUse(String name, int charOffset, Uri fileUri) {
+  void recordUse(String name, int charOffset) {
     if (isModifiable) {
       usedNames ??= <String, int>{};
       // Don't use putIfAbsent to avoid the context allocation needed
@@ -371,7 +371,7 @@
 
   Builder? lookup(String name, int charOffset, Uri fileUri,
       {bool isInstanceScope: true}) {
-    recordUse(name, charOffset, fileUri);
+    recordUse(name, charOffset);
     Builder? builder =
         lookupIn(name, charOffset, fileUri, _local, isInstanceScope);
     if (builder != null) return builder;
@@ -388,7 +388,7 @@
 
   Builder? lookupSetter(String name, int charOffset, Uri fileUri,
       {bool isInstanceScope: true}) {
-    recordUse(name, charOffset, fileUri);
+    recordUse(name, charOffset);
     Builder? builder =
         lookupIn(name, charOffset, fileUri, _setters, isInstanceScope);
     if (builder != null) return builder;
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index aa86706..5b0bb2f 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -107,6 +107,9 @@
 
   const Dart_Port destination_port_id = port.Id();
   const bool can_send_any_object = isolate->origin_id() == port.origin_id();
+  // We have to check whether the reciever has the same isolate group (e.g.
+  // native message handlers such as an IOService handler does not but does
+  // share the same origin port).
   const bool same_group =
       FLAG_enable_isolate_groups && PortMap::IsReceiverInThisIsolateGroup(
                                         destination_port_id, isolate->group());
@@ -840,7 +843,7 @@
   return result;
 }
 
-DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 0, 11) {
+DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 0, 10) {
   GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
   GET_NON_NULL_NATIVE_ARGUMENT(String, script_uri, arguments->NativeArgAt(1));
   GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(2));
@@ -850,8 +853,7 @@
   GET_NATIVE_ARGUMENT(SendPort, onExit, arguments->NativeArgAt(6));
   GET_NATIVE_ARGUMENT(SendPort, onError, arguments->NativeArgAt(7));
   GET_NATIVE_ARGUMENT(String, packageConfig, arguments->NativeArgAt(8));
-  GET_NATIVE_ARGUMENT(Bool, newIsolateGroup, arguments->NativeArgAt(9));
-  GET_NATIVE_ARGUMENT(String, debugName, arguments->NativeArgAt(10));
+  GET_NATIVE_ARGUMENT(String, debugName, arguments->NativeArgAt(9));
 
   if (closure.IsClosure()) {
     Function& func = Function::Handle();
@@ -868,15 +870,14 @@
       bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
       Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
       Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
-      const bool in_new_isolate_group = newIsolateGroup.value();
 
       // We first try to serialize the message.  In case the message is not
       // serializable this will throw an exception.
       SerializedObjectBuffer message_buffer;
       message_buffer.set_message(WriteMessage(
           /* can_send_any_object */ true,
-          /* same_group */ FLAG_enable_isolate_groups && !in_new_isolate_group,
-          message, ILLEGAL_PORT, Message::kNormalPriority));
+          /* same_group */ FLAG_enable_isolate_groups, message, ILLEGAL_PORT,
+          Message::kNormalPriority));
 
       const char* utf8_package_config =
           packageConfig.IsNull() ? NULL : String2UTF8(packageConfig);
@@ -886,8 +887,7 @@
       std::unique_ptr<IsolateSpawnState> state(new IsolateSpawnState(
           port.Id(), isolate->origin_id(), String2UTF8(script_uri), func,
           &message_buffer, utf8_package_config, paused.value(), fatal_errors,
-          on_exit_port, on_error_port, utf8_debug_name,
-          in_new_isolate_group ? nullptr : isolate->group()));
+          on_exit_port, on_error_port, utf8_debug_name, isolate->group()));
 
       // Since this is a call to Isolate.spawn, copy the parent isolate's code.
       state->isolate_flags()->copy_parent_code = true;
diff --git a/runtime/tests/vm/dart/isolates/fibonacci_call_ig_test.dart b/runtime/tests/vm/dart/isolates/fibonacci_call_ig_test.dart
deleted file mode 100644
index 946cbf9..0000000
--- a/runtime/tests/vm/dart/isolates/fibonacci_call_ig_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// VMOptions=--enable-isolate-groups --disable-heap-verification
-
-import 'dart:isolate';
-
-import 'package:expect/expect.dart';
-
-import 'internal.dart';
-import 'test_utils.dart';
-
-main(args) async {
-  // We don't run this test in our artificial hot reload mode, because it would
-  // create too many threads during the reload (one per isolate), which can
-  // cause this test or other concurrently executing tests to Crash due to
-  // unability of `pthread_create` to create a new thread.
-  if (isArtificialReloadMode) return;
-
-  final rp = ReceivePort();
-  final int n = 18;
-  await spawnInDetachedGroup(fibonacciRecursive, [rp.sendPort, n]);
-  Expect.equals(4181, await rp.first);
-}
diff --git a/runtime/tests/vm/dart/isolates/internal.dart b/runtime/tests/vm/dart/isolates/internal.dart
index 0d63ccc..ec854b0 100644
--- a/runtime/tests/vm/dart/isolates/internal.dart
+++ b/runtime/tests/vm/dart/isolates/internal.dart
@@ -7,78 +7,6 @@
 import 'dart:async';
 import 'dart:_internal' as dart_internal;
 
-/// Similar to `Isolate.spawn<T>()` but supports `newIsolateGroup`.
-Future<Isolate> internalSpawn<T>(void entryPoint(T message), T message,
-    {SendPort? onExit,
-    SendPort? onError,
-    bool newIsolateGroup = false,
-    String? debugName}) async {
-  final packageConfig = null;
-  final paused = false;
-  final bool errorsAreFatal = true;
-  final readyPort = new RawReceivePort();
-  try {
-    dart_internal.spawnFunction(
-        readyPort.sendPort,
-        Platform.script.toString(),
-        entryPoint,
-        message,
-        paused,
-        errorsAreFatal,
-        onExit,
-        onError,
-        packageConfig,
-        newIsolateGroup,
-        debugName);
-    return await _spawnCommon(readyPort);
-  } catch (e, st) {
-    readyPort.close();
-    return await new Future<Isolate>.error(e, st);
-  }
-}
-
-/// A copy of `dart:isolate`s internal `Isolate._spawnCommon()`.
-Future<Isolate> _spawnCommon(RawReceivePort readyPort) {
-  final completer = new Completer<Isolate>.sync();
-  readyPort.handler = (readyMessage) {
-    readyPort.close();
-    if (readyMessage is List && readyMessage.length == 2) {
-      SendPort controlPort = readyMessage[0];
-      List capabilities = readyMessage[1];
-      completer.complete(new Isolate(controlPort,
-          pauseCapability: capabilities[0],
-          terminateCapability: capabilities[1]));
-    } else if (readyMessage is String) {
-      // We encountered an error while starting the new isolate.
-      completer.completeError(new IsolateSpawnException(
-          'Unable to spawn isolate: ${readyMessage}'));
-    } else {
-      // This shouldn't happen.
-      completer.completeError(new IsolateSpawnException(
-          "Internal error: unexpected format for ready message: "
-          "'${readyMessage}'"));
-    }
-  };
-  return completer.future;
-}
-
-/// Spawns the [staticClosure] in a detached isolate group.
-Future<Isolate> spawnInDetachedGroup<T>(
-    void staticClosure(T message), T message,
-    {SendPort? onExit, SendPort? onError}) {
-  return _IG0([staticClosure, message]);
-}
-
-// This is the isolate group of "main". We spawn another one.
-_IG0(args) => internalSpawn(_IG1, args, newIsolateGroup: true);
-
-// This is an intermediate isolate group. The actual code we run in a new IG and
-// this one will die.
-_IG1(args) => internalSpawn(_IG2, args, newIsolateGroup: true);
-
-// Run the actual code
-_IG2(args) => args[0](args[1]);
-
 extension SendPortSendAndExit on SendPort {
   void sendAndExit(var message) {
     dart_internal.sendAndExit(this, message);
diff --git a/runtime/tests/vm/dart/isolates/sum_recursive_call_ig_test.dart b/runtime/tests/vm/dart/isolates/sum_recursive_call_ig_test.dart
deleted file mode 100644
index 915c102..0000000
--- a/runtime/tests/vm/dart/isolates/sum_recursive_call_ig_test.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// VMOptions=--enable-isolate-groups --disable-heap-verification
-
-import 'dart:isolate';
-
-import 'package:expect/expect.dart';
-
-import 'internal.dart';
-import 'test_utils.dart';
-
-main(args) async {
-  final rp = ReceivePort();
-  final int count = (isDebugMode || isSimulator) ? 100 : (10 * 1000);
-  await spawnInDetachedGroup(sumRecursive, [rp.sendPort, count]);
-  Expect.equals(count, await rp.first);
-}
diff --git a/runtime/tests/vm/dart/isolates/sum_recursive_tail_call_ig_test.dart b/runtime/tests/vm/dart/isolates/sum_recursive_tail_call_ig_test.dart
deleted file mode 100644
index a3fb967..0000000
--- a/runtime/tests/vm/dart/isolates/sum_recursive_tail_call_ig_test.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// VMOptions=--enable-isolate-groups --disable-heap-verification
-
-import 'dart:isolate';
-
-import 'package:expect/expect.dart';
-
-import 'internal.dart';
-import 'test_utils.dart';
-
-main(args) async {
-  final rp = ReceivePort();
-  final int count = (isDebugMode || isSimulator) ? 100 : (10 * 1000);
-  await spawnInDetachedGroup(sumRecursiveTailCall, [rp.sendPort, count, 0]);
-  Expect.equals(count, await rp.first);
-}
diff --git a/runtime/tests/vm/dart_2/isolates/fibonacci_call_ig_test.dart b/runtime/tests/vm/dart_2/isolates/fibonacci_call_ig_test.dart
deleted file mode 100644
index 5fcd026..0000000
--- a/runtime/tests/vm/dart_2/isolates/fibonacci_call_ig_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// @dart = 2.9
-
-// VMOptions=--enable-isolate-groups --disable-heap-verification
-
-import 'dart:isolate';
-
-import 'package:expect/expect.dart';
-
-import 'internal.dart';
-import 'test_utils.dart';
-
-main(args) async {
-  // We don't run this test in our artificial hot reload mode, because it would
-  // create too many threads during the reload (one per isolate), which can
-  // cause this test or other concurrently executing tests to Crash due to
-  // unability of `pthread_create` to create a new thread.
-  if (isArtificialReloadMode) return;
-
-  final rp = ReceivePort();
-  final int n = 18;
-  await spawnInDetachedGroup(fibonacciRecursive, [rp.sendPort, n]);
-  Expect.equals(4181, await rp.first);
-}
diff --git a/runtime/tests/vm/dart_2/isolates/internal.dart b/runtime/tests/vm/dart_2/isolates/internal.dart
index 9e9a3e4..1742a43 100644
--- a/runtime/tests/vm/dart_2/isolates/internal.dart
+++ b/runtime/tests/vm/dart_2/isolates/internal.dart
@@ -9,79 +9,6 @@
 import 'dart:async';
 import 'dart:_internal' as dart_internal;
 
-/// Similar to `Isolate.spawn<T>()` but supports `newIsolateGroup`.
-Future<Isolate> internalSpawn<T>(void entryPoint(T message), T message,
-    {SendPort onExit,
-    SendPort onError,
-    bool newIsolateGroup,
-    String debugName}) async {
-  newIsolateGroup ??= false;
-  final packageConfig = null;
-  final paused = false;
-  final bool errorsAreFatal = null;
-  final readyPort = new RawReceivePort();
-  try {
-    dart_internal.spawnFunction(
-        readyPort.sendPort,
-        Platform.script.toString(),
-        entryPoint,
-        message,
-        paused,
-        errorsAreFatal,
-        onExit,
-        onError,
-        packageConfig,
-        newIsolateGroup,
-        debugName);
-    return await _spawnCommon(readyPort);
-  } catch (e, st) {
-    readyPort.close();
-    return await new Future<Isolate>.error(e, st);
-  }
-}
-
-/// A copy of `dart:isolate`s internal `Isolate._spawnCommon()`.
-Future<Isolate> _spawnCommon(RawReceivePort readyPort) {
-  final completer = new Completer<Isolate>.sync();
-  readyPort.handler = (readyMessage) {
-    readyPort.close();
-    if (readyMessage is List && readyMessage.length == 2) {
-      SendPort controlPort = readyMessage[0];
-      List capabilities = readyMessage[1];
-      completer.complete(new Isolate(controlPort,
-          pauseCapability: capabilities[0],
-          terminateCapability: capabilities[1]));
-    } else if (readyMessage is String) {
-      // We encountered an error while starting the new isolate.
-      completer.completeError(new IsolateSpawnException(
-          'Unable to spawn isolate: ${readyMessage}'));
-    } else {
-      // This shouldn't happen.
-      completer.completeError(new IsolateSpawnException(
-          "Internal error: unexpected format for ready message: "
-          "'${readyMessage}'"));
-    }
-  };
-  return completer.future;
-}
-
-/// Spawns the [staticClosure] in a detached isolate group.
-Future<Isolate> spawnInDetachedGroup<T>(
-    void staticClosure(T message), T message,
-    {SendPort onExit, SendPort onError}) async {
-  _IG0([staticClosure, message]);
-}
-
-// This is the isolate group of "main". We spawn another one.
-_IG0(args) => internalSpawn(_IG1, args, newIsolateGroup: true);
-
-// This is an intermediate isolate group. The actual code we run in a new IG and
-// this one will die.
-_IG1(args) => internalSpawn(_IG2, args, newIsolateGroup: true);
-
-// Run the actual code
-_IG2(args) => args[0](args[1]);
-
 extension SendPortSendAndExit on SendPort {
   void sendAndExit(var message) {
     dart_internal.sendAndExit(this, message);
diff --git a/runtime/tests/vm/dart_2/isolates/sum_recursive_call_ig_test.dart b/runtime/tests/vm/dart_2/isolates/sum_recursive_call_ig_test.dart
deleted file mode 100644
index 177709f..0000000
--- a/runtime/tests/vm/dart_2/isolates/sum_recursive_call_ig_test.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// @dart = 2.9
-
-// VMOptions=--enable-isolate-groups --disable-heap-verification
-
-import 'dart:isolate';
-
-import 'package:expect/expect.dart';
-
-import 'internal.dart';
-import 'test_utils.dart';
-
-main(args) async {
-  final rp = ReceivePort();
-  final int count = (isDebugMode || isSimulator) ? 100 : (10 * 1000);
-  await spawnInDetachedGroup(sumRecursive, [rp.sendPort, count]);
-  Expect.equals(count, await rp.first);
-}
diff --git a/runtime/tests/vm/dart_2/isolates/sum_recursive_tail_call_ig_test.dart b/runtime/tests/vm/dart_2/isolates/sum_recursive_tail_call_ig_test.dart
deleted file mode 100644
index be48915..0000000
--- a/runtime/tests/vm/dart_2/isolates/sum_recursive_tail_call_ig_test.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// @dart = 2.9
-
-// VMOptions=--enable-isolate-groups --disable-heap-verification
-
-import 'dart:isolate';
-
-import 'package:expect/expect.dart';
-
-import 'internal.dart';
-import 'test_utils.dart';
-
-main(args) async {
-  final rp = ReceivePort();
-  final int count = (isDebugMode || isSimulator) ? 100 : (10 * 1000);
-  await spawnInDetachedGroup(sumRecursiveTailCall, [rp.sendPort, count, 0]);
-  Expect.equals(count, await rp.first);
-}
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index c8f50e2..717040f 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -316,7 +316,7 @@
   V(Int32x4_setFlagZ, 2)                                                       \
   V(Int32x4_setFlagW, 2)                                                       \
   V(Int32x4_select, 3)                                                         \
-  V(Isolate_spawnFunction, 11)                                                 \
+  V(Isolate_spawnFunction, 10)                                                 \
   V(Isolate_spawnUri, 12)                                                      \
   V(Isolate_getPortAndCapabilitiesOfCurrentIsolate, 0)                         \
   V(Isolate_getCurrentRootUriStr, 0)                                           \
diff --git a/sdk/lib/_internal/vm/lib/internal_patch.dart b/sdk/lib/_internal/vm/lib/internal_patch.dart
index 67501fb..e71c95f 100644
--- a/sdk/lib/_internal/vm/lib/internal_patch.dart
+++ b/sdk/lib/_internal/vm/lib/internal_patch.dart
@@ -176,19 +176,6 @@
 void sendAndExit(SendPort sendPort, var message)
     native "SendPortImpl_sendAndExitInternal_";
 
-void spawnFunction(
-    SendPort readyPort,
-    String uri,
-    Function topLevelFunction,
-    var message,
-    bool paused,
-    bool errorsAreFatal,
-    SendPort? onExit,
-    SendPort? onError,
-    String? packageConfig,
-    bool newIsolateGroup,
-    String? debugName) native "Isolate_spawnFunction";
-
 // Collection of functions which should only be used for testing purposes.
 abstract class VMInternalsForTesting {
   // This function can be used by tests to enforce garbage collection.
diff --git a/sdk/lib/_internal/vm/lib/isolate_patch.dart b/sdk/lib/_internal/vm/lib/isolate_patch.dart
index 6d70c2f..519d188 100644
--- a/sdk/lib/_internal/vm/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/vm/lib/isolate_patch.dart
@@ -14,7 +14,6 @@
 
 import "dart:collection" show HashMap;
 import "dart:typed_data" show ByteBuffer, TypedData, Uint8List;
-import "dart:_internal" show spawnFunction;
 
 /// These are the additional parts of this patch library:
 // part "timer_impl.dart";
@@ -360,22 +359,11 @@
       script = await Isolate.resolvePackageUri(script);
     }
 
-    const bool newIsolateGroup = false;
     final RawReceivePort readyPort =
         new RawReceivePort(null, 'Isolate.spawn ready');
     try {
-      spawnFunction(
-          readyPort.sendPort,
-          script.toString(),
-          entryPoint,
-          message,
-          paused,
-          errorsAreFatal,
-          onExit,
-          onError,
-          packageConfig,
-          newIsolateGroup,
-          debugName);
+      _spawnFunction(readyPort.sendPort, script.toString(), entryPoint, message,
+          paused, errorsAreFatal, onExit, onError, packageConfig, debugName);
       return await _spawnCommon(readyPort);
     } catch (e, st) {
       readyPort.close();
@@ -383,6 +371,18 @@
     }
   }
 
+  static void _spawnFunction(
+      SendPort readyPort,
+      String uri,
+      Function topLevelFunction,
+      var message,
+      bool paused,
+      bool errorsAreFatal,
+      SendPort? onExit,
+      SendPort? onError,
+      String? packageConfig,
+      String? debugName) native "Isolate_spawnFunction";
+
   @patch
   static Future<Isolate> spawnUri(Uri uri, List<String> args, var message,
       {bool paused = false,
diff --git a/tools/VERSION b/tools/VERSION
index 82414b5..7805954 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 15
 PATCH 0
-PRERELEASE 33
+PRERELEASE 34
 PRERELEASE_PATCH 0
\ No newline at end of file