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..33ea107d0f3b3e8bbad1037db455c97a0eae0f04 100644 |
| --- a/src/compiler/arm64/code-generator-arm64.cc |
| +++ b/src/compiler/arm64/code-generator-arm64.cc |
| @@ -1323,12 +1323,22 @@ 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); |
| + __ Csinc(i.OutputRegister32(), i.OutputRegister32(), i.OutputRegister32(), |
|
Rodolph Perfetta (ARM)
2016/06/29 14:45:09
as per arm32:
__ Adc(i.OutputRegister(), i.Outp
ahaas
2016/06/29 15:07:33
Done.
|
| + cc); |
| break; |
| case kArm64Float64ToUint32: |
| __ Fcvtzu(i.OutputRegister32(), i.InputDoubleRegister(0)); |