Skip to content

Commit acf86bf

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[VM] Type _CompactIterator/_CompactIterable._table
With the [_table] field being `dynamic` we were unable to eliminate checks for the [_isModifiedSince] method, since there is a dynamic call site. This CL adds a type to [_table] so [_isModifiedSince] does not need to perform any checks (via package:vm/transf.../no_dynamic_invocations_annotator.dart) Issue #31798 Change-Id: If773c4b63fab62d1ccdd2e783aa16c19f780000a Reviewed-on: https://dart-review.googlesource.com/43423 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Vyacheslav Egorov <[email protected]>
1 parent a3b2c5a commit acf86bf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

runtime/lib/compact_hash.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ abstract class _HashBase implements _HashVMBase {
115115
int get _checkSum => _usedData + _deletedKeys;
116116
bool _isModifiedSince(List oldData, int oldCheckSum) =>
117117
!identical(_data, oldData) || (_checkSum != oldCheckSum);
118+
119+
int get length;
118120
}
119121

120122
class _OperatorEqualsAndHashCode {
@@ -144,7 +146,7 @@ class _InternalLinkedHashMap<K, V> extends _HashVMBase
144146
}
145147
}
146148

147-
abstract class _LinkedHashMapMixin<K, V> implements _HashVMBase {
149+
abstract class _LinkedHashMapMixin<K, V> implements _HashBase {
148150
int _hashCode(e);
149151
bool _equals(e1, e2);
150152
int get _checkSum;
@@ -401,7 +403,7 @@ class _CompactLinkedCustomHashMap<K, V> extends _HashFieldBase
401403
// Iterates through _data[_offset + _step], _data[_offset + 2*_step], ...
402404
// and checks for concurrent modification.
403405
class _CompactIterable<E> extends Iterable<E> {
404-
final _table;
406+
final _HashBase _table;
405407
final List _data;
406408
final int _len;
407409
final int _offset;
@@ -419,7 +421,7 @@ class _CompactIterable<E> extends Iterable<E> {
419421
}
420422

421423
class _CompactIterator<E> implements Iterator<E> {
422-
final _table;
424+
final _HashBase _table;
423425
final List _data;
424426
final int _len;
425427
int _offset;

0 commit comments

Comments
 (0)