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 "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2885 if (obj.IsSmi()) { | 2885 if (obj.IsSmi()) { |
2886 const intptr_t left_int = Smi::Cast(obj).Value(); | 2886 const intptr_t left_int = Smi::Cast(obj).Value(); |
2887 if (left_int == 0) { | 2887 if (left_int == 0) { |
2888 __ cmp(right, Operand(0)); | 2888 __ cmp(right, Operand(0)); |
2889 __ b(deopt, MI); | 2889 __ b(deopt, MI); |
2890 __ mov(result, Operand(0)); | 2890 __ mov(result, Operand(0)); |
2891 return; | 2891 return; |
2892 } | 2892 } |
2893 const intptr_t max_right = kSmiBits - Utils::HighestBit(left_int); | 2893 const intptr_t max_right = kSmiBits - Utils::HighestBit(left_int); |
2894 const bool right_needs_check = | 2894 const bool right_needs_check = |
2895 (right_range == NULL) || | 2895 !RangeUtils::IsWithin(right_range, 0, max_right - 1); |
2896 !right_range->IsWithin(0, max_right - 1); | |
2897 if (right_needs_check) { | 2896 if (right_needs_check) { |
2898 __ cmp(right, Operand(reinterpret_cast<int32_t>(Smi::New(max_right)))); | 2897 __ cmp(right, Operand(reinterpret_cast<int32_t>(Smi::New(max_right)))); |
2899 __ b(deopt, CS); | 2898 __ b(deopt, CS); |
2900 } | 2899 } |
2901 __ SmiUntag(IP, right); | 2900 __ SmiUntag(IP, right); |
2902 __ Lsl(result, left, IP); | 2901 __ Lsl(result, left, IP); |
2903 } | 2902 } |
2904 return; | 2903 return; |
2905 } | 2904 } |
2906 | 2905 |
2907 const bool right_needs_check = | 2906 const bool right_needs_check = |
2908 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); | 2907 !RangeUtils::IsWithin(right_range, 0, (Smi::kBits - 1)); |
2909 if (is_truncating) { | 2908 if (is_truncating) { |
2910 if (right_needs_check) { | 2909 if (right_needs_check) { |
2911 const bool right_may_be_negative = | 2910 const bool right_may_be_negative = |
2912 (right_range == NULL) || !right_range->IsPositive(); | 2911 (right_range == NULL) || !right_range->IsPositive(); |
2913 if (right_may_be_negative) { | 2912 if (right_may_be_negative) { |
2914 ASSERT(shift_left->CanDeoptimize()); | 2913 ASSERT(shift_left->CanDeoptimize()); |
2915 __ cmp(right, Operand(0)); | 2914 __ cmp(right, Operand(0)); |
2916 __ b(deopt, MI); | 2915 __ b(deopt, MI); |
2917 } | 2916 } |
2918 | 2917 |
(...skipping 3422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6341 summary->set_in(1, Location::WritableRegisterOrSmiConstant(right())); | 6340 summary->set_in(1, Location::WritableRegisterOrSmiConstant(right())); |
6342 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 6341 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
6343 Location::RequiresRegister())); | 6342 Location::RequiresRegister())); |
6344 return summary; | 6343 return summary; |
6345 } | 6344 } |
6346 | 6345 |
6347 | 6346 |
6348 static const intptr_t kMintShiftCountLimit = 63; | 6347 static const intptr_t kMintShiftCountLimit = 63; |
6349 | 6348 |
6350 bool ShiftMintOpInstr::has_shift_count_check() const { | 6349 bool ShiftMintOpInstr::has_shift_count_check() const { |
6351 return (right()->definition()->range() == NULL) | 6350 return !RangeUtils::IsWithin( |
6352 || !right()->definition()->range()->IsWithin(0, kMintShiftCountLimit); | 6351 right()->definition()->range(), 0, kMintShiftCountLimit); |
6353 } | 6352 } |
6354 | 6353 |
6355 | 6354 |
6356 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6355 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6357 PairLocation* left_pair = locs()->in(0).AsPairLocation(); | 6356 PairLocation* left_pair = locs()->in(0).AsPairLocation(); |
6358 Register left_lo = left_pair->At(0).reg(); | 6357 Register left_lo = left_pair->At(0).reg(); |
6359 Register left_hi = left_pair->At(1).reg(); | 6358 Register left_hi = left_pair->At(1).reg(); |
6360 PairLocation* out_pair = locs()->out(0).AsPairLocation(); | 6359 PairLocation* out_pair = locs()->out(0).AsPairLocation(); |
6361 Register out_lo = out_pair->At(0).reg(); | 6360 Register out_lo = out_pair->At(0).reg(); |
6362 Register out_hi = out_pair->At(1).reg(); | 6361 Register out_hi = out_pair->At(1).reg(); |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7216 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 7215 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
7217 #if defined(DEBUG) | 7216 #if defined(DEBUG) |
7218 __ LoadImmediate(R4, kInvalidObjectPointer); | 7217 __ LoadImmediate(R4, kInvalidObjectPointer); |
7219 __ LoadImmediate(R5, kInvalidObjectPointer); | 7218 __ LoadImmediate(R5, kInvalidObjectPointer); |
7220 #endif | 7219 #endif |
7221 } | 7220 } |
7222 | 7221 |
7223 } // namespace dart | 7222 } // namespace dart |
7224 | 7223 |
7225 #endif // defined TARGET_ARCH_ARM | 7224 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |