OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 break; | 2136 break; |
2137 } | 2137 } |
2138 default: | 2138 default: |
2139 UNREACHABLE(); | 2139 UNREACHABLE(); |
2140 break; | 2140 break; |
2141 } | 2141 } |
2142 } else { | 2142 } else { |
2143 X87Register left = ToX87Register(instr->left()); | 2143 X87Register left = ToX87Register(instr->left()); |
2144 X87Register right = ToX87Register(instr->right()); | 2144 X87Register right = ToX87Register(instr->right()); |
2145 X87Register result = ToX87Register(instr->result()); | 2145 X87Register result = ToX87Register(instr->result()); |
2146 X87PrepareBinaryOp(left, right, result); | 2146 if (instr->op() != Token::MOD) { |
| 2147 X87PrepareBinaryOp(left, right, result); |
| 2148 } |
2147 switch (instr->op()) { | 2149 switch (instr->op()) { |
| 2150 case Token::ADD: |
| 2151 __ fadd_i(1); |
| 2152 break; |
| 2153 case Token::SUB: |
| 2154 __ fsub_i(1); |
| 2155 break; |
2148 case Token::MUL: | 2156 case Token::MUL: |
2149 __ fmul_i(1); | 2157 __ fmul_i(1); |
2150 break; | 2158 break; |
| 2159 case Token::DIV: |
| 2160 __ fdiv_i(1); |
| 2161 break; |
| 2162 case Token::MOD: { |
| 2163 // Pass two doubles as arguments on the stack. |
| 2164 __ PrepareCallCFunction(4, eax); |
| 2165 X87Mov(Operand(esp, 1 * kDoubleSize), right); |
| 2166 X87Mov(Operand(esp, 0), left); |
| 2167 X87PrepareToWrite(result); |
| 2168 __ CallCFunction( |
| 2169 ExternalReference::double_fp_operation(Token::MOD, isolate()), |
| 2170 4); |
| 2171 |
| 2172 // Return value is in st(0) on ia32. |
| 2173 X87CommitWrite(result); |
| 2174 break; |
| 2175 } |
2151 default: | 2176 default: |
2152 UNREACHABLE(); | 2177 UNREACHABLE(); |
2153 break; | 2178 break; |
2154 } | 2179 } |
2155 } | 2180 } |
2156 } | 2181 } |
2157 | 2182 |
2158 | 2183 |
2159 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { | 2184 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
2160 ASSERT(ToRegister(instr->context()).is(esi)); | 2185 ASSERT(ToRegister(instr->context()).is(esi)); |
(...skipping 4345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6506 FixedArray::kHeaderSize - kPointerSize)); | 6531 FixedArray::kHeaderSize - kPointerSize)); |
6507 __ bind(&done); | 6532 __ bind(&done); |
6508 } | 6533 } |
6509 | 6534 |
6510 | 6535 |
6511 #undef __ | 6536 #undef __ |
6512 | 6537 |
6513 } } // namespace v8::internal | 6538 } } // namespace v8::internal |
6514 | 6539 |
6515 #endif // V8_TARGET_ARCH_IA32 | 6540 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |