[vm, kernel] Fast-path for reading non-generic types.

Change-Id: I24d598aa66efa414b04e364bf5dce10bdc917904
Reviewed-on: https://dart-review.googlesource.com/75122
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index 313106e..b75b3d6 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -2696,16 +2696,18 @@
   NameIndex klass_name =
       helper_->ReadCanonicalNameReference();  // read klass_name.
 
-  intptr_t length;
+  const Class& klass = Class::Handle(Z, H.LookupClassByKernelClass(klass_name));
   if (simple) {
-    length = 0;
-  } else {
-    length = helper_->ReadListLength();  // read type_arguments list length.
+    // Fast path for non-generic types: retrieve or populate the class's only
+    // canonical type.
+    result_ = H.GetCanonicalType(klass).raw();
+    return;
   }
+
+  intptr_t length =
+      helper_->ReadListLength();  // read type_arguments list length.
   const TypeArguments& type_arguments =
       BuildTypeArguments(length);  // read type arguments.
-
-  Object& klass = Object::Handle(Z, H.LookupClassByKernelClass(klass_name));
   result_ = Type::New(klass, type_arguments, TokenPosition::kNoSource);
   if (finalize_) {
     ASSERT(active_class_->klass != NULL);