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 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 __ SmiUntag(left); | 1697 __ SmiUntag(left); |
1698 __ sarl(left, right); | 1698 __ sarl(left, right); |
1699 __ SmiTag(left); | 1699 __ SmiTag(left); |
1700 break; | 1700 break; |
1701 } | 1701 } |
1702 case Token::kSHL: { | 1702 case Token::kSHL: { |
1703 Register temp = locs()->temp(0).reg(); | 1703 Register temp = locs()->temp(0).reg(); |
1704 Label call_method, done; | 1704 Label call_method, done; |
1705 // Check if count too large for handling it inlined. | 1705 // Check if count too large for handling it inlined. |
1706 __ movl(temp, left); | 1706 __ movl(temp, left); |
1707 __ cmpl(right, | 1707 Range* right_range = this->right()->definition()->range(); |
| 1708 const bool right_needs_check = |
| 1709 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); |
| 1710 if (right_needs_check) { |
| 1711 __ cmpl(right, |
1708 Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); | 1712 Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); |
1709 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); | 1713 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); |
| 1714 } |
1710 Register right_temp = locs()->temp(1).reg(); | 1715 Register right_temp = locs()->temp(1).reg(); |
1711 ASSERT(right_temp == ECX); // Count must be in ECX | 1716 ASSERT(right_temp == ECX); // Count must be in ECX |
1712 __ movl(right_temp, right); | 1717 __ movl(right_temp, right); |
1713 __ SmiUntag(right_temp); | 1718 __ SmiUntag(right_temp); |
1714 // Overflow test (preserve temp and right); | 1719 // Overflow test (preserve temp and right); |
1715 __ shll(left, right_temp); | 1720 __ shll(left, right_temp); |
1716 __ sarl(left, right_temp); | 1721 __ sarl(left, right_temp); |
1717 __ cmpl(left, temp); | 1722 __ cmpl(left, temp); |
1718 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. | 1723 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. |
1719 // Shift for result now we know there is no overflow. | 1724 // Shift for result now we know there is no overflow. |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2546 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. | 2551 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. |
2547 __ pxor(value, XMM0); | 2552 __ pxor(value, XMM0); |
2548 } | 2553 } |
2549 | 2554 |
2550 | 2555 |
2551 } // namespace dart | 2556 } // namespace dart |
2552 | 2557 |
2553 #undef __ | 2558 #undef __ |
2554 | 2559 |
2555 #endif // defined TARGET_ARCH_X64 | 2560 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |