| 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/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 unary_checks().HasReceiverClassId(kTwoByteStringCid); | 122 unary_checks().HasReceiverClassId(kTwoByteStringCid); |
| 123 return externalizable ? EffectSet::Externalization() : EffectSet::None(); | 123 return externalizable ? EffectSet::Externalization() : EffectSet::None(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 bool GuardFieldInstr::AttributesEqual(Instruction* other) const { | 127 bool GuardFieldInstr::AttributesEqual(Instruction* other) const { |
| 128 return field().raw() == other->AsGuardField()->field().raw(); | 128 return field().raw() == other->AsGuardField()->field().raw(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 bool CheckArrayBoundInstr::AttributesEqual(Instruction* other) const { | |
| 133 CheckArrayBoundInstr* other_check = other->AsCheckArrayBound(); | |
| 134 ASSERT(other_check != NULL); | |
| 135 return array_type() == other_check->array_type(); | |
| 136 } | |
| 137 | |
| 138 | |
| 139 bool AssertAssignableInstr::AttributesEqual(Instruction* other) const { | 132 bool AssertAssignableInstr::AttributesEqual(Instruction* other) const { |
| 140 AssertAssignableInstr* other_assert = other->AsAssertAssignable(); | 133 AssertAssignableInstr* other_assert = other->AsAssertAssignable(); |
| 141 ASSERT(other_assert != NULL); | 134 ASSERT(other_assert != NULL); |
| 142 // This predicate has to be commutative for DominatorBasedCSE to work. | 135 // This predicate has to be commutative for DominatorBasedCSE to work. |
| 143 // TODO(fschneider): Eliminate more asserts with subtype relation. | 136 // TODO(fschneider): Eliminate more asserts with subtype relation. |
| 144 return dst_type().raw() == other_assert->dst_type().raw(); | 137 return dst_type().raw() == other_assert->dst_type().raw(); |
| 145 } | 138 } |
| 146 | 139 |
| 147 | 140 |
| 148 bool StrictCompareInstr::AttributesEqual(Instruction* other) const { | 141 bool StrictCompareInstr::AttributesEqual(Instruction* other) const { |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2340 return false; | 2333 return false; |
| 2341 } | 2334 } |
| 2342 | 2335 |
| 2343 | 2336 |
| 2344 bool CheckArrayBoundInstr::IsFixedLengthArrayType(intptr_t cid) { | 2337 bool CheckArrayBoundInstr::IsFixedLengthArrayType(intptr_t cid) { |
| 2345 return LoadFieldInstr::IsFixedLengthArrayCid(cid); | 2338 return LoadFieldInstr::IsFixedLengthArrayCid(cid); |
| 2346 } | 2339 } |
| 2347 | 2340 |
| 2348 | 2341 |
| 2349 bool CheckArrayBoundInstr::IsRedundant(RangeBoundary length) { | 2342 bool CheckArrayBoundInstr::IsRedundant(RangeBoundary length) { |
| 2350 // Check that array has an immutable length. | |
| 2351 if (!IsFixedLengthArrayType(array_type())) { | |
| 2352 return false; | |
| 2353 } | |
| 2354 | |
| 2355 Range* index_range = index()->definition()->range(); | 2343 Range* index_range = index()->definition()->range(); |
| 2356 | 2344 |
| 2357 // Range of the index is unknown can't decide if the check is redundant. | 2345 // Range of the index is unknown can't decide if the check is redundant. |
| 2358 if (index_range == NULL) { | 2346 if (index_range == NULL) { |
| 2359 return false; | 2347 return false; |
| 2360 } | 2348 } |
| 2361 | 2349 |
| 2362 // Range of the index is not positive. Check can't be redundant. | 2350 // Range of the index is not positive. Check can't be redundant. |
| 2363 if (Range::ConstantMin(index_range).value() < 0) { | 2351 if (Range::ConstantMin(index_range).value() < 0) { |
| 2364 return false; | 2352 return false; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 default: | 2491 default: |
| 2504 UNREACHABLE(); | 2492 UNREACHABLE(); |
| 2505 } | 2493 } |
| 2506 return kPowRuntimeEntry; | 2494 return kPowRuntimeEntry; |
| 2507 } | 2495 } |
| 2508 | 2496 |
| 2509 | 2497 |
| 2510 #undef __ | 2498 #undef __ |
| 2511 | 2499 |
| 2512 } // namespace dart | 2500 } // namespace dart |
| OLD | NEW |