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

Unified Diff: runtime/vm/jit_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/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/jit_optimizer.cc
diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc
index ff691b06c24480e2ad805095bbcd1fbcf0dd70ca..d7ef3e31aed6e2a968ef3c31d04ac5a66485d27e 100644
--- a/runtime/vm/jit_optimizer.cc
+++ b/runtime/vm/jit_optimizer.cc
@@ -1234,9 +1234,15 @@ RawBool* JitOptimizer::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/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698