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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 __ AssertZeroExtended(i.OutputRegister()); | 1046 __ AssertZeroExtended(i.OutputRegister()); |
1047 break; | 1047 break; |
1048 } | 1048 } |
1049 case kSSEFloat32ToInt64: | 1049 case kSSEFloat32ToInt64: |
1050 if (instr->InputAt(0)->IsDoubleRegister()) { | 1050 if (instr->InputAt(0)->IsDoubleRegister()) { |
1051 __ Cvttss2siq(i.OutputRegister(), i.InputDoubleRegister(0)); | 1051 __ Cvttss2siq(i.OutputRegister(), i.InputDoubleRegister(0)); |
1052 } else { | 1052 } else { |
1053 __ Cvttss2siq(i.OutputRegister(), i.InputOperand(0)); | 1053 __ Cvttss2siq(i.OutputRegister(), i.InputOperand(0)); |
1054 } | 1054 } |
1055 if (instr->OutputCount() > 1) { | 1055 if (instr->OutputCount() > 1) { |
1056 __ Set(i.OutputRegister(1), 0x8000000000000000); | 1056 __ Set(i.OutputRegister(1), 1); |
1057 __ subq(i.OutputRegister(1), i.OutputRegister(0)); | 1057 Label done; |
| 1058 Label fail; |
| 1059 __ Move(kScratchDoubleReg, static_cast<float>(INT64_MIN)); |
| 1060 if (instr->InputAt(0)->IsDoubleRegister()) { |
| 1061 __ Ucomiss(kScratchDoubleReg, i.InputDoubleRegister(0)); |
| 1062 } else { |
| 1063 __ Ucomiss(kScratchDoubleReg, i.InputOperand(0)); |
| 1064 } |
| 1065 // If the input is NaN, then the conversion fails. |
| 1066 __ j(parity_even, &fail); |
| 1067 // If the input is INT64_MIN, then the conversion succeeds. |
| 1068 __ j(equal, &done); |
| 1069 __ cmpq(i.OutputRegister(0), Immediate(1)); |
| 1070 // If the conversion results in INT64_MIN, but the input was not |
| 1071 // INT64_MIN, then the conversion fails. |
| 1072 __ j(no_overflow, &done); |
| 1073 __ bind(&fail); |
| 1074 __ Set(i.OutputRegister(1), 0); |
| 1075 __ bind(&done); |
1058 } | 1076 } |
1059 break; | 1077 break; |
1060 case kSSEFloat64ToInt64: | 1078 case kSSEFloat64ToInt64: |
1061 if (instr->InputAt(0)->IsDoubleRegister()) { | 1079 if (instr->InputAt(0)->IsDoubleRegister()) { |
1062 __ Cvttsd2siq(i.OutputRegister(0), i.InputDoubleRegister(0)); | 1080 __ Cvttsd2siq(i.OutputRegister(0), i.InputDoubleRegister(0)); |
1063 } else { | 1081 } else { |
1064 __ Cvttsd2siq(i.OutputRegister(0), i.InputOperand(0)); | 1082 __ Cvttsd2siq(i.OutputRegister(0), i.InputOperand(0)); |
1065 } | 1083 } |
1066 if (instr->OutputCount() > 1) { | 1084 if (instr->OutputCount() > 1) { |
1067 __ Set(i.OutputRegister(1), 0x8000000000000000); | 1085 __ Set(i.OutputRegister(1), 1); |
1068 __ subq(i.OutputRegister(1), i.OutputRegister(0)); | 1086 Label done; |
| 1087 Label fail; |
| 1088 __ Move(kScratchDoubleReg, static_cast<double>(INT64_MIN)); |
| 1089 if (instr->InputAt(0)->IsDoubleRegister()) { |
| 1090 __ Ucomisd(kScratchDoubleReg, i.InputDoubleRegister(0)); |
| 1091 } else { |
| 1092 __ Ucomisd(kScratchDoubleReg, i.InputOperand(0)); |
| 1093 } |
| 1094 // If the input is NaN, then the conversion fails. |
| 1095 __ j(parity_even, &fail); |
| 1096 // If the input is INT64_MIN, then the conversion succeeds. |
| 1097 __ j(equal, &done); |
| 1098 __ cmpq(i.OutputRegister(0), Immediate(1)); |
| 1099 // If the conversion results in INT64_MIN, but the input was not |
| 1100 // INT64_MIN, then the conversion fails. |
| 1101 __ j(no_overflow, &done); |
| 1102 __ bind(&fail); |
| 1103 __ Set(i.OutputRegister(1), 0); |
| 1104 __ bind(&done); |
1069 } | 1105 } |
1070 break; | 1106 break; |
1071 case kSSEFloat32ToUint64: { | 1107 case kSSEFloat32ToUint64: { |
1072 Label done; | 1108 Label done; |
1073 Label success; | 1109 Label success; |
1074 if (instr->OutputCount() > 1) { | 1110 if (instr->OutputCount() > 1) { |
1075 __ Set(i.OutputRegister(1), 0); | 1111 __ Set(i.OutputRegister(1), 0); |
1076 __ xorps(kScratchDoubleReg, kScratchDoubleReg); | 1112 __ xorps(kScratchDoubleReg, kScratchDoubleReg); |
1077 | 1113 |
1078 if (instr->InputAt(0)->IsDoubleRegister()) { | 1114 if (instr->InputAt(0)->IsDoubleRegister()) { |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2124 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2089 __ Nop(padding_size); | 2125 __ Nop(padding_size); |
2090 } | 2126 } |
2091 } | 2127 } |
2092 | 2128 |
2093 #undef __ | 2129 #undef __ |
2094 | 2130 |
2095 } // namespace compiler | 2131 } // namespace compiler |
2096 } // namespace internal | 2132 } // namespace internal |
2097 } // namespace v8 | 2133 } // namespace v8 |
OLD | NEW |