mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
[vm] Const map, remove invalid assert
Isolates are allowed to race each other to initialize _indexNullable, the last isolate wins. See https://dart-review.googlesource.com/c/sdk/+/210726 and https://dart-review.googlesource.com/c/sdk/+/203765. These asserts were wrong, because another isolate could have initialized _indexNullable in between places calling _createIndex and _createIndex itself. Closes: https://github.com/dart-lang/sdk/issues/47118 Change-Id: I5d55b9715ef622737a6f70c0b57590076ece3225 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212586 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
bc1c71fd9b
commit
40bbb6dcc2
|
@ -248,8 +248,6 @@ class _InternalImmutableLinkedHashMap<K, V> extends _HashVMImmutableBase
|
||||||
}
|
}
|
||||||
|
|
||||||
void _createIndex() {
|
void _createIndex() {
|
||||||
assert(_indexNullable == null);
|
|
||||||
|
|
||||||
final size = max(_data.length, _HashBase._INITIAL_INDEX_SIZE);
|
final size = max(_data.length, _HashBase._INITIAL_INDEX_SIZE);
|
||||||
assert(size == _roundUpToPowerOfTwo(size));
|
assert(size == _roundUpToPowerOfTwo(size));
|
||||||
final newIndex = new Uint32List(size);
|
final newIndex = new Uint32List(size);
|
||||||
|
@ -827,8 +825,6 @@ class _CompactImmutableLinkedHashSet<E> extends _HashVMImmutableBase
|
||||||
}
|
}
|
||||||
|
|
||||||
void _createIndex() {
|
void _createIndex() {
|
||||||
assert(_indexNullable == null);
|
|
||||||
|
|
||||||
final size = _roundUpToPowerOfTwo(
|
final size = _roundUpToPowerOfTwo(
|
||||||
max(_data.length * 2, _HashBase._INITIAL_INDEX_SIZE));
|
max(_data.length * 2, _HashBase._INITIAL_INDEX_SIZE));
|
||||||
final index = new Uint32List(size);
|
final index = new Uint32List(size);
|
||||||
|
|
Loading…
Reference in a new issue