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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 __ addl(ToRegister(left), ToOperand(right)); | 1107 __ addl(ToRegister(left), ToOperand(right)); |
1108 } | 1108 } |
1109 | 1109 |
1110 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1110 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
1111 DeoptimizeIf(overflow, instr->environment()); | 1111 DeoptimizeIf(overflow, instr->environment()); |
1112 } | 1112 } |
1113 } | 1113 } |
1114 | 1114 |
1115 | 1115 |
1116 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { | 1116 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { |
1117 LOperand* left = instr->InputAt(0); | 1117 XMMRegister left = ToDoubleRegister(instr->InputAt(0)); |
1118 LOperand* right = instr->InputAt(1); | 1118 XMMRegister right = ToDoubleRegister(instr->InputAt(1)); |
| 1119 XMMRegister result = ToDoubleRegister(instr->result()); |
1119 // All operations except MOD are computed in-place. | 1120 // All operations except MOD are computed in-place. |
1120 ASSERT(instr->op() == Token::MOD || left->Equals(instr->result())); | 1121 ASSERT(instr->op() == Token::MOD || left.is(result)); |
1121 switch (instr->op()) { | 1122 switch (instr->op()) { |
1122 case Token::ADD: | 1123 case Token::ADD: |
1123 __ addsd(ToDoubleRegister(left), ToDoubleRegister(right)); | 1124 __ addsd(left, right); |
1124 break; | 1125 break; |
1125 case Token::SUB: | 1126 case Token::SUB: |
1126 __ subsd(ToDoubleRegister(left), ToDoubleRegister(right)); | 1127 __ subsd(left, right); |
1127 break; | 1128 break; |
1128 case Token::MUL: | 1129 case Token::MUL: |
1129 __ mulsd(ToDoubleRegister(left), ToDoubleRegister(right)); | 1130 __ mulsd(left, right); |
1130 break; | 1131 break; |
1131 case Token::DIV: | 1132 case Token::DIV: |
1132 __ divsd(ToDoubleRegister(left), ToDoubleRegister(right)); | 1133 __ divsd(left, right); |
1133 break; | 1134 break; |
1134 case Token::MOD: | 1135 case Token::MOD: |
1135 Abort("Unimplemented: %s", "DoArithmeticD MOD"); | 1136 __ PrepareCallCFunction(2); |
| 1137 __ movsd(xmm0, left); |
| 1138 ASSERT(right.is(xmm1)); |
| 1139 __ CallCFunction(ExternalReference::double_fp_operation(Token::MOD), 2); |
| 1140 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 1141 __ movsd(result, xmm0); |
1136 break; | 1142 break; |
1137 default: | 1143 default: |
1138 UNREACHABLE(); | 1144 UNREACHABLE(); |
1139 break; | 1145 break; |
1140 } | 1146 } |
1141 } | 1147 } |
1142 | 1148 |
1143 | 1149 |
1144 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { | 1150 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
1145 ASSERT(ToRegister(instr->InputAt(0)).is(rdx)); | 1151 ASSERT(ToRegister(instr->InputAt(0)).is(rdx)); |
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3630 RegisterEnvironmentForDeoptimization(environment); | 3636 RegisterEnvironmentForDeoptimization(environment); |
3631 ASSERT(osr_pc_offset_ == -1); | 3637 ASSERT(osr_pc_offset_ == -1); |
3632 osr_pc_offset_ = masm()->pc_offset(); | 3638 osr_pc_offset_ = masm()->pc_offset(); |
3633 } | 3639 } |
3634 | 3640 |
3635 #undef __ | 3641 #undef __ |
3636 | 3642 |
3637 } } // namespace v8::internal | 3643 } } // namespace v8::internal |
3638 | 3644 |
3639 #endif // V8_TARGET_ARCH_X64 | 3645 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |