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

Unified Diff: runtime/vm/object.cc

Issue 10942006: Fix bad optimization of instance-of with uninstantiated types (issue 5216). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 12464)
+++ runtime/vm/object.cc (working copy)
@@ -44,6 +44,7 @@
"Show names of internal classes (e.g. \"OneByteString\") in error messages "
"instead of showing the corresponding interface names (e.g. \"String\")");
DECLARE_FLAG(bool, trace_compiler);
+DECLARE_FLAG(bool, eliminate_type_checks);
DECLARE_FLAG(bool, enable_type_checks);
static const char* kGetterPrefix = "get:";
@@ -8533,7 +8534,16 @@
ASSERT(other.IsFinalized());
ASSERT(!other.IsDynamicType());
ASSERT(!other.IsMalformed());
- if (IsNull()) {
+ const Class& cls = Class::Handle(clazz());
+ if (cls.IsNullClass()) {
+ if (!IsNull()) {
+ // We can only encounter Object::sentinel() or
+ // Object::transition_sentinel() if type checks were not eliminated at
+ // compile time. Both sentinels are instances of the Null class, but they
zerny-google 2012/09/18 11:20:24 Can we assert that?
regis 2012/09/18 14:55:44 There is already an assert for !FLAG_eliminate_typ
+ // are not the Object::null() instance.
+ ASSERT(!FLAG_eliminate_type_checks);
+ return true; // We are doing an instance of test as part of a type check.
+ }
// The null instance can be returned from a void function.
if (other.IsVoidType()) {
return true;
@@ -8558,10 +8568,6 @@
if (other.IsVoidType()) {
return false;
}
- const Class& cls = Class::Handle(clazz());
- // We must not encounter Object::sentinel() or Object::transition_sentinel(),
- // both instances of class NullClass, but not instance Object::null().
- ASSERT(!cls.IsNullClass());
AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle();
const intptr_t num_type_arguments = cls.NumTypeArguments();
if (num_type_arguments > 0) {

Powered by Google App Engine
This is Rietveld 408576698