[vm] Fix compressed pointers build

Only use unified kStringCid cluster in non-compressed variant (when
we write strings into rodata section)

TEST=x64c bots

Change-Id: Id1781801eae40f570228503fefac43a90d033c7b
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190221
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index e0b5071..b303c7d 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -483,7 +483,7 @@
 // types in a special way). In this case subclass can set
 // kAllCanonicalObjectsAreIncludedIntoSet to |false| and override
 // IsInCanonicalSet filter.
-#if !defined(DART_PRECOMPILED_RUNTIME) && !defined(DART_COMPRESSED_POINTERS)
+#if !defined(DART_PRECOMPILED_RUNTIME)
 template <typename SetType,
           typename HandleType,
           typename PointerType,
@@ -5732,7 +5732,7 @@
         saved_canonical_type_arguments_(Array::Handle()),
         saved_canonical_type_parameters_(Array::Handle()) {
     saved_symbol_table_ = object_store->symbol_table();
-    if (Snapshot::IncludesCode(snapshot_kind)) {
+    if (Snapshot::IncludesStringsInROData(snapshot_kind)) {
       object_store->set_symbol_table(
           Array::Handle(HashTables::New<CanonicalStringSet>(4)));
     } else {
@@ -6634,7 +6634,8 @@
     cid = object->GetClassId();
     is_canonical = object->untag()->IsCanonical();
   }
-  if (Snapshot::IncludesCode(kind_) && is_canonical && IsStringClassId(cid) &&
+  if (Snapshot::IncludesStringsInROData(kind_) && is_canonical &&
+      IsStringClassId(cid) &&
       current_loading_unit_id_ <= LoadingUnit::kRootId) {
     cid = kStringCid;
   }
@@ -7698,7 +7699,7 @@
   serializer.WriteVersionAndFeatures(true);
   VMSerializationRoots roots(
       Array::Handle(Dart::vm_isolate_group()->object_store()->symbol_table()),
-      /*should_write_symbols=*/!Snapshot::IncludesCode(kind_));
+      /*should_write_symbols=*/!Snapshot::IncludesStringsInROData(kind_));
   ZoneGrowableArray<Object*>* objects = serializer.Serialize(&roots);
   serializer.FillHeader(serializer.kind());
   clustered_vm_size_ = serializer.bytes_written();
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index 93678d0..174a88f 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -139,6 +139,14 @@
     return (kind == kFullJIT) || (kind == kFullAOT);
   }
 
+  static bool IncludesStringsInROData(Kind kind) {
+#if !defined(DART_COMPRESSED_POINTERS)
+    return IncludesCode(kind);
+#else
+    return false;
+#endif
+  }
+
   const uint8_t* Addr() const { return reinterpret_cast<const uint8_t*>(this); }
 
   const uint8_t* DataImage() const {