Chromium Code Reviews| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 6203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6214 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; | 6214 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; |
| 6215 switch (op_kind()) { | 6215 switch (op_kind()) { |
| 6216 case Token::kSHR: { | 6216 case Token::kSHR: { |
| 6217 if (shift < 32) { | 6217 if (shift < 32) { |
| 6218 __ Lsl(out_lo, left_hi, Operand(32 - shift)); | 6218 __ Lsl(out_lo, left_hi, Operand(32 - shift)); |
| 6219 __ orr(out_lo, out_lo, Operand(left_lo, LSR, shift)); | 6219 __ orr(out_lo, out_lo, Operand(left_lo, LSR, shift)); |
| 6220 __ Asr(out_hi, left_hi, Operand(shift)); | 6220 __ Asr(out_hi, left_hi, Operand(shift)); |
| 6221 } else { | 6221 } else { |
| 6222 if (shift == 32) { | 6222 if (shift == 32) { |
| 6223 __ mov(out_lo, Operand(left_hi)); | 6223 __ mov(out_lo, Operand(left_hi)); |
| 6224 } else if (shift < 64) { | |
| 6225 __ Asr(out_lo, left_hi, Operand(shift - 32)); | |
| 6224 } else { | 6226 } else { |
| 6225 __ Asr(out_lo, left_hi, Operand(shift - 32)); | 6227 __ Asr(out_lo, left_hi, Operand(31)); |
|
regis
2015/10/06 17:37:24
The fix looks good if the constant right shift amo
Florian Schneider
2015/10/07 09:44:11
Yes, the regression test shows that this can be th
| |
| 6226 } | 6228 } |
| 6227 __ Asr(out_hi, left_hi, Operand(31)); | 6229 __ Asr(out_hi, left_hi, Operand(31)); |
| 6228 } | 6230 } |
| 6229 break; | 6231 break; |
| 6230 } | 6232 } |
| 6231 case Token::kSHL: { | 6233 case Token::kSHL: { |
| 6232 if (shift < 32) { | 6234 if (shift < 32) { |
| 6233 __ Lsr(out_hi, left_lo, Operand(32 - shift)); | 6235 __ Lsr(out_hi, left_lo, Operand(32 - shift)); |
| 6234 __ orr(out_hi, out_hi, Operand(left_hi, LSL, shift)); | 6236 __ orr(out_hi, out_hi, Operand(left_hi, LSL, shift)); |
| 6235 __ Lsl(out_lo, left_lo, Operand(shift)); | 6237 __ Lsl(out_lo, left_lo, Operand(shift)); |
| 6236 } else { | 6238 } else { |
| 6237 if (shift == 32) { | 6239 if (shift == 32) { |
| 6238 __ mov(out_hi, Operand(left_lo)); | 6240 __ mov(out_hi, Operand(left_lo)); |
| 6239 } else { | 6241 } else { |
| 6240 __ Lsl(out_hi, left_lo, Operand(shift - 32)); | 6242 __ Lsl(out_hi, left_lo, Operand(shift - 32)); |
|
regis
2015/10/06 17:37:24
If the constant left shift amount can be >= 64, th
Florian Schneider
2015/10/07 09:44:11
For left shift the result woud be a bigint in this
| |
| 6241 } | 6243 } |
| 6242 __ mov(out_lo, Operand(0)); | 6244 __ mov(out_lo, Operand(0)); |
| 6243 } | 6245 } |
| 6244 // Check for overflow. | 6246 // Check for overflow. |
| 6245 if (can_overflow()) { | 6247 if (can_overflow()) { |
| 6246 // Compare high word from input with shifted high word from output. | 6248 // Compare high word from input with shifted high word from output. |
| 6247 // If shift > 32, also compare low word from input with high word from | 6249 // If shift > 32, also compare low word from input with high word from |
| 6248 // output shifted back shift - 32. | 6250 // output shifted back shift - 32. |
| 6249 if (shift > 32) { | 6251 if (shift > 32) { |
| 6250 __ cmp(left_lo, Operand(out_hi, ASR, shift - 32)); | 6252 __ cmp(left_lo, Operand(out_hi, ASR, shift - 32)); |
|
regis
2015/10/06 17:37:24
ditto
| |
| 6251 __ cmp(left_hi, Operand(out_hi, ASR, 31), EQ); | 6253 __ cmp(left_hi, Operand(out_hi, ASR, 31), EQ); |
| 6252 } else if (shift == 32) { | 6254 } else if (shift == 32) { |
| 6253 __ cmp(left_hi, Operand(out_hi, ASR, 31)); | 6255 __ cmp(left_hi, Operand(out_hi, ASR, 31)); |
| 6254 } else { | 6256 } else { |
| 6255 __ cmp(left_hi, Operand(out_hi, ASR, shift)); | 6257 __ cmp(left_hi, Operand(out_hi, ASR, shift)); |
| 6256 } | 6258 } |
| 6257 // Overflow if they aren't equal. | 6259 // Overflow if they aren't equal. |
| 6258 __ b(deopt, NE); | 6260 __ b(deopt, NE); |
| 6259 } | 6261 } |
| 6260 break; | 6262 break; |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6857 1, | 6859 1, |
| 6858 locs()); | 6860 locs()); |
| 6859 __ Drop(1); | 6861 __ Drop(1); |
| 6860 __ Pop(result); | 6862 __ Pop(result); |
| 6861 } | 6863 } |
| 6862 | 6864 |
| 6863 | 6865 |
| 6864 } // namespace dart | 6866 } // namespace dart |
| 6865 | 6867 |
| 6866 #endif // defined TARGET_ARCH_ARM | 6868 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |