| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 DEFINE_FLAG(bool, propagate_ic_data, true, | 28 DEFINE_FLAG(bool, propagate_ic_data, true, |
| 29 "Propagate IC data from unoptimized to optimized IC calls."); | 29 "Propagate IC data from unoptimized to optimized IC calls."); |
| 30 DEFINE_FLAG(bool, unbox_numeric_fields, true, | 30 DEFINE_FLAG(bool, unbox_numeric_fields, true, |
| 31 "Support unboxed double and float32x4 fields."); | 31 "Support unboxed double and float32x4 fields."); |
| 32 DECLARE_FLAG(bool, enable_type_checks); | 32 DECLARE_FLAG(bool, enable_type_checks); |
| 33 DECLARE_FLAG(bool, eliminate_type_checks); | 33 DECLARE_FLAG(bool, eliminate_type_checks); |
| 34 DECLARE_FLAG(bool, trace_optimization); | 34 DECLARE_FLAG(bool, trace_optimization); |
| 35 DECLARE_FLAG(bool, trace_constant_propagation); | 35 DECLARE_FLAG(bool, trace_constant_propagation); |
| 36 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 36 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 37 DECLARE_FLAG(bool, enable_type_checks); | |
| 38 | 37 |
| 39 Definition::Definition() | 38 Definition::Definition() |
| 40 : range_(NULL), | 39 : range_(NULL), |
| 41 type_(NULL), | 40 type_(NULL), |
| 42 temp_index_(-1), | 41 temp_index_(-1), |
| 43 ssa_temp_index_(-1), | 42 ssa_temp_index_(-1), |
| 44 input_use_list_(NULL), | 43 input_use_list_(NULL), |
| 45 env_use_list_(NULL), | 44 env_use_list_(NULL), |
| 46 use_kind_(kValue), // Phis and parameters rely on this default. | 45 use_kind_(kValue), // Phis and parameters rely on this default. |
| 47 constant_value_(Object::ZoneHandle(ConstantPropagator::Unknown())) { | 46 constant_value_(Object::ZoneHandle(ConstantPropagator::Unknown())) { |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 // are constant, instantiate the target type here. | 1516 // are constant, instantiate the target type here. |
| 1518 if (dst_type().IsInstantiated()) return this; | 1517 if (dst_type().IsInstantiated()) return this; |
| 1519 | 1518 |
| 1520 ConstantInstr* constant_type_args = | 1519 ConstantInstr* constant_type_args = |
| 1521 instantiator_type_arguments()->definition()->AsConstant(); | 1520 instantiator_type_arguments()->definition()->AsConstant(); |
| 1522 if (constant_type_args != NULL && | 1521 if (constant_type_args != NULL && |
| 1523 !constant_type_args->value().IsNull() && | 1522 !constant_type_args->value().IsNull() && |
| 1524 constant_type_args->value().IsTypeArguments()) { | 1523 constant_type_args->value().IsTypeArguments()) { |
| 1525 const TypeArguments& instantiator_type_args = | 1524 const TypeArguments& instantiator_type_args = |
| 1526 TypeArguments::Cast(constant_type_args->value()); | 1525 TypeArguments::Cast(constant_type_args->value()); |
| 1526 Error& bound_error = Error::Handle(); |
| 1527 const AbstractType& new_dst_type = AbstractType::Handle( | 1527 const AbstractType& new_dst_type = AbstractType::Handle( |
| 1528 dst_type().InstantiateFrom(instantiator_type_args, NULL)); | 1528 dst_type().InstantiateFrom(instantiator_type_args, &bound_error)); |
| 1529 // If dst_type is instantiated to dynamic or Object, skip the test. | 1529 // If dst_type is instantiated to dynamic or Object, skip the test. |
| 1530 if (!new_dst_type.IsMalformedOrMalbounded() && | 1530 if (!new_dst_type.IsMalformedOrMalbounded() && bound_error.IsNull() && |
| 1531 (new_dst_type.IsDynamicType() || new_dst_type.IsObjectType())) { | 1531 (new_dst_type.IsDynamicType() || new_dst_type.IsObjectType())) { |
| 1532 return value()->definition(); | 1532 return value()->definition(); |
| 1533 } | 1533 } |
| 1534 set_dst_type(AbstractType::ZoneHandle(new_dst_type.Canonicalize())); | 1534 set_dst_type(AbstractType::ZoneHandle(new_dst_type.Canonicalize())); |
| 1535 if (FLAG_eliminate_type_checks && | 1535 if (FLAG_eliminate_type_checks && |
| 1536 value()->Type()->IsAssignableTo(dst_type())) { | 1536 value()->Type()->IsAssignableTo(dst_type())) { |
| 1537 return value()->definition(); | 1537 return value()->definition(); |
| 1538 } | 1538 } |
| 1539 ConstantInstr* null_constant = flow_graph->constant_null(); | 1539 ConstantInstr* null_constant = flow_graph->constant_null(); |
| 1540 instantiator_type_arguments()->BindTo(null_constant); | 1540 instantiator_type_arguments()->BindTo(null_constant); |
| (...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3251 case Token::kTRUNCDIV: return 0; | 3251 case Token::kTRUNCDIV: return 0; |
| 3252 case Token::kMOD: return 1; | 3252 case Token::kMOD: return 1; |
| 3253 default: UNIMPLEMENTED(); return -1; | 3253 default: UNIMPLEMENTED(); return -1; |
| 3254 } | 3254 } |
| 3255 } | 3255 } |
| 3256 | 3256 |
| 3257 | 3257 |
| 3258 #undef __ | 3258 #undef __ |
| 3259 | 3259 |
| 3260 } // namespace dart | 3260 } // namespace dart |
| OLD | NEW |