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

Unified Diff: runtime/vm/aot_optimizer.cc

Issue 2608373002: Move Null type to the Bottom in the VM (fixes #28025). (Closed)
Patch Set: address comments and sync Created 3 years, 11 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
« no previous file with comments | « runtime/lib/object.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/aot_optimizer.cc
diff --git a/runtime/vm/aot_optimizer.cc b/runtime/vm/aot_optimizer.cc
index 93501ec22d2a20ce6b26dec3902564d3ff997271..f630aae7fbe44ed635c232d7c57451d04bc590f5 100644
--- a/runtime/vm/aot_optimizer.cc
+++ b/runtime/vm/aot_optimizer.cc
@@ -1335,9 +1335,15 @@ RawBool* AotOptimizer::InstanceOfAsBool(
if (cls.NumTypeArguments() > 0) {
return Bool::null();
}
+ // As of Dart 1.5, the Null type is a subtype of (and is more specific than)
+ // any type. However, we are checking instances here and not types. The
+ // null instance is only an instance of Null, Object, and dynamic.
const bool is_subtype =
- cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class,
- TypeArguments::Handle(Z), NULL, NULL, Heap::kOld);
+ cls.IsNullClass()
+ ? (type_class.IsNullClass() || type_class.IsObjectClass() ||
+ type_class.IsDynamicClass())
+ : cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class,
+ TypeArguments::Handle(Z), NULL, NULL, Heap::kOld);
results->Add(cls.id());
results->Add(is_subtype);
if (prev.IsNull()) {
« no previous file with comments | « runtime/lib/object.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698