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 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 __ SmiUntag(left); | 1696 __ SmiUntag(left); |
1697 __ sarq(left, right); | 1697 __ sarq(left, right); |
1698 __ SmiTag(left); | 1698 __ SmiTag(left); |
1699 break; | 1699 break; |
1700 } | 1700 } |
1701 case Token::kSHL: { | 1701 case Token::kSHL: { |
1702 Register temp = locs()->temp(0).reg(); | 1702 Register temp = locs()->temp(0).reg(); |
1703 Label call_method, done; | 1703 Label call_method, done; |
1704 // Check if count too large for handling it inlined. | 1704 // Check if count too large for handling it inlined. |
1705 __ movq(temp, left); | 1705 __ movq(temp, left); |
1706 __ cmpq(right, | 1706 Range* right_range = this->right()->definition()->range(); |
1707 Immediate(reinterpret_cast<int64_t>(Smi::New(Smi::kBits)))); | 1707 const bool right_needs_check = |
1708 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); | 1708 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); |
| 1709 if (right_needs_check) { |
| 1710 __ cmpq(right, |
| 1711 Immediate(reinterpret_cast<int64_t>(Smi::New(Smi::kBits)))); |
| 1712 __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump); |
| 1713 } |
1709 Register right_temp = locs()->temp(1).reg(); | 1714 Register right_temp = locs()->temp(1).reg(); |
1710 ASSERT(right_temp == RCX); // Count must be in RCX | 1715 ASSERT(right_temp == RCX); // Count must be in RCX |
1711 __ movq(right_temp, right); | 1716 __ movq(right_temp, right); |
1712 __ SmiUntag(right_temp); | 1717 __ SmiUntag(right_temp); |
1713 // Overflow test (preserve temp and right); | 1718 // Overflow test (preserve temp and right); |
1714 __ shlq(left, right_temp); | 1719 __ shlq(left, right_temp); |
1715 __ sarq(left, right_temp); | 1720 __ sarq(left, right_temp); |
1716 __ cmpq(left, temp); | 1721 __ cmpq(left, temp); |
1717 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. | 1722 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); // Overflow. |
1718 // Shift for result now we know there is no overflow. | 1723 // Shift for result now we know there is no overflow. |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2283 | 2288 |
2284 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2289 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2285 UNIMPLEMENTED(); | 2290 UNIMPLEMENTED(); |
2286 } | 2291 } |
2287 | 2292 |
2288 } // namespace dart | 2293 } // namespace dart |
2289 | 2294 |
2290 #undef __ | 2295 #undef __ |
2291 | 2296 |
2292 #endif // defined TARGET_ARCH_X64 | 2297 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |