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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 __ SmiUntag(left); | 1662 __ SmiUntag(left); |
1663 __ sarq(left, right); | 1663 __ sarq(left, right); |
1664 __ SmiTag(left); | 1664 __ SmiTag(left); |
1665 break; | 1665 break; |
1666 } | 1666 } |
1667 case Token::kSHL: { | 1667 case Token::kSHL: { |
1668 Register temp = locs()->temp(0).reg(); | 1668 Register temp = locs()->temp(0).reg(); |
1669 Label call_method, done; | 1669 Label call_method, done; |
1670 // Check if count too large for handling it inlined. | 1670 // Check if count too large for handling it inlined. |
1671 __ movq(temp, left); | 1671 __ movq(temp, left); |
1672 __ cmpq(right, | 1672 Range* right_range = this->right()->definition()->range(); |
1673 Immediate(reinterpret_cast<int64_t>(Smi::New(Smi::kBits)))); | 1673 const bool right_needs_check = |
1674 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); | 1674 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); |
| 1675 if (right_needs_check) { |
| 1676 __ cmpq(right, |
| 1677 Immediate(reinterpret_cast<int64_t>(Smi::New(Smi::kBits)))); |
| 1678 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); |
| 1679 } |
1675 Register right_temp = locs()->temp(1).reg(); | 1680 Register right_temp = locs()->temp(1).reg(); |
1676 ASSERT(right_temp == RCX); // Count must be in RCX | 1681 ASSERT(right_temp == RCX); // Count must be in RCX |
1677 __ movq(right_temp, right); | 1682 __ movq(right_temp, right); |
1678 __ SmiUntag(right_temp); | 1683 __ SmiUntag(right_temp); |
1679 // Overflow test (preserve temp and right); | 1684 // Overflow test (preserve temp and right); |
1680 __ shlq(left, right_temp); | 1685 __ shlq(left, right_temp); |
1681 __ sarq(left, right_temp); | 1686 __ sarq(left, right_temp); |
1682 __ cmpq(left, temp); | 1687 __ cmpq(left, temp); |
1683 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. | 1688 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. |
1684 // Shift for result now we know there is no overflow. | 1689 // Shift for result now we know there is no overflow. |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 | 2275 |
2271 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2276 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2272 UNIMPLEMENTED(); | 2277 UNIMPLEMENTED(); |
2273 } | 2278 } |
2274 | 2279 |
2275 } // namespace dart | 2280 } // namespace dart |
2276 | 2281 |
2277 #undef __ | 2282 #undef __ |
2278 | 2283 |
2279 #endif // defined TARGET_ARCH_X64 | 2284 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |