[vm/hr] Directly compare type arguments count when validate hot reload.

There might be better fix with using canonical types for comparison, we
just need to make sure we canonicalize class's type when finalizing it.

Bug:https://github.com/dart-lang/sdk/issues/32942
Change-Id: I2301a7cb91146d587893f91f2d6ee7b731ea3c62
Reviewed-on: https://dart-review.googlesource.com/54314
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: RĂ©gis Crelier <regis@google.com>
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 1c25d3c..6e45883 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -9,7 +9,6 @@
 cc/Fail0: Fail # These tests are expected to crash on all platforms.
 cc/Fail1: Fail # These tests are expected to crash on all platforms.
 cc/Fail2: Fail # These tests are expected to crash on all platforms.
-cc/IsolateReload_ChangeInstanceFormat9: Fail, Crash # issue 32942
 cc/IsolateReload_PendingConstructorCall_AbstractToConcrete: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
 cc/IsolateReload_PendingConstructorCall_ConcreteToAbstract: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
 cc/IsolateReload_PendingStaticCall_DefinedToNSM: Fail # Issue 32981
diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc
index 8ce4190..aecf5ef 100644
--- a/runtime/vm/object_reload.cc
+++ b/runtime/vm/object_reload.cc
@@ -634,13 +634,9 @@
 
 bool Class::CanReloadFinalized(const Class& replacement,
                                IsolateReloadContext* context) const {
-  // Make sure the declaration types matches for the two classes.
+  // Make sure the declaration types argument count matches for the two classes.
   // ex. class A<int,B> {} cannot be replace with class A<B> {}.
-
-  const AbstractType& dt = AbstractType::Handle(DeclarationType());
-  const AbstractType& replacement_dt =
-      AbstractType::Handle(replacement.DeclarationType());
-  if (!dt.Equals(replacement_dt)) {
+  if (NumTypeArguments() != replacement.NumTypeArguments()) {
     context->AddReasonForCancelling(new (context->zone()) TypeParametersChanged(
         context->zone(), *this, replacement));
     return false;