Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: runtime/vm/object.cc

Issue 2794373002: VM [KERNEL] Use simpleInstanceOf in kernel. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 2aed4a855b3641069f22fa154f14f837c41cefd3..12669a04e07475166a465d497b48aa05bea980a8 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -16678,6 +16678,23 @@ const char* AbstractType::ToCString() const {
}
+bool simpleInstanceOfType(const AbstractType& type) {
+ // Bail if the type is still uninstantiated at compile time.
+ if (!type.IsInstantiated()) return false;
+
+ // Bail if the type is a function or a Dart Function type.
+ if (type.IsFunctionType() || type.IsDartFunctionType()) return false;
+
+ ASSERT(type.HasResolvedTypeClass());
+ const Class& type_class = Class::Handle(type.type_class());
+ // Bail if the type has any type parameters.
+ if (type_class.IsGeneric()) return false;
+
+ // Finally a simple class for instance of checking.
+ return true;
+}
+
+
RawType* Type::NullType() {
return Isolate::Current()->object_store()->null_type();
}
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698