[VM runtime] Store Smi instance type in type test cache when using the interpreter.

Instances of type Smi are handled in generated code and not looked up in
type test cache. The interpreter does not implement this special handling and
relies on the cache for Smi instances as well.

Change-Id: I3a8501efcbadfcbe848871ad0f6ada444414be43
Reviewed-on: https://dart-review.googlesource.com/76305
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index 95542e0..e5db6fa 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -637,18 +637,24 @@
     }
     return;
   }
+  Class& instance_class = Class::Handle(zone);
   if (instance.IsSmi()) {
-    if (FLAG_trace_type_checks) {
-      OS::PrintErr("UpdateTypeTestCache: instance is Smi\n");
+    if (FLAG_enable_interpreter) {
+      instance_class = Smi::Class();
+    } else {
+      if (FLAG_trace_type_checks) {
+        OS::PrintErr("UpdateTypeTestCache: instance is Smi, not updating\n");
+      }
+      return;
     }
-    return;
+  } else {
+    instance_class = instance.clazz();
   }
   // If the type is uninstantiated and refers to parent function type
   // parameters, the function_type_arguments have been canonicalized
   // when concatenated.
   ASSERT(function_type_arguments.IsNull() ||
          function_type_arguments.IsCanonical());
-  const Class& instance_class = Class::Handle(zone, instance.clazz());
   auto& instance_class_id_or_function = Object::Handle(zone);
   auto& instance_type_arguments = TypeArguments::Handle(zone);
   auto& instance_parent_function_type_arguments = TypeArguments::Handle(zone);