| 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 6050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6061 } | 6061 } |
| 6062 break; | 6062 break; |
| 6063 } | 6063 } |
| 6064 case Token::kSHL: { | 6064 case Token::kSHL: { |
| 6065 if (can_overflow()) { | 6065 if (can_overflow()) { |
| 6066 Register temp1 = locs()->temp(0).reg(); | 6066 Register temp1 = locs()->temp(0).reg(); |
| 6067 Register temp2 = locs()->temp(1).reg(); | 6067 Register temp2 = locs()->temp(1).reg(); |
| 6068 __ movl(temp1, left_hi); // Preserve high 32 bits. | 6068 __ movl(temp1, left_hi); // Preserve high 32 bits. |
| 6069 if (shift > 31) { | 6069 if (shift > 31) { |
| 6070 __ movl(left_hi, left_lo); // Shift by 32. | 6070 __ movl(left_hi, left_lo); // Shift by 32. |
| 6071 __ xorl(left_lo, left_lo); // Zero left_lo. | |
| 6072 if (shift > 32) { | 6071 if (shift > 32) { |
| 6073 __ shll(left_hi, Immediate(shift - 32)); | 6072 __ shll(left_hi, Immediate(shift - 32)); |
| 6074 } | 6073 } |
| 6075 // Check for overflow by sign extending the high 32 bits | 6074 // Check for overflow by sign extending the high 32 bits |
| 6076 // and comparing with the input. | 6075 // and comparing with the input. |
| 6077 __ movl(temp2, left_hi); | 6076 __ movl(temp2, left_hi); |
| 6078 __ sarl(temp2, Immediate(31)); | 6077 __ sarl(temp2, Immediate(31)); |
| 6079 __ cmpl(temp1, temp2); | 6078 __ cmpl(temp1, temp2); |
| 6080 __ j(NOT_EQUAL, deopt); | 6079 __ j(NOT_EQUAL, deopt); |
| 6080 if (shift > 32) { |
| 6081 // Also compare low word from input with high word from |
| 6082 // output shifted back shift - 32. |
| 6083 __ movl(temp2, left_hi); |
| 6084 __ sarl(temp2, Immediate(shift - 32)); |
| 6085 __ cmpl(left_lo, temp2); |
| 6086 __ j(NOT_EQUAL, deopt); |
| 6087 } |
| 6088 __ xorl(left_lo, left_lo); // Zero left_lo. |
| 6081 } else { | 6089 } else { |
| 6082 __ shldl(left_hi, left_lo, Immediate(shift)); | 6090 __ shldl(left_hi, left_lo, Immediate(shift)); |
| 6083 __ shll(left_lo, Immediate(shift)); | 6091 __ shll(left_lo, Immediate(shift)); |
| 6084 // Check for overflow by shifting back the high 32 bits | 6092 // Check for overflow by shifting back the high 32 bits |
| 6085 // and comparing with the input. | 6093 // and comparing with the input. |
| 6086 __ movl(temp2, left_hi); | 6094 __ movl(temp2, left_hi); |
| 6087 __ sarl(temp2, Immediate(shift)); | 6095 __ sarl(temp2, Immediate(shift)); |
| 6088 __ cmpl(temp1, temp2); | 6096 __ cmpl(temp1, temp2); |
| 6089 __ j(NOT_EQUAL, deopt); | 6097 __ j(NOT_EQUAL, deopt); |
| 6090 } | 6098 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6146 // and comparing with the input. | 6154 // and comparing with the input. |
| 6147 __ movl(temp2, left_hi); | 6155 __ movl(temp2, left_hi); |
| 6148 __ sarl(temp2, ECX); | 6156 __ sarl(temp2, ECX); |
| 6149 __ cmpl(temp1, temp2); | 6157 __ cmpl(temp1, temp2); |
| 6150 __ j(NOT_EQUAL, deopt); | 6158 __ j(NOT_EQUAL, deopt); |
| 6151 __ jmp(&done, Assembler::kNearJump); | 6159 __ jmp(&done, Assembler::kNearJump); |
| 6152 | 6160 |
| 6153 __ Bind(&large_shift); | 6161 __ Bind(&large_shift); |
| 6154 // No need to subtract 32 from CL, only 5 bits used by shll. | 6162 // No need to subtract 32 from CL, only 5 bits used by shll. |
| 6155 __ movl(left_hi, left_lo); // Shift by 32. | 6163 __ movl(left_hi, left_lo); // Shift by 32. |
| 6156 __ xorl(left_lo, left_lo); // Zero left_lo. | |
| 6157 __ shll(left_hi, ECX); // Shift count: CL % 32. | 6164 __ shll(left_hi, ECX); // Shift count: CL % 32. |
| 6158 // Check for overflow by sign extending the high 32 bits | 6165 // Check for overflow by sign extending the high 32 bits |
| 6159 // and comparing with the input. | 6166 // and comparing with the input. |
| 6160 __ movl(temp2, left_hi); | 6167 __ movl(temp2, left_hi); |
| 6161 __ sarl(temp2, Immediate(31)); | 6168 __ sarl(temp2, Immediate(31)); |
| 6162 __ cmpl(temp1, temp2); | 6169 __ cmpl(temp1, temp2); |
| 6163 __ j(NOT_EQUAL, deopt); | 6170 __ j(NOT_EQUAL, deopt); |
| 6171 // Also compare low word from input with high word from |
| 6172 // output shifted back shift - 32. |
| 6173 __ movl(temp2, left_hi); |
| 6174 __ sarl(temp2, ECX); // Shift count: CL % 32. |
| 6175 __ cmpl(left_lo, temp2); |
| 6176 __ j(NOT_EQUAL, deopt); |
| 6177 __ xorl(left_lo, left_lo); // Zero left_lo. |
| 6164 } else { | 6178 } else { |
| 6165 __ cmpl(ECX, Immediate(31)); | 6179 __ cmpl(ECX, Immediate(31)); |
| 6166 __ j(ABOVE, &large_shift); | 6180 __ j(ABOVE, &large_shift); |
| 6167 | 6181 |
| 6168 __ shldl(left_hi, left_lo); // Shift count in CL. | 6182 __ shldl(left_hi, left_lo); // Shift count in CL. |
| 6169 __ shll(left_lo, ECX); // Shift count in CL. | 6183 __ shll(left_lo, ECX); // Shift count in CL. |
| 6170 __ jmp(&done, Assembler::kNearJump); | 6184 __ jmp(&done, Assembler::kNearJump); |
| 6171 | 6185 |
| 6172 __ Bind(&large_shift); | 6186 __ Bind(&large_shift); |
| 6173 // No need to subtract 32 from CL, only 5 bits used by shll. | 6187 // No need to subtract 32 from CL, only 5 bits used by shll. |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6786 #if defined(DEBUG) | 6800 #if defined(DEBUG) |
| 6787 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6801 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 6788 #endif | 6802 #endif |
| 6789 } | 6803 } |
| 6790 | 6804 |
| 6791 } // namespace dart | 6805 } // namespace dart |
| 6792 | 6806 |
| 6793 #undef __ | 6807 #undef __ |
| 6794 | 6808 |
| 6795 #endif // defined TARGET_ARCH_IA32 | 6809 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |