| 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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 if (instr->OutputCount() > 1) { | 1066 if (instr->OutputCount() > 1) { |
| 1067 __ Set(i.OutputRegister(1), 0x8000000000000000); | 1067 __ Set(i.OutputRegister(1), 0x8000000000000000); |
| 1068 __ subq(i.OutputRegister(1), i.OutputRegister(0)); | 1068 __ subq(i.OutputRegister(1), i.OutputRegister(0)); |
| 1069 } | 1069 } |
| 1070 break; | 1070 break; |
| 1071 case kSSEFloat32ToUint64: { | 1071 case kSSEFloat32ToUint64: { |
| 1072 Label done; | 1072 Label done; |
| 1073 Label success; | 1073 Label success; |
| 1074 if (instr->OutputCount() > 1) { | 1074 if (instr->OutputCount() > 1) { |
| 1075 __ Set(i.OutputRegister(1), 0); | 1075 __ Set(i.OutputRegister(1), 0); |
| 1076 __ xorps(kScratchDoubleReg, kScratchDoubleReg); | |
| 1077 | |
| 1078 if (instr->InputAt(0)->IsDoubleRegister()) { | |
| 1079 __ Ucomiss(kScratchDoubleReg, i.InputDoubleRegister(0)); | |
| 1080 } else { | |
| 1081 __ Ucomiss(kScratchDoubleReg, i.InputOperand(0)); | |
| 1082 } | |
| 1083 __ j(above, &done); | |
| 1084 } | 1076 } |
| 1085 // There does not exist a Float32ToUint64 instruction, so we have to use | 1077 // There does not exist a Float32ToUint64 instruction, so we have to use |
| 1086 // the Float32ToInt64 instruction. | 1078 // the Float32ToInt64 instruction. |
| 1087 if (instr->InputAt(0)->IsDoubleRegister()) { | 1079 if (instr->InputAt(0)->IsDoubleRegister()) { |
| 1088 __ Cvttss2siq(i.OutputRegister(), i.InputDoubleRegister(0)); | 1080 __ Cvttss2siq(i.OutputRegister(), i.InputDoubleRegister(0)); |
| 1089 } else { | 1081 } else { |
| 1090 __ Cvttss2siq(i.OutputRegister(), i.InputOperand(0)); | 1082 __ Cvttss2siq(i.OutputRegister(), i.InputOperand(0)); |
| 1091 } | 1083 } |
| 1092 // Check if the result of the Float32ToInt64 conversion is positive, we | 1084 // Check if the result of the Float32ToInt64 conversion is positive, we |
| 1093 // are already done. | 1085 // are already done. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1117 __ Set(i.OutputRegister(1), 1); | 1109 __ Set(i.OutputRegister(1), 1); |
| 1118 } | 1110 } |
| 1119 __ bind(&done); | 1111 __ bind(&done); |
| 1120 break; | 1112 break; |
| 1121 } | 1113 } |
| 1122 case kSSEFloat64ToUint64: { | 1114 case kSSEFloat64ToUint64: { |
| 1123 Label done; | 1115 Label done; |
| 1124 Label success; | 1116 Label success; |
| 1125 if (instr->OutputCount() > 1) { | 1117 if (instr->OutputCount() > 1) { |
| 1126 __ Set(i.OutputRegister(1), 0); | 1118 __ Set(i.OutputRegister(1), 0); |
| 1127 __ xorps(kScratchDoubleReg, kScratchDoubleReg); | |
| 1128 | |
| 1129 if (instr->InputAt(0)->IsDoubleRegister()) { | |
| 1130 __ Ucomisd(kScratchDoubleReg, i.InputDoubleRegister(0)); | |
| 1131 } else { | |
| 1132 __ Ucomisd(kScratchDoubleReg, i.InputOperand(0)); | |
| 1133 } | |
| 1134 __ j(above, &done); | |
| 1135 } | 1119 } |
| 1136 // There does not exist a Float64ToUint64 instruction, so we have to use | 1120 // There does not exist a Float64ToUint64 instruction, so we have to use |
| 1137 // the Float64ToInt64 instruction. | 1121 // the Float64ToInt64 instruction. |
| 1138 if (instr->InputAt(0)->IsDoubleRegister()) { | 1122 if (instr->InputAt(0)->IsDoubleRegister()) { |
| 1139 __ Cvttsd2siq(i.OutputRegister(), i.InputDoubleRegister(0)); | 1123 __ Cvttsd2siq(i.OutputRegister(), i.InputDoubleRegister(0)); |
| 1140 } else { | 1124 } else { |
| 1141 __ Cvttsd2siq(i.OutputRegister(), i.InputOperand(0)); | 1125 __ Cvttsd2siq(i.OutputRegister(), i.InputOperand(0)); |
| 1142 } | 1126 } |
| 1143 // Check if the result of the Float64ToInt64 conversion is positive, we | 1127 // Check if the result of the Float64ToInt64 conversion is positive, we |
| 1144 // are already done. | 1128 // are already done. |
| (...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2088 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2072 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 2089 __ Nop(padding_size); | 2073 __ Nop(padding_size); |
| 2090 } | 2074 } |
| 2091 } | 2075 } |
| 2092 | 2076 |
| 2093 #undef __ | 2077 #undef __ |
| 2094 | 2078 |
| 2095 } // namespace compiler | 2079 } // namespace compiler |
| 2096 } // namespace internal | 2080 } // namespace internal |
| 2097 } // namespace v8 | 2081 } // namespace v8 |
| OLD | NEW |