OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 __ SmiUntag(left); | 1731 __ SmiUntag(left); |
1732 __ sarl(left, right); | 1732 __ sarl(left, right); |
1733 __ SmiTag(left); | 1733 __ SmiTag(left); |
1734 break; | 1734 break; |
1735 } | 1735 } |
1736 case Token::kSHL: { | 1736 case Token::kSHL: { |
1737 Register temp = locs()->temp(0).reg(); | 1737 Register temp = locs()->temp(0).reg(); |
1738 Label call_method, done; | 1738 Label call_method, done; |
1739 // Check if count too large for handling it inlined. | 1739 // Check if count too large for handling it inlined. |
1740 __ movl(temp, left); | 1740 __ movl(temp, left); |
1741 __ cmpl(right, | 1741 Range* right_range = this->right()->definition()->range(); |
| 1742 const bool right_needs_check = |
| 1743 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); |
| 1744 if (right_needs_check) { |
| 1745 __ cmpl(right, |
1742 Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); | 1746 Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); |
1743 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); | 1747 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); |
| 1748 } |
1744 Register right_temp = locs()->temp(1).reg(); | 1749 Register right_temp = locs()->temp(1).reg(); |
1745 ASSERT(right_temp == ECX); // Count must be in ECX | 1750 ASSERT(right_temp == ECX); // Count must be in ECX |
1746 __ movl(right_temp, right); | 1751 __ movl(right_temp, right); |
1747 __ SmiUntag(right_temp); | 1752 __ SmiUntag(right_temp); |
1748 // Overflow test (preserve temp and right); | 1753 // Overflow test (preserve temp and right); |
1749 __ shll(left, right_temp); | 1754 __ shll(left, right_temp); |
1750 __ sarl(left, right_temp); | 1755 __ sarl(left, right_temp); |
1751 __ cmpl(left, temp); | 1756 __ cmpl(left, temp); |
1752 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. | 1757 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. |
1753 // Shift for result now we know there is no overflow. | 1758 // Shift for result now we know there is no overflow. |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. | 2563 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. |
2559 __ pxor(value, XMM0); | 2564 __ pxor(value, XMM0); |
2560 } | 2565 } |
2561 | 2566 |
2562 | 2567 |
2563 } // namespace dart | 2568 } // namespace dart |
2564 | 2569 |
2565 #undef __ | 2570 #undef __ |
2566 | 2571 |
2567 #endif // defined TARGET_ARCH_X64 | 2572 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |