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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1114 SwVfpRegister scratch = kScratchDoubleReg.low(); | 1114 SwVfpRegister scratch = kScratchDoubleReg.low(); |
1115 __ vmov(scratch, i.InputRegister(0)); | 1115 __ vmov(scratch, i.InputRegister(0)); |
1116 __ vcvt_f64_u32(i.OutputDoubleRegister(), scratch); | 1116 __ vcvt_f64_u32(i.OutputDoubleRegister(), scratch); |
1117 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 1117 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
1118 break; | 1118 break; |
1119 } | 1119 } |
1120 case kArmVcvtS32F32: { | 1120 case kArmVcvtS32F32: { |
1121 SwVfpRegister scratch = kScratchDoubleReg.low(); | 1121 SwVfpRegister scratch = kScratchDoubleReg.low(); |
1122 __ vcvt_s32_f32(scratch, i.InputFloatRegister(0)); | 1122 __ vcvt_s32_f32(scratch, i.InputFloatRegister(0)); |
1123 __ vmov(i.OutputRegister(), scratch); | 1123 __ vmov(i.OutputRegister(), scratch); |
1124 // Avoid INT32_MAX as an overflow indicator and use INT32_MIN instead, | |
1125 // because INT32_MIN allows easier out-of-bounds detection. | |
1126 __ cmn(i.OutputRegister(), Operand(1)); | |
1127 __ 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.
| |
1128 vs); | |
1124 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 1129 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
1125 break; | 1130 break; |
1126 } | 1131 } |
1127 case kArmVcvtU32F32: { | 1132 case kArmVcvtU32F32: { |
1128 SwVfpRegister scratch = kScratchDoubleReg.low(); | 1133 SwVfpRegister scratch = kScratchDoubleReg.low(); |
1129 __ vcvt_u32_f32(scratch, i.InputFloatRegister(0)); | 1134 __ vcvt_u32_f32(scratch, i.InputFloatRegister(0)); |
1130 __ vmov(i.OutputRegister(), scratch); | 1135 __ vmov(i.OutputRegister(), scratch); |
1136 // Avoid UINT32_MAX as an overflow indicator and use 0 instead, | |
1137 // because 0 allows easier out-of-bounds detection. | |
1138 __ cmn(i.OutputRegister(), Operand(1)); | |
1139 __ 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.
| |
1140 cs); | |
1131 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 1141 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
1132 break; | 1142 break; |
1133 } | 1143 } |
1134 case kArmVcvtS32F64: { | 1144 case kArmVcvtS32F64: { |
1135 SwVfpRegister scratch = kScratchDoubleReg.low(); | 1145 SwVfpRegister scratch = kScratchDoubleReg.low(); |
1136 __ vcvt_s32_f64(scratch, i.InputDoubleRegister(0)); | 1146 __ vcvt_s32_f64(scratch, i.InputDoubleRegister(0)); |
1137 __ vmov(i.OutputRegister(), scratch); | 1147 __ vmov(i.OutputRegister(), scratch); |
1138 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 1148 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
1139 break; | 1149 break; |
1140 } | 1150 } |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1812 padding_size -= v8::internal::Assembler::kInstrSize; | 1822 padding_size -= v8::internal::Assembler::kInstrSize; |
1813 } | 1823 } |
1814 } | 1824 } |
1815 } | 1825 } |
1816 | 1826 |
1817 #undef __ | 1827 #undef __ |
1818 | 1828 |
1819 } // namespace compiler | 1829 } // namespace compiler |
1820 } // namespace internal | 1830 } // namespace internal |
1821 } // namespace v8 | 1831 } // namespace v8 |
OLD | NEW |