Chromium Code Reviews| 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) { |