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 | 4 |
5 #include "vm/aot_optimizer.h" | 5 #include "vm/aot_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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 const ClassTable& class_table = *isolate()->class_table(); | 1328 const ClassTable& class_table = *isolate()->class_table(); |
1329 Bool& prev = Bool::Handle(Z); | 1329 Bool& prev = Bool::Handle(Z); |
1330 Class& cls = Class::Handle(Z); | 1330 Class& cls = Class::Handle(Z); |
1331 | 1331 |
1332 bool results_differ = false; | 1332 bool results_differ = false; |
1333 for (int i = 0; i < ic_data.NumberOfChecks(); i++) { | 1333 for (int i = 0; i < ic_data.NumberOfChecks(); i++) { |
1334 cls = class_table.At(ic_data.GetReceiverClassIdAt(i)); | 1334 cls = class_table.At(ic_data.GetReceiverClassIdAt(i)); |
1335 if (cls.NumTypeArguments() > 0) { | 1335 if (cls.NumTypeArguments() > 0) { |
1336 return Bool::null(); | 1336 return Bool::null(); |
1337 } | 1337 } |
| 1338 // As of Dart 1.5, the Null type is a subtype of (and is more specific than) |
| 1339 // any type. However, we are checking instances here and not types. The |
| 1340 // null instance is only an instance of Null, Object, and dynamic. |
1338 const bool is_subtype = | 1341 const bool is_subtype = |
1339 cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class, | 1342 cls.IsNullClass() |
1340 TypeArguments::Handle(Z), NULL, NULL, Heap::kOld); | 1343 ? (type_class.IsNullClass() || type_class.IsObjectClass() || |
| 1344 type_class.IsDynamicClass()) |
| 1345 : cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class, |
| 1346 TypeArguments::Handle(Z), NULL, NULL, Heap::kOld); |
1341 results->Add(cls.id()); | 1347 results->Add(cls.id()); |
1342 results->Add(is_subtype); | 1348 results->Add(is_subtype); |
1343 if (prev.IsNull()) { | 1349 if (prev.IsNull()) { |
1344 prev = Bool::Get(is_subtype).raw(); | 1350 prev = Bool::Get(is_subtype).raw(); |
1345 } else { | 1351 } else { |
1346 if (is_subtype != prev.value()) { | 1352 if (is_subtype != prev.value()) { |
1347 results_differ = true; | 1353 results_differ = true; |
1348 } | 1354 } |
1349 } | 1355 } |
1350 } | 1356 } |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 FlowGraph::kEffect); | 2169 FlowGraph::kEffect); |
2164 current_iterator()->RemoveCurrentFromGraph(); | 2170 current_iterator()->RemoveCurrentFromGraph(); |
2165 } | 2171 } |
2166 } | 2172 } |
2167 } | 2173 } |
2168 } | 2174 } |
2169 | 2175 |
2170 #endif // DART_PRECOMPILER | 2176 #endif // DART_PRECOMPILER |
2171 | 2177 |
2172 } // namespace dart | 2178 } // namespace dart |
OLD | NEW |