Chromium Code Reviews| Index: src/compiler/arm64/code-generator-arm64.cc |
| diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc |
| index 280a53712b70f88afb9e7cb0ef202771c42f8631..ef0344e16269c0f40561f88eb26047debe5b63fa 100644 |
| --- a/src/compiler/arm64/code-generator-arm64.cc |
| +++ b/src/compiler/arm64/code-generator-arm64.cc |
| @@ -1323,12 +1323,21 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
| break; |
| case kArm64Float32ToInt32: |
| __ Fcvtzs(i.OutputRegister32(), i.InputFloat32Register(0)); |
| + // Avoid INT32_MAX as an overflow indicator and use INT32_MIN instead, |
| + // because INT32_MIN allows easier out-of-bounds detection. |
| + __ Cmn(i.OutputRegister32(), 1); |
| + __ Csinc(i.OutputRegister32(), i.OutputRegister32(), i.OutputRegister32(), |
| + vc); |
| break; |
| case kArm64Float64ToInt32: |
| __ Fcvtzs(i.OutputRegister32(), i.InputDoubleRegister(0)); |
| break; |
| case kArm64Float32ToUint32: |
| __ Fcvtzu(i.OutputRegister32(), i.InputFloat32Register(0)); |
| + // Avoid UINT32_MAX as an overflow indicator and use 0 instead, |
| + // because 0 allows easier out-of-bounds detection. |
| + __ Cmn(i.OutputRegister32(), 1); |
| + __ Adc(i.OutputRegister(), i.OutputRegister(), Operand(0)); |
|
Rodolph Perfetta (ARM)
2016/06/29 15:42:18
i.OutputRegister32(), I made the mistake in my pre
ahaas
2016/06/29 15:49:53
Done. Thanks for looking at it so carefully again.
|
| break; |
| case kArm64Float64ToUint32: |
| __ Fcvtzu(i.OutputRegister32(), i.InputDoubleRegister(0)); |