| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 __ add(ToRegister(left), ToOperand(right)); | 1141 __ add(ToRegister(left), ToOperand(right)); |
| 1142 } | 1142 } |
| 1143 | 1143 |
| 1144 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1144 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1145 DeoptimizeIf(overflow, instr->environment()); | 1145 DeoptimizeIf(overflow, instr->environment()); |
| 1146 } | 1146 } |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 | 1149 |
| 1150 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { | 1150 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { |
| 1151 LOperand* left = instr->InputAt(0); | 1151 XMMRegister left = ToDoubleRegister(instr->InputAt(0)); |
| 1152 LOperand* right = instr->InputAt(1); | 1152 XMMRegister right = ToDoubleRegister(instr->InputAt(1)); |
| 1153 XMMRegister result = ToDoubleRegister(instr->result()); |
| 1153 // Modulo uses a fixed result register. | 1154 // Modulo uses a fixed result register. |
| 1154 ASSERT(instr->op() == Token::MOD || left->Equals(instr->result())); | 1155 ASSERT(instr->op() == Token::MOD || left.is(result)); |
| 1155 switch (instr->op()) { | 1156 switch (instr->op()) { |
| 1156 case Token::ADD: | 1157 case Token::ADD: |
| 1157 __ addsd(ToDoubleRegister(left), ToDoubleRegister(right)); | 1158 __ addsd(left, right); |
| 1158 break; | 1159 break; |
| 1159 case Token::SUB: | 1160 case Token::SUB: |
| 1160 __ subsd(ToDoubleRegister(left), ToDoubleRegister(right)); | 1161 __ subsd(left, right); |
| 1161 break; | 1162 break; |
| 1162 case Token::MUL: | 1163 case Token::MUL: |
| 1163 __ mulsd(ToDoubleRegister(left), ToDoubleRegister(right)); | 1164 __ mulsd(left, right); |
| 1164 break; | 1165 break; |
| 1165 case Token::DIV: | 1166 case Token::DIV: |
| 1166 __ divsd(ToDoubleRegister(left), ToDoubleRegister(right)); | 1167 __ divsd(left, right); |
| 1167 break; | 1168 break; |
| 1168 case Token::MOD: { | 1169 case Token::MOD: { |
| 1169 // Pass two doubles as arguments on the stack. | 1170 // Pass two doubles as arguments on the stack. |
| 1170 __ PrepareCallCFunction(4, eax); | 1171 __ PrepareCallCFunction(4, eax); |
| 1171 __ movdbl(Operand(esp, 0 * kDoubleSize), ToDoubleRegister(left)); | 1172 __ movdbl(Operand(esp, 0 * kDoubleSize), left); |
| 1172 __ movdbl(Operand(esp, 1 * kDoubleSize), ToDoubleRegister(right)); | 1173 __ movdbl(Operand(esp, 1 * kDoubleSize), right); |
| 1173 __ CallCFunction(ExternalReference::double_fp_operation(Token::MOD), 4); | 1174 __ CallCFunction(ExternalReference::double_fp_operation(Token::MOD), 4); |
| 1174 | 1175 |
| 1175 // Return value is in st(0) on ia32. | 1176 // Return value is in st(0) on ia32. |
| 1176 // Store it into the (fixed) result register. | 1177 // Store it into the (fixed) result register. |
| 1177 __ sub(Operand(esp), Immediate(kDoubleSize)); | 1178 __ sub(Operand(esp), Immediate(kDoubleSize)); |
| 1178 __ fstp_d(Operand(esp, 0)); | 1179 __ fstp_d(Operand(esp, 0)); |
| 1179 __ movdbl(ToDoubleRegister(instr->result()), Operand(esp, 0)); | 1180 __ movdbl(result, Operand(esp, 0)); |
| 1180 __ add(Operand(esp), Immediate(kDoubleSize)); | 1181 __ add(Operand(esp), Immediate(kDoubleSize)); |
| 1181 break; | 1182 break; |
| 1182 } | 1183 } |
| 1183 default: | 1184 default: |
| 1184 UNREACHABLE(); | 1185 UNREACHABLE(); |
| 1185 break; | 1186 break; |
| 1186 } | 1187 } |
| 1187 } | 1188 } |
| 1188 | 1189 |
| 1189 | 1190 |
| (...skipping 2681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3871 ASSERT(osr_pc_offset_ == -1); | 3872 ASSERT(osr_pc_offset_ == -1); |
| 3872 osr_pc_offset_ = masm()->pc_offset(); | 3873 osr_pc_offset_ = masm()->pc_offset(); |
| 3873 } | 3874 } |
| 3874 | 3875 |
| 3875 | 3876 |
| 3876 #undef __ | 3877 #undef __ |
| 3877 | 3878 |
| 3878 } } // namespace v8::internal | 3879 } } // namespace v8::internal |
| 3879 | 3880 |
| 3880 #endif // V8_TARGET_ARCH_IA32 | 3881 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |