mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 15:31:32 +00:00
627292bcc0
The JIT support has progressed and is no longer unstable. We'll therefore remove the experimental flag and rely on the same --enable-isolate-groups flag as in AOT mode. Issue https://github.com/dart-lang/sdk/issues/36097 TEST=Existing test suite. Change-Id: Iff0dd5b64d9b6ab91ad9ffc0ae445efc802d3908 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207122 Auto-Submit: Martin Kustermann <kustermann@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com> Commit-Queue: Slava Egorov <vegorov@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
97 lines
2.2 KiB
Dart
97 lines
2.2 KiB
Dart
// Copyright (c) 2019, 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
|
|
// VMOptions=--no-enable-isolate-groups
|
|
|
|
import "dart:async";
|
|
import "dart:isolate";
|
|
import "dart:typed_data";
|
|
import "package:expect/expect.dart";
|
|
|
|
const large = 1 << 30;
|
|
|
|
void child(replyPort) {
|
|
print("Child start");
|
|
|
|
print("Child Uint8List");
|
|
dynamic x = new Uint8List(large);
|
|
for (int i = 0; i < 4; i++) {
|
|
x[i] = i;
|
|
}
|
|
for (int i = x.length - 4; i < x.length; i++) {
|
|
x[i] = x.length - i;
|
|
}
|
|
replyPort.send(x);
|
|
x = null;
|
|
|
|
// Too slow.
|
|
// print("Child Array");
|
|
// x = new List(large);
|
|
// for (int i = 0; i < 4; i++) {
|
|
// x[i] = i;
|
|
// }
|
|
// replyPort.send(x);
|
|
// x = null;
|
|
|
|
print("Child OneByteString");
|
|
x = null;
|
|
x = "Z";
|
|
while (x.length < large) {
|
|
x = x * 2;
|
|
}
|
|
replyPort.send(x);
|
|
x = null;
|
|
|
|
print("Child done");
|
|
}
|
|
|
|
Future<void> main(List<String> args) async {
|
|
print("Parent start");
|
|
|
|
ReceivePort port = new ReceivePort();
|
|
Isolate.spawn(child, port.sendPort);
|
|
StreamIterator<dynamic> incoming = new StreamIterator<dynamic>(port);
|
|
|
|
print("Parent Uint8");
|
|
Expect.isTrue(await incoming.moveNext());
|
|
dynamic x = incoming.current;
|
|
Expect.isTrue(x is Uint8List);
|
|
Expect.equals(large, x.length);
|
|
for (int i = 0; i < 4; i++) {
|
|
Expect.equals(i, x[i]);
|
|
}
|
|
for (int i = x.length - 4; i < x.length; i++) {
|
|
Expect.equals(x.length - i, x[i]);
|
|
}
|
|
x = null;
|
|
|
|
// Too slow.
|
|
// print("Parent Array");
|
|
// Expect.isTrue(await incoming.moveNext());
|
|
// x = incoming.current;
|
|
// Expect.isTrue(x is List);
|
|
// Expect.equals(large, x.length);
|
|
// for (int i = 0; i < 4; i++) {
|
|
// Expect.equals(i, x[i]);
|
|
// }
|
|
// x = null;
|
|
|
|
print("Parent OneByteString");
|
|
Expect.isTrue(await incoming.moveNext());
|
|
x = incoming.current;
|
|
Expect.isTrue(x is String);
|
|
Expect.equals(large, x.length);
|
|
for (int i = 0; i < 4; i++) {
|
|
Expect.equals("Z", x[i]);
|
|
}
|
|
for (int i = x.length - 4; i < x.length; i++) {
|
|
Expect.equals("Z", x[i]);
|
|
}
|
|
x = null;
|
|
|
|
port.close();
|
|
print("Parent done");
|
|
}
|