| 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 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 } else { | 1738 } else { |
| 1739 switch (op_) { | 1739 switch (op_) { |
| 1740 case Token::ADD: __ addsd(xmm0, xmm1); break; | 1740 case Token::ADD: __ addsd(xmm0, xmm1); break; |
| 1741 case Token::SUB: __ subsd(xmm0, xmm1); break; | 1741 case Token::SUB: __ subsd(xmm0, xmm1); break; |
| 1742 case Token::MUL: __ mulsd(xmm0, xmm1); break; | 1742 case Token::MUL: __ mulsd(xmm0, xmm1); break; |
| 1743 case Token::DIV: __ divsd(xmm0, xmm1); break; | 1743 case Token::DIV: __ divsd(xmm0, xmm1); break; |
| 1744 default: UNREACHABLE(); | 1744 default: UNREACHABLE(); |
| 1745 } | 1745 } |
| 1746 // Check result type if it is currently Int32. | 1746 // Check result type if it is currently Int32. |
| 1747 if (result_type_ <= BinaryOpIC::INT32) { | 1747 if (result_type_ <= BinaryOpIC::INT32) { |
| 1748 __ cvttsd2si(ecx, Operand(xmm0)); | 1748 FloatingPointHelper::CheckSSE2OperandIsInt32( |
| 1749 __ cvtsi2sd(xmm2, ecx); | 1749 masm, ¬_int32, xmm0, ecx, xmm2); |
| 1750 __ pcmpeqd(xmm2, xmm0); | |
| 1751 __ movmskpd(ecx, xmm2); | |
| 1752 __ test(ecx, Immediate(1)); | |
| 1753 __ j(zero, ¬_int32); | |
| 1754 } | 1750 } |
| 1755 BinaryOpStub_GenerateHeapResultAllocation(masm, &call_runtime, mode_); | 1751 BinaryOpStub_GenerateHeapResultAllocation(masm, &call_runtime, mode_); |
| 1756 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0); | 1752 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0); |
| 1757 __ ret(0); | 1753 __ ret(0); |
| 1758 } | 1754 } |
| 1759 } else { // SSE2 not available, use FPU. | 1755 } else { // SSE2 not available, use FPU. |
| 1760 FloatingPointHelper::CheckFloatOperands(masm, ¬_floats, ebx); | 1756 FloatingPointHelper::CheckFloatOperands(masm, ¬_floats, ebx); |
| 1761 FloatingPointHelper::LoadFloatOperands( | 1757 FloatingPointHelper::LoadFloatOperands( |
| 1762 masm, | 1758 masm, |
| 1763 ecx, | 1759 ecx, |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2851 | 2847 |
| 2852 | 2848 |
| 2853 void FloatingPointHelper::CheckSSE2OperandIsInt32(MacroAssembler* masm, | 2849 void FloatingPointHelper::CheckSSE2OperandIsInt32(MacroAssembler* masm, |
| 2854 Label* non_int32, | 2850 Label* non_int32, |
| 2855 XMMRegister operand, | 2851 XMMRegister operand, |
| 2856 Register scratch, | 2852 Register scratch, |
| 2857 XMMRegister xmm_scratch) { | 2853 XMMRegister xmm_scratch) { |
| 2858 __ cvttsd2si(scratch, Operand(operand)); | 2854 __ cvttsd2si(scratch, Operand(operand)); |
| 2859 __ cvtsi2sd(xmm_scratch, scratch); | 2855 __ cvtsi2sd(xmm_scratch, scratch); |
| 2860 __ pcmpeqd(xmm_scratch, operand); | 2856 __ pcmpeqd(xmm_scratch, operand); |
| 2861 __ movmskpd(scratch, xmm_scratch); | 2857 __ movmskps(scratch, xmm_scratch); |
| 2862 __ test(scratch, Immediate(1)); | 2858 // Two least significant bits should be both set. |
| 2863 __ j(zero, non_int32); | 2859 __ not_(scratch); |
| 2860 __ test(scratch, Immediate(3)); |
| 2861 __ j(not_zero, non_int32); |
| 2864 } | 2862 } |
| 2865 | 2863 |
| 2866 | 2864 |
| 2867 void FloatingPointHelper::LoadFloatOperands(MacroAssembler* masm, | 2865 void FloatingPointHelper::LoadFloatOperands(MacroAssembler* masm, |
| 2868 Register scratch, | 2866 Register scratch, |
| 2869 ArgLocation arg_location) { | 2867 ArgLocation arg_location) { |
| 2870 Label load_smi_1, load_smi_2, done_load_1, done; | 2868 Label load_smi_1, load_smi_2, done_load_1, done; |
| 2871 if (arg_location == ARGS_IN_REGISTERS) { | 2869 if (arg_location == ARGS_IN_REGISTERS) { |
| 2872 __ mov(scratch, edx); | 2870 __ mov(scratch, edx); |
| 2873 } else { | 2871 } else { |
| (...skipping 4575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7449 // Restore ecx. | 7447 // Restore ecx. |
| 7450 __ pop(ecx); | 7448 __ pop(ecx); |
| 7451 __ ret(0); | 7449 __ ret(0); |
| 7452 } | 7450 } |
| 7453 | 7451 |
| 7454 #undef __ | 7452 #undef __ |
| 7455 | 7453 |
| 7456 } } // namespace v8::internal | 7454 } } // namespace v8::internal |
| 7457 | 7455 |
| 7458 #endif // V8_TARGET_ARCH_IA32 | 7456 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |