| 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/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 const Object& constant = locs.in(1).constant(); | 2094 const Object& constant = locs.in(1).constant(); |
| 2095 ASSERT(constant.IsSmi()); | 2095 ASSERT(constant.IsSmi()); |
| 2096 // Immediate shift operation takes 5 bits for the count. | 2096 // Immediate shift operation takes 5 bits for the count. |
| 2097 const intptr_t kCountLimit = 0x1F; | 2097 const intptr_t kCountLimit = 0x1F; |
| 2098 const intptr_t value = Smi::Cast(constant).Value(); | 2098 const intptr_t value = Smi::Cast(constant).Value(); |
| 2099 if (value == 0) { | 2099 if (value == 0) { |
| 2100 // No code needed. | 2100 // No code needed. |
| 2101 } else if ((value < 0) || (value >= kCountLimit)) { | 2101 } else if ((value < 0) || (value >= kCountLimit)) { |
| 2102 // This condition may not be known earlier in some cases because | 2102 // This condition may not be known earlier in some cases because |
| 2103 // of constant propagation, inlining, etc. | 2103 // of constant propagation, inlining, etc. |
| 2104 if ((value >=kCountLimit) && is_truncating) { | 2104 if ((value >= kCountLimit) && is_truncating) { |
| 2105 __ mov(result, ShifterOperand(0)); | 2105 __ mov(result, ShifterOperand(0)); |
| 2106 } else { | 2106 } else { |
| 2107 // Result is Mint or exception. | 2107 // Result is Mint or exception. |
| 2108 __ b(deopt); | 2108 __ b(deopt); |
| 2109 } | 2109 } |
| 2110 } else { | 2110 } else { |
| 2111 if (!is_truncating) { | 2111 if (!is_truncating) { |
| 2112 // Check for overflow (preserve left). | 2112 // Check for overflow (preserve left). |
| 2113 __ Lsl(IP, left, value); | 2113 __ Lsl(IP, left, value); |
| 2114 __ cmp(left, ShifterOperand(IP, ASR, value)); | 2114 __ cmp(left, ShifterOperand(IP, ASR, value)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 if (is_truncating) { | 2154 if (is_truncating) { |
| 2155 if (right_needs_check) { | 2155 if (right_needs_check) { |
| 2156 const bool right_may_be_negative = | 2156 const bool right_may_be_negative = |
| 2157 (right_range == NULL) || | 2157 (right_range == NULL) || |
| 2158 !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); | 2158 !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); |
| 2159 if (right_may_be_negative) { | 2159 if (right_may_be_negative) { |
| 2160 ASSERT(shift_left->CanDeoptimize()); | 2160 ASSERT(shift_left->CanDeoptimize()); |
| 2161 __ cmp(right, ShifterOperand(0)); | 2161 __ cmp(right, ShifterOperand(0)); |
| 2162 __ b(deopt, MI); | 2162 __ b(deopt, MI); |
| 2163 } | 2163 } |
| 2164 Label done, is_not_zero; | 2164 |
| 2165 __ cmp(right, | 2165 __ cmp(right, |
| 2166 ShifterOperand(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); | 2166 ShifterOperand(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); |
| 2167 __ mov(result, ShifterOperand(0), CS); | 2167 __ mov(result, ShifterOperand(0), CS); |
| 2168 __ SmiUntag(right, CC); | 2168 __ SmiUntag(right, CC); |
| 2169 __ Lsl(result, left, right, CC); | 2169 __ Lsl(result, left, right, CC); |
| 2170 } else { | 2170 } else { |
| 2171 __ SmiUntag(right); | 2171 __ SmiUntag(right); |
| 2172 __ Lsl(result, left, right); | 2172 __ Lsl(result, left, right); |
| 2173 } | 2173 } |
| 2174 } else { | 2174 } else { |
| (...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3585 compiler->GenerateCall(token_pos(), | 3585 compiler->GenerateCall(token_pos(), |
| 3586 &label, | 3586 &label, |
| 3587 PcDescriptors::kOther, | 3587 PcDescriptors::kOther, |
| 3588 locs()); | 3588 locs()); |
| 3589 __ Drop(2); // Discard type arguments and receiver. | 3589 __ Drop(2); // Discard type arguments and receiver. |
| 3590 } | 3590 } |
| 3591 | 3591 |
| 3592 } // namespace dart | 3592 } // namespace dart |
| 3593 | 3593 |
| 3594 #endif // defined TARGET_ARCH_ARM | 3594 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |