From acf86bfb22cdb47af05fdff13b90ebbc06f57cbe Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Thu, 1 Mar 2018 14:03:28 +0000 Subject: [PATCH] [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 https://github.com/dart-lang/sdk/issues/31798 Change-Id: If773c4b63fab62d1ccdd2e783aa16c19f780000a Reviewed-on: https://dart-review.googlesource.com/43423 Commit-Queue: Martin Kustermann Reviewed-by: Vyacheslav Egorov --- runtime/lib/compact_hash.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/lib/compact_hash.dart b/runtime/lib/compact_hash.dart index 742457ace58..7961370b01d 100644 --- a/runtime/lib/compact_hash.dart +++ b/runtime/lib/compact_hash.dart @@ -115,6 +115,8 @@ abstract class _HashBase implements _HashVMBase { int get _checkSum => _usedData + _deletedKeys; bool _isModifiedSince(List oldData, int oldCheckSum) => !identical(_data, oldData) || (_checkSum != oldCheckSum); + + int get length; } class _OperatorEqualsAndHashCode { @@ -144,7 +146,7 @@ class _InternalLinkedHashMap extends _HashVMBase } } -abstract class _LinkedHashMapMixin implements _HashVMBase { +abstract class _LinkedHashMapMixin implements _HashBase { int _hashCode(e); bool _equals(e1, e2); int get _checkSum; @@ -401,7 +403,7 @@ class _CompactLinkedCustomHashMap extends _HashFieldBase // Iterates through _data[_offset + _step], _data[_offset + 2*_step], ... // and checks for concurrent modification. class _CompactIterable extends Iterable { - final _table; + final _HashBase _table; final List _data; final int _len; final int _offset; @@ -419,7 +421,7 @@ class _CompactIterable extends Iterable { } class _CompactIterator implements Iterator { - final _table; + final _HashBase _table; final List _data; final int _len; int _offset;