| 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 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 break; | 1726 break; |
| 1727 case 5: | 1727 case 5: |
| 1728 __ lea(left, Operand(left, left, times_4, 0)); | 1728 __ lea(left, Operand(left, left, times_4, 0)); |
| 1729 break; | 1729 break; |
| 1730 case 8: | 1730 case 8: |
| 1731 __ shl(left, 3); | 1731 __ shl(left, 3); |
| 1732 break; | 1732 break; |
| 1733 case 9: | 1733 case 9: |
| 1734 __ lea(left, Operand(left, left, times_8, 0)); | 1734 __ lea(left, Operand(left, left, times_8, 0)); |
| 1735 break; | 1735 break; |
| 1736 case 16: | 1736 case 16: |
| 1737 __ shl(left, 4); | 1737 __ shl(left, 4); |
| 1738 break; | 1738 break; |
| 1739 default: | 1739 default: |
| 1740 __ imul(left, left, constant); | 1740 __ imul(left, left, constant); |
| 1741 break; | 1741 break; |
| 1742 } | 1742 } |
| 1743 } else { | 1743 } else { |
| 1744 __ imul(left, left, constant); | 1744 __ imul(left, left, constant); |
| 1745 } | 1745 } |
| 1746 } else { | 1746 } else { |
| 1747 if (instr->hydrogen()->representation().IsSmi()) { | 1747 if (instr->hydrogen()->representation().IsSmi()) { |
| 1748 __ SmiUntag(left); | 1748 __ SmiUntag(left); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 } | 2201 } |
| 2202 } | 2202 } |
| 2203 | 2203 |
| 2204 | 2204 |
| 2205 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { | 2205 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { |
| 2206 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 2206 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
| 2207 CpuFeatureScope scope(masm(), SSE2); | 2207 CpuFeatureScope scope(masm(), SSE2); |
| 2208 XMMRegister left = ToDoubleRegister(instr->left()); | 2208 XMMRegister left = ToDoubleRegister(instr->left()); |
| 2209 XMMRegister right = ToDoubleRegister(instr->right()); | 2209 XMMRegister right = ToDoubleRegister(instr->right()); |
| 2210 XMMRegister result = ToDoubleRegister(instr->result()); | 2210 XMMRegister result = ToDoubleRegister(instr->result()); |
| 2211 // Modulo uses a fixed result register. | |
| 2212 ASSERT(instr->op() == Token::MOD || left.is(result)); | |
| 2213 switch (instr->op()) { | 2211 switch (instr->op()) { |
| 2214 case Token::ADD: | 2212 case Token::ADD: |
| 2215 __ addsd(left, right); | 2213 __ addsd(left, right); |
| 2216 break; | 2214 break; |
| 2217 case Token::SUB: | 2215 case Token::SUB: |
| 2218 __ subsd(left, right); | 2216 __ subsd(left, right); |
| 2219 break; | 2217 break; |
| 2220 case Token::MUL: | 2218 case Token::MUL: |
| 2221 __ mulsd(left, right); | 2219 __ mulsd(left, right); |
| 2222 break; | 2220 break; |
| 2223 case Token::DIV: | 2221 case Token::DIV: |
| 2224 __ divsd(left, right); | 2222 __ divsd(left, right); |
| 2225 // Don't delete this mov. It may improve performance on some CPUs, | 2223 // Don't delete this mov. It may improve performance on some CPUs, |
| 2226 // when there is a mulsd depending on the result | 2224 // when there is a mulsd depending on the result |
| 2227 __ movaps(left, left); | 2225 __ movaps(left, left); |
| 2228 break; | 2226 break; |
| 2229 case Token::MOD: { | 2227 case Token::MOD: { |
| 2230 // Pass two doubles as arguments on the stack. | 2228 // Pass two doubles as arguments on the stack. |
| 2231 __ PrepareCallCFunction(4, eax); | 2229 __ PrepareCallCFunction(4, eax); |
| 2232 __ movdbl(Operand(esp, 0 * kDoubleSize), left); | 2230 __ movdbl(Operand(esp, 0 * kDoubleSize), left); |
| 2233 __ movdbl(Operand(esp, 1 * kDoubleSize), right); | 2231 __ movdbl(Operand(esp, 1 * kDoubleSize), right); |
| 2234 __ CallCFunction( | 2232 __ CallCFunction( |
| 2235 ExternalReference::double_fp_operation(Token::MOD, isolate()), | 2233 ExternalReference::double_fp_operation(Token::MOD, isolate()), |
| 2236 4); | 2234 4); |
| 2237 | 2235 |
| 2238 // Return value is in st(0) on ia32. | 2236 // Return value is in st(0) on ia32. |
| 2239 // Store it into the (fixed) result register. | 2237 // Store it into the result register. |
| 2240 __ sub(Operand(esp), Immediate(kDoubleSize)); | 2238 __ sub(Operand(esp), Immediate(kDoubleSize)); |
| 2241 __ fstp_d(Operand(esp, 0)); | 2239 __ fstp_d(Operand(esp, 0)); |
| 2242 __ movdbl(result, Operand(esp, 0)); | 2240 __ movdbl(result, Operand(esp, 0)); |
| 2243 __ add(Operand(esp), Immediate(kDoubleSize)); | 2241 __ add(Operand(esp), Immediate(kDoubleSize)); |
| 2244 break; | 2242 break; |
| 2245 } | 2243 } |
| 2246 default: | 2244 default: |
| 2247 UNREACHABLE(); | 2245 UNREACHABLE(); |
| 2248 break; | 2246 break; |
| 2249 } | 2247 } |
| (...skipping 3162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5412 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5410 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 5413 private: | 5411 private: |
| 5414 LTaggedToI* instr_; | 5412 LTaggedToI* instr_; |
| 5415 }; | 5413 }; |
| 5416 | 5414 |
| 5417 LOperand* input = instr->value(); | 5415 LOperand* input = instr->value(); |
| 5418 ASSERT(input->IsRegister()); | 5416 ASSERT(input->IsRegister()); |
| 5419 Register input_reg = ToRegister(input); | 5417 Register input_reg = ToRegister(input); |
| 5420 ASSERT(input_reg.is(ToRegister(instr->result()))); | 5418 ASSERT(input_reg.is(ToRegister(instr->result()))); |
| 5421 | 5419 |
| 5422 DeferredTaggedToI* deferred = | 5420 if (instr->hydrogen()->value()->representation().IsSmi()) { |
| 5423 new(zone()) DeferredTaggedToI(this, instr, x87_stack_); | 5421 __ SmiUntag(input_reg); |
| 5422 } else { |
| 5423 DeferredTaggedToI* deferred = |
| 5424 new(zone()) DeferredTaggedToI(this, instr, x87_stack_); |
| 5424 | 5425 |
| 5425 __ JumpIfNotSmi(input_reg, deferred->entry()); | 5426 __ JumpIfNotSmi(input_reg, deferred->entry()); |
| 5426 __ SmiUntag(input_reg); | 5427 __ SmiUntag(input_reg); |
| 5427 __ bind(deferred->exit()); | 5428 __ bind(deferred->exit()); |
| 5429 } |
| 5428 } | 5430 } |
| 5429 | 5431 |
| 5430 | 5432 |
| 5431 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { | 5433 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
| 5432 LOperand* input = instr->value(); | 5434 LOperand* input = instr->value(); |
| 5433 ASSERT(input->IsRegister()); | 5435 ASSERT(input->IsRegister()); |
| 5434 LOperand* temp = instr->temp(); | 5436 LOperand* temp = instr->temp(); |
| 5435 ASSERT(temp->IsRegister()); | 5437 ASSERT(temp->IsRegister()); |
| 5436 LOperand* result = instr->result(); | 5438 LOperand* result = instr->result(); |
| 5437 ASSERT(result->IsDoubleRegister()); | 5439 ASSERT(result->IsDoubleRegister()); |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6359 FixedArray::kHeaderSize - kPointerSize)); | 6361 FixedArray::kHeaderSize - kPointerSize)); |
| 6360 __ bind(&done); | 6362 __ bind(&done); |
| 6361 } | 6363 } |
| 6362 | 6364 |
| 6363 | 6365 |
| 6364 #undef __ | 6366 #undef __ |
| 6365 | 6367 |
| 6366 } } // namespace v8::internal | 6368 } } // namespace v8::internal |
| 6367 | 6369 |
| 6368 #endif // V8_TARGET_ARCH_IA32 | 6370 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |