| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 #ifndef DART_PRECOMPILED_RUNTIME | 4 #ifndef DART_PRECOMPILED_RUNTIME |
| 5 #include "vm/jit_optimizer.h" | 5 #include "vm/jit_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 const ClassTable& class_table = *isolate()->class_table(); | 1227 const ClassTable& class_table = *isolate()->class_table(); |
| 1228 Bool& prev = Bool::Handle(Z); | 1228 Bool& prev = Bool::Handle(Z); |
| 1229 Class& cls = Class::Handle(Z); | 1229 Class& cls = Class::Handle(Z); |
| 1230 | 1230 |
| 1231 bool results_differ = false; | 1231 bool results_differ = false; |
| 1232 for (int i = 0; i < ic_data.NumberOfChecks(); i++) { | 1232 for (int i = 0; i < ic_data.NumberOfChecks(); i++) { |
| 1233 cls = class_table.At(ic_data.GetReceiverClassIdAt(i)); | 1233 cls = class_table.At(ic_data.GetReceiverClassIdAt(i)); |
| 1234 if (cls.NumTypeArguments() > 0) { | 1234 if (cls.NumTypeArguments() > 0) { |
| 1235 return Bool::null(); | 1235 return Bool::null(); |
| 1236 } | 1236 } |
| 1237 // As of Dart 1.5, the Null type is a subtype of (and is more specific than) |
| 1238 // any type. However, we are checking instances here and not types. The |
| 1239 // null instance is only an instance of Null, Object, and dynamic. |
| 1237 const bool is_subtype = | 1240 const bool is_subtype = |
| 1238 cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class, | 1241 cls.IsNullClass() |
| 1239 TypeArguments::Handle(Z), NULL, NULL, Heap::kOld); | 1242 ? (type_class.IsNullClass() || type_class.IsObjectClass() || |
| 1243 type_class.IsDynamicClass()) |
| 1244 : cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class, |
| 1245 TypeArguments::Handle(Z), NULL, NULL, Heap::kOld); |
| 1240 results->Add(cls.id()); | 1246 results->Add(cls.id()); |
| 1241 results->Add(is_subtype); | 1247 results->Add(is_subtype); |
| 1242 if (prev.IsNull()) { | 1248 if (prev.IsNull()) { |
| 1243 prev = Bool::Get(is_subtype).raw(); | 1249 prev = Bool::Get(is_subtype).raw(); |
| 1244 } else { | 1250 } else { |
| 1245 if (is_subtype != prev.value()) { | 1251 if (is_subtype != prev.value()) { |
| 1246 results_differ = true; | 1252 results_differ = true; |
| 1247 } | 1253 } |
| 1248 } | 1254 } |
| 1249 } | 1255 } |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 // Discard the environment from the original instruction because the store | 1864 // Discard the environment from the original instruction because the store |
| 1859 // can't deoptimize. | 1865 // can't deoptimize. |
| 1860 instr->RemoveEnvironment(); | 1866 instr->RemoveEnvironment(); |
| 1861 ReplaceCall(instr, store); | 1867 ReplaceCall(instr, store); |
| 1862 return true; | 1868 return true; |
| 1863 } | 1869 } |
| 1864 | 1870 |
| 1865 | 1871 |
| 1866 } // namespace dart | 1872 } // namespace dart |
| 1867 #endif // DART_PRECOMPILED_RUNTIME | 1873 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |