| 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, the Object type, or void. | 1262 // Any type is more specific than the dynamic type and than the Object type. |
| 1263 if (dst_type.IsDynamicType() || dst_type.IsObjectType() || | 1263 if (dst_type.IsDynamicType() || dst_type.IsObjectType()) { |
| 1264 dst_type.IsVoidType()) { | |
| 1265 return true; | 1264 return true; |
| 1266 } | 1265 } |
| 1267 | 1266 |
| 1268 // Do not perform type check elimination if this optimization is turned off. | 1267 // Do not perform type check elimination if this optimization is turned off. |
| 1269 if (!FLAG_eliminate_type_checks) { | 1268 if (!FLAG_eliminate_type_checks) { |
| 1270 return false; | 1269 return false; |
| 1271 } | 1270 } |
| 1272 | 1271 |
| 1273 // If nothing is known about the value, as is the case for passed-in | 1272 // If nothing is known about the value, as is the case for passed-in |
| 1274 // parameters, and since dst_type is not one of the tested cases above, then | 1273 // 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... |
| 4394 ASSERT(type.HasResolvedTypeClass()); | 4393 ASSERT(type.HasResolvedTypeClass()); |
| 4395 const Class& type_class = Class::Handle(type.type_class()); | 4394 const Class& type_class = Class::Handle(type.type_class()); |
| 4396 // Bail if the type has any type parameters. | 4395 // Bail if the type has any type parameters. |
| 4397 if (type_class.IsGeneric()) return false; | 4396 if (type_class.IsGeneric()) return false; |
| 4398 | 4397 |
| 4399 // Finally a simple class for instance of checking. | 4398 // Finally a simple class for instance of checking. |
| 4400 return true; | 4399 return true; |
| 4401 } | 4400 } |
| 4402 | 4401 |
| 4403 } // namespace dart | 4402 } // namespace dart |
| OLD | NEW |