mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Revert part of "[vm] Allow sharing of deeply immutable lists across isolates"
It did have noticable xx% performance regression on ListCopy.List.int.unmodifiable.100 TEST=ci Issue https://github.com/dart-lang/sdk/issues/51334 Change-Id: I160d7cc98aee2e064b1767519f4b5033656ee115 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282400 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
parent
1afb59f8ec
commit
fae934c4b1
|
@ -90,17 +90,6 @@ DEFINE_NATIVE_ENTRY(Internal_makeListFixedLength, 0, 1) {
|
|||
DEFINE_NATIVE_ENTRY(Internal_makeFixedListUnmodifiable, 0, 1) {
|
||||
GET_NON_NULL_NATIVE_ARGUMENT(Array, array, arguments->NativeArgAt(0));
|
||||
array.MakeImmutable();
|
||||
const intptr_t len = array.Length();
|
||||
bool is_deeply_immutable = true;
|
||||
for (intptr_t i = 0; i < len; ++i) {
|
||||
if (!CanShareObjectAcrossIsolates(array.At(i))) {
|
||||
is_deeply_immutable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_deeply_immutable) {
|
||||
array.SetImmutable();
|
||||
}
|
||||
return array.ptr();
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,6 @@ class SendReceiveTest extends SendReceiveTestBase {
|
|||
await testSharable2();
|
||||
await testCopyableClosures();
|
||||
await testSharableTypedData();
|
||||
await testUnmodifiableList();
|
||||
}
|
||||
|
||||
Future testSharable() async {
|
||||
|
@ -177,35 +176,6 @@ class SendReceiveTest extends SendReceiveTestBase {
|
|||
|
||||
malloc.free(bytes);
|
||||
}
|
||||
|
||||
Future testUnmodifiableList() async {
|
||||
print('testUnmodifiableList');
|
||||
|
||||
// Sharable.
|
||||
for (final sharable in [
|
||||
1,
|
||||
const Object(),
|
||||
'foo',
|
||||
List.unmodifiable([const Object()])
|
||||
]) {
|
||||
final list = List.unmodifiable([sharable]);
|
||||
final listCopy = await sendReceive(list);
|
||||
Expect.identical(list, listCopy);
|
||||
}
|
||||
|
||||
// Non-Sharable.
|
||||
for (final nonSharable in [
|
||||
Object(),
|
||||
[],
|
||||
{},
|
||||
List.unmodifiable([Object()])
|
||||
]) {
|
||||
final list = List.unmodifiable([nonSharable]);
|
||||
final listCopy = await sendReceive(list);
|
||||
Expect.notIdentical(list, listCopy);
|
||||
Expect.notIdentical(list[0], listCopy[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main() async {
|
||||
|
|
|
@ -111,7 +111,6 @@ class SendReceiveTest extends SendReceiveTestBase {
|
|||
await testSharable();
|
||||
await testSharable2();
|
||||
await testCopyableClosures();
|
||||
await testUnmodifiableList();
|
||||
}
|
||||
|
||||
Future testSharable() async {
|
||||
|
@ -159,35 +158,6 @@ class SendReceiveTest extends SendReceiveTestBase {
|
|||
Expect.equals(copyableClosures[i].runtimeType, copy2[i].runtimeType);
|
||||
}
|
||||
}
|
||||
|
||||
Future testUnmodifiableList() async {
|
||||
print('testUnmodifiableList');
|
||||
|
||||
// Sharable.
|
||||
for (final sharable in [
|
||||
1,
|
||||
const Object(),
|
||||
'foo',
|
||||
List.unmodifiable([const Object()])
|
||||
]) {
|
||||
final list = List.unmodifiable([sharable]);
|
||||
final listCopy = await sendReceive(list);
|
||||
Expect.identical(list, listCopy);
|
||||
}
|
||||
|
||||
// Non-Sharable.
|
||||
for (final nonSharable in [
|
||||
Object(),
|
||||
[],
|
||||
{},
|
||||
List.unmodifiable([Object()])
|
||||
]) {
|
||||
final list = List.unmodifiable([nonSharable]);
|
||||
final listCopy = await sendReceive(list);
|
||||
Expect.notIdentical(list, listCopy);
|
||||
Expect.notIdentical(list[0], listCopy[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main() async {
|
||||
|
|
Loading…
Reference in a new issue