| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2630 __ sllv(result, left, TMP); | 2630 __ sllv(result, left, TMP); |
| 2631 } | 2631 } |
| 2632 return; | 2632 return; |
| 2633 } | 2633 } |
| 2634 | 2634 |
| 2635 const bool right_needs_check = | 2635 const bool right_needs_check = |
| 2636 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); | 2636 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); |
| 2637 if (is_truncating) { | 2637 if (is_truncating) { |
| 2638 if (right_needs_check) { | 2638 if (right_needs_check) { |
| 2639 const bool right_may_be_negative = | 2639 const bool right_may_be_negative = |
| 2640 (right_range == NULL) || | 2640 (right_range == NULL) || right_range->IsNegative(); |
| 2641 !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); | |
| 2642 if (right_may_be_negative) { | 2641 if (right_may_be_negative) { |
| 2643 ASSERT(shift_left->CanDeoptimize()); | 2642 ASSERT(shift_left->CanDeoptimize()); |
| 2644 __ bltz(right, deopt); | 2643 __ bltz(right, deopt); |
| 2645 } | 2644 } |
| 2646 Label done, is_not_zero; | 2645 Label done, is_not_zero; |
| 2647 | 2646 |
| 2648 __ sltiu(CMPRES1, | 2647 __ sltiu(CMPRES1, |
| 2649 right, Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); | 2648 right, Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); |
| 2650 __ movz(result, ZR, CMPRES1); // result = right >= kBits ? 0 : result. | 2649 __ movz(result, ZR, CMPRES1); // result = right >= kBits ? 0 : result. |
| 2651 __ sra(TMP, right, kSmiTagSize); | 2650 __ sra(TMP, right, kSmiTagSize); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2971 // } | 2970 // } |
| 2972 Label done; | 2971 Label done; |
| 2973 __ bgez(result, &done); | 2972 __ bgez(result, &done); |
| 2974 if ((right_range == NULL) || right_range->Overlaps(-1, 1)) { | 2973 if ((right_range == NULL) || right_range->Overlaps(-1, 1)) { |
| 2975 Label subtract; | 2974 Label subtract; |
| 2976 __ bltz(right, &subtract); | 2975 __ bltz(right, &subtract); |
| 2977 __ addu(result, result, TMP); | 2976 __ addu(result, result, TMP); |
| 2978 __ b(&done); | 2977 __ b(&done); |
| 2979 __ Bind(&subtract); | 2978 __ Bind(&subtract); |
| 2980 __ subu(result, result, TMP); | 2979 __ subu(result, result, TMP); |
| 2981 } else if (right_range->IsWithin(0, RangeBoundary::kPlusInfinity)) { | 2980 } else if (right_range->IsPositive()) { |
| 2982 // Right is positive. | 2981 // Right is positive. |
| 2983 __ addu(result, result, TMP); | 2982 __ addu(result, result, TMP); |
| 2984 } else { | 2983 } else { |
| 2985 // Right is negative. | 2984 // Right is negative. |
| 2986 __ subu(result, result, TMP); | 2985 __ subu(result, result, TMP); |
| 2987 } | 2986 } |
| 2988 __ Bind(&done); | 2987 __ Bind(&done); |
| 2989 __ SmiTag(result); | 2988 __ SmiTag(result); |
| 2990 break; | 2989 break; |
| 2991 } | 2990 } |
| 2992 case Token::kSHR: { | 2991 case Token::kSHR: { |
| 2993 Register temp = locs()->temp(0).reg(); | 2992 Register temp = locs()->temp(0).reg(); |
| 2994 if (CanDeoptimize()) { | 2993 if (CanDeoptimize()) { |
| 2995 __ bltz(right, deopt); | 2994 __ bltz(right, deopt); |
| 2996 } | 2995 } |
| 2997 __ SmiUntag(temp, right); | 2996 __ SmiUntag(temp, right); |
| 2998 // sra operation masks the count to 5 bits. | 2997 // sra operation masks the count to 5 bits. |
| 2999 const intptr_t kCountLimit = 0x1F; | 2998 const intptr_t kCountLimit = 0x1F; |
| 3000 if ((right_range == NULL) || | 2999 if ((right_range == NULL) || |
| 3001 !right_range->IsWithin(RangeBoundary::kMinusInfinity, kCountLimit)) { | 3000 !right_range->OnlyLessThanOrEqualTo(kCountLimit)) { |
| 3002 Label ok; | 3001 Label ok; |
| 3003 __ BranchSignedLessEqual(temp, kCountLimit, &ok); | 3002 __ BranchSignedLessEqual(temp, kCountLimit, &ok); |
| 3004 __ LoadImmediate(temp, kCountLimit); | 3003 __ LoadImmediate(temp, kCountLimit); |
| 3005 __ Bind(&ok); | 3004 __ Bind(&ok); |
| 3006 } | 3005 } |
| 3007 | 3006 |
| 3008 __ SmiUntag(CMPRES1, left); | 3007 __ SmiUntag(CMPRES1, left); |
| 3009 __ srav(result, CMPRES1, temp); | 3008 __ srav(result, CMPRES1, temp); |
| 3010 __ SmiTag(result); | 3009 __ SmiTag(result); |
| 3011 break; | 3010 break; |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4191 // } | 4190 // } |
| 4192 Label done; | 4191 Label done; |
| 4193 __ bgez(result_mod, &done); | 4192 __ bgez(result_mod, &done); |
| 4194 if ((right_range == NULL) || right_range->Overlaps(-1, 1)) { | 4193 if ((right_range == NULL) || right_range->Overlaps(-1, 1)) { |
| 4195 Label subtract; | 4194 Label subtract; |
| 4196 __ bltz(right, &subtract); | 4195 __ bltz(right, &subtract); |
| 4197 __ addu(result_mod, result_mod, TMP); | 4196 __ addu(result_mod, result_mod, TMP); |
| 4198 __ b(&done); | 4197 __ b(&done); |
| 4199 __ Bind(&subtract); | 4198 __ Bind(&subtract); |
| 4200 __ subu(result_mod, result_mod, TMP); | 4199 __ subu(result_mod, result_mod, TMP); |
| 4201 } else if (right_range->IsWithin(0, RangeBoundary::kPlusInfinity)) { | 4200 } else if (right_range->IsPositive()) { |
| 4202 // Right is positive. | 4201 // Right is positive. |
| 4203 __ addu(result_mod, result_mod, TMP); | 4202 __ addu(result_mod, result_mod, TMP); |
| 4204 } else { | 4203 } else { |
| 4205 // Right is negative. | 4204 // Right is negative. |
| 4206 __ subu(result_mod, result_mod, TMP); | 4205 __ subu(result_mod, result_mod, TMP); |
| 4207 } | 4206 } |
| 4208 __ Bind(&done); | 4207 __ Bind(&done); |
| 4209 | 4208 |
| 4210 __ SmiTag(result_div); | 4209 __ SmiTag(result_div); |
| 4211 __ SmiTag(result_mod); | 4210 __ SmiTag(result_mod); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4681 compiler->GenerateCall(token_pos(), | 4680 compiler->GenerateCall(token_pos(), |
| 4682 &label, | 4681 &label, |
| 4683 PcDescriptors::kOther, | 4682 PcDescriptors::kOther, |
| 4684 locs()); | 4683 locs()); |
| 4685 __ Drop(ArgumentCount()); // Discard arguments. | 4684 __ Drop(ArgumentCount()); // Discard arguments. |
| 4686 } | 4685 } |
| 4687 | 4686 |
| 4688 } // namespace dart | 4687 } // namespace dart |
| 4689 | 4688 |
| 4690 #endif // defined TARGET_ARCH_MIPS | 4689 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |