| 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 6070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6081 // Code for a constant shift amount. | 6081 // Code for a constant shift amount. |
| 6082 ASSERT(locs()->in(1).constant().IsSmi()); | 6082 ASSERT(locs()->in(1).constant().IsSmi()); |
| 6083 const int32_t shift = | 6083 const int32_t shift = |
| 6084 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; | 6084 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; |
| 6085 switch (op_kind()) { | 6085 switch (op_kind()) { |
| 6086 case Token::kSHR: { | 6086 case Token::kSHR: { |
| 6087 if (shift > 31) { | 6087 if (shift > 31) { |
| 6088 __ movl(left_lo, left_hi); // Shift by 32. | 6088 __ movl(left_lo, left_hi); // Shift by 32. |
| 6089 __ sarl(left_hi, Immediate(31)); // Sign extend left hi. | 6089 __ sarl(left_hi, Immediate(31)); // Sign extend left hi. |
| 6090 if (shift > 32) { | 6090 if (shift > 32) { |
| 6091 __ sarl(left_lo, Immediate(shift - 32)); | 6091 __ sarl(left_lo, Immediate(shift > 63 ? 31 : shift - 32)); |
| 6092 } | 6092 } |
| 6093 } else { | 6093 } else { |
| 6094 __ shrdl(left_lo, left_hi, Immediate(shift)); | 6094 __ shrdl(left_lo, left_hi, Immediate(shift)); |
| 6095 __ sarl(left_hi, Immediate(shift)); | 6095 __ sarl(left_hi, Immediate(shift)); |
| 6096 } | 6096 } |
| 6097 break; | 6097 break; |
| 6098 } | 6098 } |
| 6099 case Token::kSHL: { | 6099 case Token::kSHL: { |
| 6100 ASSERT(shift < 64); |
| 6100 if (can_overflow()) { | 6101 if (can_overflow()) { |
| 6101 Register temp1 = locs()->temp(0).reg(); | 6102 Register temp1 = locs()->temp(0).reg(); |
| 6102 Register temp2 = locs()->temp(1).reg(); | 6103 Register temp2 = locs()->temp(1).reg(); |
| 6103 __ movl(temp1, left_hi); // Preserve high 32 bits. | 6104 __ movl(temp1, left_hi); // Preserve high 32 bits. |
| 6104 if (shift > 31) { | 6105 if (shift > 31) { |
| 6105 __ movl(left_hi, left_lo); // Shift by 32. | 6106 __ movl(left_hi, left_lo); // Shift by 32. |
| 6106 if (shift > 32) { | 6107 if (shift > 32) { |
| 6107 __ shll(left_hi, Immediate(shift - 32)); | 6108 __ shll(left_hi, Immediate(shift - 32)); |
| 6108 } | 6109 } |
| 6109 // Check for overflow by sign extending the high 32 bits | 6110 // Check for overflow by sign extending the high 32 bits |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6871 __ Drop(1); | 6872 __ Drop(1); |
| 6872 __ popl(result); | 6873 __ popl(result); |
| 6873 } | 6874 } |
| 6874 | 6875 |
| 6875 | 6876 |
| 6876 } // namespace dart | 6877 } // namespace dart |
| 6877 | 6878 |
| 6878 #undef __ | 6879 #undef __ |
| 6879 | 6880 |
| 6880 #endif // defined TARGET_ARCH_IA32 | 6881 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |