Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: src/compiler/arm/code-generator-arm.cc

Issue 2105313002: [wasm] Detect unrepresentability in the float32-to-int32 conversion correctly on arm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 __ mov(i.OutputRegister(), Operand(INT32_MIN), SBit::LeaveCC, vs);
1124 DCHECK_EQ(LeaveCC, i.OutputSBit()); 1128 DCHECK_EQ(LeaveCC, i.OutputSBit());
1125 break; 1129 break;
1126 } 1130 }
1127 case kArmVcvtU32F32: { 1131 case kArmVcvtU32F32: {
1128 SwVfpRegister scratch = kScratchDoubleReg.low(); 1132 SwVfpRegister scratch = kScratchDoubleReg.low();
1129 __ vcvt_u32_f32(scratch, i.InputFloatRegister(0)); 1133 __ vcvt_u32_f32(scratch, i.InputFloatRegister(0));
1130 __ vmov(i.OutputRegister(), scratch); 1134 __ vmov(i.OutputRegister(), scratch);
1135 // Avoid UINT32_MAX as an overflow indicator and use 0 instead,
1136 // because 0 allows easier out-of-bounds detection.
1137 __ cmn(i.OutputRegister(), Operand(1));
1138 __ adc(i.OutputRegister(), i.OutputRegister(), Operand::Zero());
1131 DCHECK_EQ(LeaveCC, i.OutputSBit()); 1139 DCHECK_EQ(LeaveCC, i.OutputSBit());
1132 break; 1140 break;
1133 } 1141 }
1134 case kArmVcvtS32F64: { 1142 case kArmVcvtS32F64: {
1135 SwVfpRegister scratch = kScratchDoubleReg.low(); 1143 SwVfpRegister scratch = kScratchDoubleReg.low();
1136 __ vcvt_s32_f64(scratch, i.InputDoubleRegister(0)); 1144 __ vcvt_s32_f64(scratch, i.InputDoubleRegister(0));
1137 __ vmov(i.OutputRegister(), scratch); 1145 __ vmov(i.OutputRegister(), scratch);
1138 DCHECK_EQ(LeaveCC, i.OutputSBit()); 1146 DCHECK_EQ(LeaveCC, i.OutputSBit());
1139 break; 1147 break;
1140 } 1148 }
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 padding_size -= v8::internal::Assembler::kInstrSize; 1820 padding_size -= v8::internal::Assembler::kInstrSize;
1813 } 1821 }
1814 } 1822 }
1815 } 1823 }
1816 1824
1817 #undef __ 1825 #undef __
1818 1826
1819 } // namespace compiler 1827 } // namespace compiler
1820 } // namespace internal 1828 } // namespace internal
1821 } // namespace v8 1829 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/arm64/code-generator-arm64.cc » ('j') | src/compiler/arm64/code-generator-arm64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698