OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 const String& dst_name) { | 1252 const String& dst_name) { |
1253 ASSERT(!dst_type.IsNull()); | 1253 ASSERT(!dst_type.IsNull()); |
1254 ASSERT(dst_type.IsFinalized()); | 1254 ASSERT(dst_type.IsFinalized()); |
1255 | 1255 |
1256 // If the destination type is malformed or malbounded, a dynamic type error | 1256 // If the destination type is malformed or malbounded, a dynamic type error |
1257 // must be thrown at run time. | 1257 // must be thrown at run time. |
1258 if (dst_type.IsMalformedOrMalbounded()) { | 1258 if (dst_type.IsMalformedOrMalbounded()) { |
1259 return false; | 1259 return false; |
1260 } | 1260 } |
1261 | 1261 |
1262 // Any type is more specific than the dynamic type and than the Object type. | 1262 // Any type is more specific than the dynamic type, the Object type, or void. |
1263 if (dst_type.IsDynamicType() || dst_type.IsObjectType()) { | 1263 if (dst_type.IsDynamicType() || dst_type.IsObjectType() || |
| 1264 dst_type.IsVoidType()) { |
1264 return true; | 1265 return true; |
1265 } | 1266 } |
1266 | 1267 |
1267 // Do not perform type check elimination if this optimization is turned off. | 1268 // Do not perform type check elimination if this optimization is turned off. |
1268 if (!FLAG_eliminate_type_checks) { | 1269 if (!FLAG_eliminate_type_checks) { |
1269 return false; | 1270 return false; |
1270 } | 1271 } |
1271 | 1272 |
1272 // If nothing is known about the value, as is the case for passed-in | 1273 // If nothing is known about the value, as is the case for passed-in |
1273 // parameters, and since dst_type is not one of the tested cases above, then | 1274 // parameters, and since dst_type is not one of the tested cases above, then |
(...skipping 3119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4393 ASSERT(type.HasResolvedTypeClass()); | 4394 ASSERT(type.HasResolvedTypeClass()); |
4394 const Class& type_class = Class::Handle(type.type_class()); | 4395 const Class& type_class = Class::Handle(type.type_class()); |
4395 // Bail if the type has any type parameters. | 4396 // Bail if the type has any type parameters. |
4396 if (type_class.IsGeneric()) return false; | 4397 if (type_class.IsGeneric()) return false; |
4397 | 4398 |
4398 // Finally a simple class for instance of checking. | 4399 // Finally a simple class for instance of checking. |
4399 return true; | 4400 return true; |
4400 } | 4401 } |
4401 | 4402 |
4402 } // namespace dart | 4403 } // namespace dart |
OLD | NEW |