| 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/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 return AttributesEqual(other); | 60 return AttributesEqual(other); |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 bool Value::Equals(Value* other) const { | 64 bool Value::Equals(Value* other) const { |
| 65 return definition() == other->definition(); | 65 return definition() == other->definition(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 | 68 |
| 69 | |
| 70 CheckClassInstr::CheckClassInstr(Value* value, | 69 CheckClassInstr::CheckClassInstr(Value* value, |
| 71 intptr_t deopt_id, | 70 intptr_t deopt_id, |
| 72 const ICData& unary_checks) | 71 const ICData& unary_checks) |
| 73 : unary_checks_(unary_checks) { | 72 : unary_checks_(unary_checks) { |
| 74 ASSERT(value != NULL); | 73 ASSERT(value != NULL); |
| 75 ASSERT(unary_checks.IsZoneHandle()); | 74 ASSERT(unary_checks.IsZoneHandle()); |
| 76 // Expected useful check data. | 75 // Expected useful check data. |
| 77 ASSERT(!unary_checks_.IsNull() && | 76 ASSERT(!unary_checks_.IsNull() && |
| 78 (unary_checks_.NumberOfChecks() > 0) && | 77 (unary_checks_.NumberOfChecks() > 0) && |
| 79 (unary_checks_.num_args_tested() == 1)); | 78 (unary_checks_.num_args_tested() == 1)); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 StrictCompareInstr* other_op = other->AsStrictCompare(); | 130 StrictCompareInstr* other_op = other->AsStrictCompare(); |
| 132 ASSERT(other_op != NULL); | 131 ASSERT(other_op != NULL); |
| 133 return kind() == other_op->kind(); | 132 return kind() == other_op->kind(); |
| 134 } | 133 } |
| 135 | 134 |
| 136 | 135 |
| 137 bool BinarySmiOpInstr::AttributesEqual(Instruction* other) const { | 136 bool BinarySmiOpInstr::AttributesEqual(Instruction* other) const { |
| 138 BinarySmiOpInstr* other_op = other->AsBinarySmiOp(); | 137 BinarySmiOpInstr* other_op = other->AsBinarySmiOp(); |
| 139 ASSERT(other_op != NULL); | 138 ASSERT(other_op != NULL); |
| 140 return (op_kind() == other_op->op_kind()) && | 139 return (op_kind() == other_op->op_kind()) && |
| 141 (overflow_ == other_op->overflow_); | 140 (overflow_ == other_op->overflow_) && |
| 141 (is_truncating_ == other_op->is_truncating_); |
| 142 } | 142 } |
| 143 | 143 |
| 144 | 144 |
| 145 bool LoadFieldInstr::AttributesEqual(Instruction* other) const { | 145 bool LoadFieldInstr::AttributesEqual(Instruction* other) const { |
| 146 LoadFieldInstr* other_load = other->AsLoadField(); | 146 LoadFieldInstr* other_load = other->AsLoadField(); |
| 147 ASSERT(other_load != NULL); | 147 ASSERT(other_load != NULL); |
| 148 ASSERT((offset_in_bytes() != other_load->offset_in_bytes()) || | 148 ASSERT((offset_in_bytes() != other_load->offset_in_bytes()) || |
| 149 ((immutable_ == other_load->immutable_))); | 149 ((immutable_ == other_load->immutable_))); |
| 150 return offset_in_bytes() == other_load->offset_in_bytes(); | 150 return offset_in_bytes() == other_load->offset_in_bytes(); |
| 151 } | 151 } |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 case Token::kBIT_AND: | 843 case Token::kBIT_AND: |
| 844 case Token::kBIT_OR: | 844 case Token::kBIT_OR: |
| 845 case Token::kBIT_XOR: | 845 case Token::kBIT_XOR: |
| 846 return false; | 846 return false; |
| 847 case Token::kSHR: { | 847 case Token::kSHR: { |
| 848 // Can't deopt if shift-count is known positive. | 848 // Can't deopt if shift-count is known positive. |
| 849 Range* right_range = this->right()->definition()->range(); | 849 Range* right_range = this->right()->definition()->range(); |
| 850 return (right_range == NULL) | 850 return (right_range == NULL) |
| 851 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); | 851 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); |
| 852 } | 852 } |
| 853 case Token::kSHL: { |
| 854 Range* right_range = this->right()->definition()->range(); |
| 855 if ((right_range != NULL) && is_truncating()) { |
| 856 // Can deoptimize if right can be negative. |
| 857 return !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); |
| 858 } |
| 859 return true; |
| 860 } |
| 853 default: | 861 default: |
| 854 return overflow_; | 862 return overflow_; |
| 855 } | 863 } |
| 856 } | 864 } |
| 857 | 865 |
| 858 | 866 |
| 859 bool BinarySmiOpInstr::RightIsPowerOfTwoConstant() const { | 867 bool BinarySmiOpInstr::RightIsPowerOfTwoConstant() const { |
| 860 if (!right()->definition()->IsConstant()) return false; | 868 if (!right()->definition()->IsConstant()) return false; |
| 861 const Object& constant = right()->definition()->AsConstant()->value(); | 869 const Object& constant = right()->definition()->AsConstant()->value(); |
| 862 if (!constant.IsSmi()) return false; | 870 if (!constant.IsSmi()) return false; |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 default: | 2209 default: |
| 2202 UNREACHABLE(); | 2210 UNREACHABLE(); |
| 2203 } | 2211 } |
| 2204 return kPowRuntimeEntry; | 2212 return kPowRuntimeEntry; |
| 2205 } | 2213 } |
| 2206 | 2214 |
| 2207 | 2215 |
| 2208 #undef __ | 2216 #undef __ |
| 2209 | 2217 |
| 2210 } // namespace dart | 2218 } // namespace dart |
| OLD | NEW |