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_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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2202 if (deopt != NULL) __ j(OVERFLOW, deopt); | 2202 if (deopt != NULL) __ j(OVERFLOW, deopt); |
| 2203 break; | 2203 break; |
| 2204 case Token::kSUB: { | 2204 case Token::kSUB: { |
| 2205 __ subl(left, Immediate(imm)); | 2205 __ subl(left, Immediate(imm)); |
| 2206 if (deopt != NULL) __ j(OVERFLOW, deopt); | 2206 if (deopt != NULL) __ j(OVERFLOW, deopt); |
| 2207 break; | 2207 break; |
| 2208 } | 2208 } |
| 2209 case Token::kMUL: { | 2209 case Token::kMUL: { |
| 2210 // Keep left value tagged and untag right value. | 2210 // Keep left value tagged and untag right value. |
| 2211 const intptr_t value = Smi::Cast(constant).Value(); | 2211 const intptr_t value = Smi::Cast(constant).Value(); |
| 2212 __ imull(left, Immediate(value)); | 2212 if (value == 2) { |
|
bakster
2013/03/19 13:22:44
What about 4, 8, 16 etc?
Florian Schneider
2013/03/19 13:24:33
shl does not set the overflow flag for other than
bakster
2013/03/19 13:31:25
I guess you than can unroll into repeated shl(1) :
ahe
2013/03/19 14:13:11
What about a compare?
| |
| 2213 __ shll(left, Immediate(1)); | |
| 2214 } else { | |
| 2215 __ imull(left, Immediate(value)); | |
| 2216 } | |
| 2213 if (deopt != NULL) __ j(OVERFLOW, deopt); | 2217 if (deopt != NULL) __ j(OVERFLOW, deopt); |
| 2214 break; | 2218 break; |
| 2215 } | 2219 } |
| 2216 case Token::kTRUNCDIV: { | 2220 case Token::kTRUNCDIV: { |
| 2217 const intptr_t value = Smi::Cast(constant).Value(); | 2221 const intptr_t value = Smi::Cast(constant).Value(); |
| 2218 if (value == 1) { | 2222 if (value == 1) { |
| 2219 // Do nothing. | 2223 // Do nothing. |
| 2220 break; | 2224 break; |
| 2221 } else if (value == -1) { | 2225 } else if (value == -1) { |
| 2222 // Check the corner case of dividing the 'MIN_SMI' with -1, in which | 2226 // Check the corner case of dividing the 'MIN_SMI' with -1, in which |
| (...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3559 PcDescriptors::kOther, | 3563 PcDescriptors::kOther, |
| 3560 locs()); | 3564 locs()); |
| 3561 __ Drop(2); // Discard type arguments and receiver. | 3565 __ Drop(2); // Discard type arguments and receiver. |
| 3562 } | 3566 } |
| 3563 | 3567 |
| 3564 } // namespace dart | 3568 } // namespace dart |
| 3565 | 3569 |
| 3566 #undef __ | 3570 #undef __ |
| 3567 | 3571 |
| 3568 #endif // defined TARGET_ARCH_IA32 | 3572 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |