OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 __ Fsqrt(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); | 1351 __ Fsqrt(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); |
1352 break; | 1352 break; |
1353 case kArm64Float32ToFloat64: | 1353 case kArm64Float32ToFloat64: |
1354 __ Fcvt(i.OutputDoubleRegister(), i.InputDoubleRegister(0).S()); | 1354 __ Fcvt(i.OutputDoubleRegister(), i.InputDoubleRegister(0).S()); |
1355 break; | 1355 break; |
1356 case kArm64Float64ToFloat32: | 1356 case kArm64Float64ToFloat32: |
1357 __ Fcvt(i.OutputDoubleRegister().S(), i.InputDoubleRegister(0)); | 1357 __ Fcvt(i.OutputDoubleRegister().S(), i.InputDoubleRegister(0)); |
1358 break; | 1358 break; |
1359 case kArm64Float32ToInt32: | 1359 case kArm64Float32ToInt32: |
1360 __ Fcvtzs(i.OutputRegister32(), i.InputFloat32Register(0)); | 1360 __ Fcvtzs(i.OutputRegister32(), i.InputFloat32Register(0)); |
| 1361 // Avoid INT32_MAX as an overflow indicator and use INT32_MIN instead, |
| 1362 // because INT32_MIN allows easier out-of-bounds detection. |
| 1363 __ Cmn(i.OutputRegister32(), 1); |
| 1364 __ Csinc(i.OutputRegister32(), i.OutputRegister32(), i.OutputRegister32(), |
| 1365 vc); |
1361 break; | 1366 break; |
1362 case kArm64Float64ToInt32: | 1367 case kArm64Float64ToInt32: |
1363 __ Fcvtzs(i.OutputRegister32(), i.InputDoubleRegister(0)); | 1368 __ Fcvtzs(i.OutputRegister32(), i.InputDoubleRegister(0)); |
1364 break; | 1369 break; |
1365 case kArm64Float32ToUint32: | 1370 case kArm64Float32ToUint32: |
1366 __ Fcvtzu(i.OutputRegister32(), i.InputFloat32Register(0)); | 1371 __ Fcvtzu(i.OutputRegister32(), i.InputFloat32Register(0)); |
| 1372 // Avoid UINT32_MAX as an overflow indicator and use 0 instead, |
| 1373 // because 0 allows easier out-of-bounds detection. |
| 1374 __ Cmn(i.OutputRegister32(), 1); |
| 1375 __ Adc(i.OutputRegister32(), i.OutputRegister32(), Operand(0)); |
1367 break; | 1376 break; |
1368 case kArm64Float64ToUint32: | 1377 case kArm64Float64ToUint32: |
1369 __ Fcvtzu(i.OutputRegister32(), i.InputDoubleRegister(0)); | 1378 __ Fcvtzu(i.OutputRegister32(), i.InputDoubleRegister(0)); |
1370 break; | 1379 break; |
1371 case kArm64Float32ToInt64: | 1380 case kArm64Float32ToInt64: |
1372 __ Fcvtzs(i.OutputRegister64(), i.InputFloat32Register(0)); | 1381 __ Fcvtzs(i.OutputRegister64(), i.InputFloat32Register(0)); |
1373 if (i.OutputCount() > 1) { | 1382 if (i.OutputCount() > 1) { |
1374 __ Mov(i.OutputRegister(1), 1); | 1383 __ Mov(i.OutputRegister(1), 1); |
1375 Label done; | 1384 Label done; |
1376 __ Cmp(i.OutputRegister(0), 1); | 1385 __ Cmp(i.OutputRegister(0), 1); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 padding_size -= kInstructionSize; | 2031 padding_size -= kInstructionSize; |
2023 } | 2032 } |
2024 } | 2033 } |
2025 } | 2034 } |
2026 | 2035 |
2027 #undef __ | 2036 #undef __ |
2028 | 2037 |
2029 } // namespace compiler | 2038 } // namespace compiler |
2030 } // namespace internal | 2039 } // namespace internal |
2031 } // namespace v8 | 2040 } // namespace v8 |
OLD | NEW |