| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2705 const Object& obj = shift_left->left()->BoundConstant(); | 2705 const Object& obj = shift_left->left()->BoundConstant(); |
| 2706 if (obj.IsSmi()) { | 2706 if (obj.IsSmi()) { |
| 2707 const intptr_t left_int = Smi::Cast(obj).Value(); | 2707 const intptr_t left_int = Smi::Cast(obj).Value(); |
| 2708 if (left_int == 0) { | 2708 if (left_int == 0) { |
| 2709 __ cmpl(right, Immediate(0)); | 2709 __ cmpl(right, Immediate(0)); |
| 2710 __ j(NEGATIVE, deopt); | 2710 __ j(NEGATIVE, deopt); |
| 2711 return; | 2711 return; |
| 2712 } | 2712 } |
| 2713 const intptr_t max_right = kSmiBits - Utils::HighestBit(left_int); | 2713 const intptr_t max_right = kSmiBits - Utils::HighestBit(left_int); |
| 2714 const bool right_needs_check = | 2714 const bool right_needs_check = |
| 2715 (right_range == NULL) || | 2715 !RangeUtils::IsWithin(right_range, 0, max_right - 1); |
| 2716 !right_range->IsWithin(0, max_right - 1); | |
| 2717 if (right_needs_check) { | 2716 if (right_needs_check) { |
| 2718 __ cmpl(right, | 2717 __ cmpl(right, |
| 2719 Immediate(reinterpret_cast<int32_t>(Smi::New(max_right)))); | 2718 Immediate(reinterpret_cast<int32_t>(Smi::New(max_right)))); |
| 2720 __ j(ABOVE_EQUAL, deopt); | 2719 __ j(ABOVE_EQUAL, deopt); |
| 2721 } | 2720 } |
| 2722 __ SmiUntag(right); | 2721 __ SmiUntag(right); |
| 2723 __ shll(left, right); | 2722 __ shll(left, right); |
| 2724 } | 2723 } |
| 2725 return; | 2724 return; |
| 2726 } | 2725 } |
| 2727 | 2726 |
| 2728 const bool right_needs_check = | 2727 const bool right_needs_check = |
| 2729 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); | 2728 !RangeUtils::IsWithin(right_range, 0, (Smi::kBits - 1)); |
| 2730 ASSERT(right == ECX); // Count must be in ECX | 2729 ASSERT(right == ECX); // Count must be in ECX |
| 2731 if (is_truncating) { | 2730 if (is_truncating) { |
| 2732 if (right_needs_check) { | 2731 if (right_needs_check) { |
| 2733 const bool right_may_be_negative = | 2732 const bool right_may_be_negative = |
| 2734 (right_range == NULL) || !right_range->IsPositive(); | 2733 (right_range == NULL) || !right_range->IsPositive(); |
| 2735 if (right_may_be_negative) { | 2734 if (right_may_be_negative) { |
| 2736 ASSERT(shift_left->CanDeoptimize()); | 2735 ASSERT(shift_left->CanDeoptimize()); |
| 2737 __ cmpl(right, Immediate(0)); | 2736 __ cmpl(right, Immediate(0)); |
| 2738 __ j(NEGATIVE, deopt); | 2737 __ j(NEGATIVE, deopt); |
| 2739 } | 2738 } |
| (...skipping 3247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5987 summary->set_temp(1, Location::RequiresRegister()); | 5986 summary->set_temp(1, Location::RequiresRegister()); |
| 5988 } | 5987 } |
| 5989 summary->set_out(0, Location::SameAsFirstInput()); | 5988 summary->set_out(0, Location::SameAsFirstInput()); |
| 5990 return summary; | 5989 return summary; |
| 5991 } | 5990 } |
| 5992 | 5991 |
| 5993 | 5992 |
| 5994 static const intptr_t kMintShiftCountLimit = 63; | 5993 static const intptr_t kMintShiftCountLimit = 63; |
| 5995 | 5994 |
| 5996 bool ShiftMintOpInstr::has_shift_count_check() const { | 5995 bool ShiftMintOpInstr::has_shift_count_check() const { |
| 5997 return (right()->definition()->range() == NULL) | 5996 return !RangeUtils::IsWithin( |
| 5998 || !right()->definition()->range()->IsWithin(0, kMintShiftCountLimit); | 5997 right()->definition()->range(), 0, kMintShiftCountLimit); |
| 5999 } | 5998 } |
| 6000 | 5999 |
| 6001 | 6000 |
| 6002 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6001 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6003 PairLocation* left_pair = locs()->in(0).AsPairLocation(); | 6002 PairLocation* left_pair = locs()->in(0).AsPairLocation(); |
| 6004 Register left_lo = left_pair->At(0).reg(); | 6003 Register left_lo = left_pair->At(0).reg(); |
| 6005 Register left_hi = left_pair->At(1).reg(); | 6004 Register left_hi = left_pair->At(1).reg(); |
| 6006 PairLocation* out_pair = locs()->out(0).AsPairLocation(); | 6005 PairLocation* out_pair = locs()->out(0).AsPairLocation(); |
| 6007 Register out_lo = out_pair->At(0).reg(); | 6006 Register out_lo = out_pair->At(0).reg(); |
| 6008 Register out_hi = out_pair->At(1).reg(); | 6007 Register out_hi = out_pair->At(1).reg(); |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7029 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 7028 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 7030 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 7029 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 7031 #endif | 7030 #endif |
| 7032 } | 7031 } |
| 7033 | 7032 |
| 7034 } // namespace dart | 7033 } // namespace dart |
| 7035 | 7034 |
| 7036 #undef __ | 7035 #undef __ |
| 7037 | 7036 |
| 7038 #endif // defined TARGET_ARCH_IA32 | 7037 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |