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/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
10 #include "src/compiler/gap-resolver.h" | 10 #include "src/compiler/gap-resolver.h" |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 SwVfpRegister scratch = kScratchDoubleReg.low(); | 1127 SwVfpRegister scratch = kScratchDoubleReg.low(); |
1128 __ vmov(scratch, i.InputRegister(0)); | 1128 __ vmov(scratch, i.InputRegister(0)); |
1129 __ vcvt_f64_u32(i.OutputDoubleRegister(), scratch); | 1129 __ vcvt_f64_u32(i.OutputDoubleRegister(), scratch); |
1130 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 1130 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
1131 break; | 1131 break; |
1132 } | 1132 } |
1133 case kArmVcvtS32F32: { | 1133 case kArmVcvtS32F32: { |
1134 SwVfpRegister scratch = kScratchDoubleReg.low(); | 1134 SwVfpRegister scratch = kScratchDoubleReg.low(); |
1135 __ vcvt_s32_f32(scratch, i.InputFloatRegister(0)); | 1135 __ vcvt_s32_f32(scratch, i.InputFloatRegister(0)); |
1136 __ vmov(i.OutputRegister(), scratch); | 1136 __ vmov(i.OutputRegister(), scratch); |
| 1137 // Avoid INT32_MAX as an overflow indicator and use INT32_MIN instead, |
| 1138 // because INT32_MIN allows easier out-of-bounds detection. |
| 1139 __ cmn(i.OutputRegister(), Operand(1)); |
| 1140 __ mov(i.OutputRegister(), Operand(INT32_MIN), SBit::LeaveCC, vs); |
1137 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 1141 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
1138 break; | 1142 break; |
1139 } | 1143 } |
1140 case kArmVcvtU32F32: { | 1144 case kArmVcvtU32F32: { |
1141 SwVfpRegister scratch = kScratchDoubleReg.low(); | 1145 SwVfpRegister scratch = kScratchDoubleReg.low(); |
1142 __ vcvt_u32_f32(scratch, i.InputFloatRegister(0)); | 1146 __ vcvt_u32_f32(scratch, i.InputFloatRegister(0)); |
1143 __ vmov(i.OutputRegister(), scratch); | 1147 __ vmov(i.OutputRegister(), scratch); |
| 1148 // Avoid UINT32_MAX as an overflow indicator and use 0 instead, |
| 1149 // because 0 allows easier out-of-bounds detection. |
| 1150 __ cmn(i.OutputRegister(), Operand(1)); |
| 1151 __ adc(i.OutputRegister(), i.OutputRegister(), Operand::Zero()); |
1144 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 1152 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
1145 break; | 1153 break; |
1146 } | 1154 } |
1147 case kArmVcvtS32F64: { | 1155 case kArmVcvtS32F64: { |
1148 SwVfpRegister scratch = kScratchDoubleReg.low(); | 1156 SwVfpRegister scratch = kScratchDoubleReg.low(); |
1149 __ vcvt_s32_f64(scratch, i.InputDoubleRegister(0)); | 1157 __ vcvt_s32_f64(scratch, i.InputDoubleRegister(0)); |
1150 __ vmov(i.OutputRegister(), scratch); | 1158 __ vmov(i.OutputRegister(), scratch); |
1151 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 1159 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
1152 break; | 1160 break; |
1153 } | 1161 } |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 padding_size -= v8::internal::Assembler::kInstrSize; | 1833 padding_size -= v8::internal::Assembler::kInstrSize; |
1826 } | 1834 } |
1827 } | 1835 } |
1828 } | 1836 } |
1829 | 1837 |
1830 #undef __ | 1838 #undef __ |
1831 | 1839 |
1832 } // namespace compiler | 1840 } // namespace compiler |
1833 } // namespace internal | 1841 } // namespace internal |
1834 } // namespace v8 | 1842 } // namespace v8 |
OLD | NEW |