| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
| 9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 __ bind(&fail); | 1102 __ bind(&fail); |
| 1103 __ Set(i.OutputRegister(1), 0); | 1103 __ Set(i.OutputRegister(1), 0); |
| 1104 __ bind(&done); | 1104 __ bind(&done); |
| 1105 } | 1105 } |
| 1106 break; | 1106 break; |
| 1107 case kSSEFloat32ToUint64: { | 1107 case kSSEFloat32ToUint64: { |
| 1108 Label done; | 1108 Label done; |
| 1109 Label success; | 1109 Label success; |
| 1110 if (instr->OutputCount() > 1) { | 1110 if (instr->OutputCount() > 1) { |
| 1111 __ Set(i.OutputRegister(1), 0); | 1111 __ Set(i.OutputRegister(1), 0); |
| 1112 __ xorps(kScratchDoubleReg, kScratchDoubleReg); | |
| 1113 | |
| 1114 if (instr->InputAt(0)->IsDoubleRegister()) { | |
| 1115 __ Ucomiss(kScratchDoubleReg, i.InputDoubleRegister(0)); | |
| 1116 } else { | |
| 1117 __ Ucomiss(kScratchDoubleReg, i.InputOperand(0)); | |
| 1118 } | |
| 1119 __ j(above, &done); | |
| 1120 } | 1112 } |
| 1121 // There does not exist a Float32ToUint64 instruction, so we have to use | 1113 // There does not exist a Float32ToUint64 instruction, so we have to use |
| 1122 // the Float32ToInt64 instruction. | 1114 // the Float32ToInt64 instruction. |
| 1123 if (instr->InputAt(0)->IsDoubleRegister()) { | 1115 if (instr->InputAt(0)->IsDoubleRegister()) { |
| 1124 __ Cvttss2siq(i.OutputRegister(), i.InputDoubleRegister(0)); | 1116 __ Cvttss2siq(i.OutputRegister(), i.InputDoubleRegister(0)); |
| 1125 } else { | 1117 } else { |
| 1126 __ Cvttss2siq(i.OutputRegister(), i.InputOperand(0)); | 1118 __ Cvttss2siq(i.OutputRegister(), i.InputOperand(0)); |
| 1127 } | 1119 } |
| 1128 // Check if the result of the Float32ToInt64 conversion is positive, we | 1120 // Check if the result of the Float32ToInt64 conversion is positive, we |
| 1129 // are already done. | 1121 // are already done. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1153 __ Set(i.OutputRegister(1), 1); | 1145 __ Set(i.OutputRegister(1), 1); |
| 1154 } | 1146 } |
| 1155 __ bind(&done); | 1147 __ bind(&done); |
| 1156 break; | 1148 break; |
| 1157 } | 1149 } |
| 1158 case kSSEFloat64ToUint64: { | 1150 case kSSEFloat64ToUint64: { |
| 1159 Label done; | 1151 Label done; |
| 1160 Label success; | 1152 Label success; |
| 1161 if (instr->OutputCount() > 1) { | 1153 if (instr->OutputCount() > 1) { |
| 1162 __ Set(i.OutputRegister(1), 0); | 1154 __ Set(i.OutputRegister(1), 0); |
| 1163 __ xorps(kScratchDoubleReg, kScratchDoubleReg); | |
| 1164 | |
| 1165 if (instr->InputAt(0)->IsDoubleRegister()) { | |
| 1166 __ Ucomisd(kScratchDoubleReg, i.InputDoubleRegister(0)); | |
| 1167 } else { | |
| 1168 __ Ucomisd(kScratchDoubleReg, i.InputOperand(0)); | |
| 1169 } | |
| 1170 __ j(above, &done); | |
| 1171 } | 1155 } |
| 1172 // There does not exist a Float64ToUint64 instruction, so we have to use | 1156 // There does not exist a Float64ToUint64 instruction, so we have to use |
| 1173 // the Float64ToInt64 instruction. | 1157 // the Float64ToInt64 instruction. |
| 1174 if (instr->InputAt(0)->IsDoubleRegister()) { | 1158 if (instr->InputAt(0)->IsDoubleRegister()) { |
| 1175 __ Cvttsd2siq(i.OutputRegister(), i.InputDoubleRegister(0)); | 1159 __ Cvttsd2siq(i.OutputRegister(), i.InputDoubleRegister(0)); |
| 1176 } else { | 1160 } else { |
| 1177 __ Cvttsd2siq(i.OutputRegister(), i.InputOperand(0)); | 1161 __ Cvttsd2siq(i.OutputRegister(), i.InputOperand(0)); |
| 1178 } | 1162 } |
| 1179 // Check if the result of the Float64ToInt64 conversion is positive, we | 1163 // Check if the result of the Float64ToInt64 conversion is positive, we |
| 1180 // are already done. | 1164 // are already done. |
| (...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2108 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 2125 __ Nop(padding_size); | 2109 __ Nop(padding_size); |
| 2126 } | 2110 } |
| 2127 } | 2111 } |
| 2128 | 2112 |
| 2129 #undef __ | 2113 #undef __ |
| 2130 | 2114 |
| 2131 } // namespace compiler | 2115 } // namespace compiler |
| 2132 } // namespace internal | 2116 } // namespace internal |
| 2133 } // namespace v8 | 2117 } // namespace v8 |
| OLD | NEW |