Chromium Code Reviews| Index: src/compiler/arm/code-generator-arm.cc |
| diff --git a/src/compiler/arm/code-generator-arm.cc b/src/compiler/arm/code-generator-arm.cc |
| index a9db0539b17d6a95e8ac21e72052d3baaacea7bf..7b4422a98fcd772c90691b930c111d92e8c953c1 100644 |
| --- a/src/compiler/arm/code-generator-arm.cc |
| +++ b/src/compiler/arm/code-generator-arm.cc |
| @@ -1121,6 +1121,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
| SwVfpRegister scratch = kScratchDoubleReg.low(); |
| __ vcvt_s32_f32(scratch, i.InputFloatRegister(0)); |
| __ vmov(i.OutputRegister(), scratch); |
| + // Avoid INT32_MAX as an overflow indicator and use INT32_MIN instead, |
| + // because INT32_MIN allows easier out-of-bounds detection. |
| + __ cmn(i.OutputRegister(), Operand(1)); |
| + __ add(i.OutputRegister(), i.OutputRegister(), Operand(1), SBit::LeaveCC, |
|
Rodolph Perfetta (ARM)
2016/06/29 14:45:08
on arm32 INT32_MIN is a valid immediate so the fol
ahaas
2016/06/29 15:07:33
Done.
|
| + vs); |
| DCHECK_EQ(LeaveCC, i.OutputSBit()); |
| break; |
| } |
| @@ -1128,6 +1133,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
| SwVfpRegister scratch = kScratchDoubleReg.low(); |
| __ vcvt_u32_f32(scratch, i.InputFloatRegister(0)); |
| __ vmov(i.OutputRegister(), scratch); |
| + // Avoid UINT32_MAX as an overflow indicator and use 0 instead, |
| + // because 0 allows easier out-of-bounds detection. |
| + __ cmn(i.OutputRegister(), Operand(1)); |
| + __ add(i.OutputRegister(), i.OutputRegister(), Operand(1), SBit::LeaveCC, |
|
Rodolph Perfetta (ARM)
2016/06/29 14:45:08
using adc would remove the dependency on the flags
ahaas
2016/06/29 14:49:42
Is adc better than the mov instruction we use for
ahaas
2016/06/29 15:07:33
Done.
|
| + cs); |
| DCHECK_EQ(LeaveCC, i.OutputSBit()); |
| break; |
| } |