[vm/concurrency] Allow rehashing of linked hashmaps that contain deleted entries

When rehashing linked hash maps we'll allow rehashing of hashmaps that
have deleted entries in them. This avoids making assumptions about the
state of a linked hashmap object at the time when it's transitively
copied.

It was split out of a follow-up CL that adds transitive object copies,
which will copy linked hashmaps as they are.

Issue https://github.com/dart-lang/sdk/issues/36097

TEST=Existing test coverage.

Change-Id: Ia844a14a3893e2416a11fa99d9de38025d6fac7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203773
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
diff --git a/sdk/lib/_internal/vm/lib/compact_hash.dart b/sdk/lib/_internal/vm/lib/compact_hash.dart
index b491dd6..7ff2354 100644
--- a/sdk/lib/_internal/vm/lib/compact_hash.dart
+++ b/sdk/lib/_internal/vm/lib/compact_hash.dart
@@ -238,7 +238,10 @@
     final int tmpUsed = _usedData;
     _usedData = 0;
     for (int i = 0; i < tmpUsed; i += 2) {
-      this[_data[i]] = _data[i + 1];
+      final key = _data[i];
+      if (!_HashBase._isDeleted(_data, key)) {
+        this[key] = _data[i + 1];
+      }
     }
   }