OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 } else { | 597 } else { |
598 __ fstp_d(FieldOperand(val, HeapNumber::kValueOffset)); | 598 __ fstp_d(FieldOperand(val, HeapNumber::kValueOffset)); |
599 } | 599 } |
600 done.Jump(value); | 600 done.Jump(value); |
601 | 601 |
602 // Establish the virtual frame, cloned from where AllocateHeapNumber | 602 // Establish the virtual frame, cloned from where AllocateHeapNumber |
603 // jumped to allocation_failed. | 603 // jumped to allocation_failed. |
604 RegisterFile empty_regs; | 604 RegisterFile empty_regs; |
605 SetFrame(clone, &empty_regs); | 605 SetFrame(clone, &empty_regs); |
606 __ bind(&allocation_failed); | 606 __ bind(&allocation_failed); |
| 607 if (!CpuFeatures::IsSupported(SSE2)) { |
| 608 // Pop the value from the floating point stack. |
| 609 __ fstp(0); |
| 610 } |
607 unsafe_bailout_->Jump(); | 611 unsafe_bailout_->Jump(); |
608 | 612 |
609 done.Bind(value); | 613 done.Bind(value); |
610 } else { | 614 } else { |
611 ASSERT(value->is_constant()); | 615 ASSERT(value->is_constant()); |
612 } | 616 } |
613 value->set_untagged_int32(false); | 617 value->set_untagged_int32(false); |
614 value->set_type_info(TypeInfo::Integer32()); | 618 value->set_type_info(TypeInfo::Integer32()); |
615 } | 619 } |
616 | 620 |
(...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 | 2988 |
2985 JumpTarget not_numbers; | 2989 JumpTarget not_numbers; |
2986 if (CpuFeatures::IsSupported(SSE2)) { | 2990 if (CpuFeatures::IsSupported(SSE2)) { |
2987 CpuFeatures::Scope use_sse2(SSE2); | 2991 CpuFeatures::Scope use_sse2(SSE2); |
2988 | 2992 |
2989 // Load left and right operand into registers xmm0 and xmm1 and compare. | 2993 // Load left and right operand into registers xmm0 and xmm1 and compare. |
2990 LoadComparisonOperandSSE2(masm_, left_side, xmm0, left_side, right_side, | 2994 LoadComparisonOperandSSE2(masm_, left_side, xmm0, left_side, right_side, |
2991 ¬_numbers); | 2995 ¬_numbers); |
2992 LoadComparisonOperandSSE2(masm_, right_side, xmm1, left_side, right_side, | 2996 LoadComparisonOperandSSE2(masm_, right_side, xmm1, left_side, right_side, |
2993 ¬_numbers); | 2997 ¬_numbers); |
2994 __ comisd(xmm0, xmm1); | 2998 __ ucomisd(xmm0, xmm1); |
2995 } else { | 2999 } else { |
2996 Label check_right, compare; | 3000 Label check_right, compare; |
2997 | 3001 |
2998 // Make sure that both comparison operands are numbers. | 3002 // Make sure that both comparison operands are numbers. |
2999 CheckComparisonOperand(masm_, left_side, left_side, right_side, | 3003 CheckComparisonOperand(masm_, left_side, left_side, right_side, |
3000 ¬_numbers); | 3004 ¬_numbers); |
3001 CheckComparisonOperand(masm_, right_side, left_side, right_side, | 3005 CheckComparisonOperand(masm_, right_side, left_side, right_side, |
3002 ¬_numbers); | 3006 ¬_numbers); |
3003 | 3007 |
3004 // Load right and left operand to FPU stack and compare. | 3008 // Load right and left operand to FPU stack and compare. |
(...skipping 4294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7299 __ movsd(xmm1, xmm3); | 7303 __ movsd(xmm1, xmm3); |
7300 __ sqrtsd(xmm1, xmm1); | 7304 __ sqrtsd(xmm1, xmm1); |
7301 __ jmp(&allocate_return); | 7305 __ jmp(&allocate_return); |
7302 | 7306 |
7303 // Test for 0.5. | 7307 // Test for 0.5. |
7304 __ bind(¬_minus_half); | 7308 __ bind(¬_minus_half); |
7305 // Load xmm2 with 0.5. | 7309 // Load xmm2 with 0.5. |
7306 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. | 7310 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. |
7307 __ addsd(xmm2, xmm3); | 7311 __ addsd(xmm2, xmm3); |
7308 // xmm2 now has 0.5. | 7312 // xmm2 now has 0.5. |
7309 __ comisd(xmm2, xmm1); | 7313 __ ucomisd(xmm2, xmm1); |
7310 call_runtime.Branch(not_equal); | 7314 call_runtime.Branch(not_equal); |
7311 // Calculates square root. | 7315 // Calculates square root. |
7312 __ movsd(xmm1, xmm0); | 7316 __ movsd(xmm1, xmm0); |
7313 __ sqrtsd(xmm1, xmm1); | 7317 __ sqrtsd(xmm1, xmm1); |
7314 | 7318 |
7315 JumpTarget done; | 7319 JumpTarget done; |
7316 Label failure, success; | 7320 Label failure, success; |
7317 __ bind(&allocate_return); | 7321 __ bind(&allocate_return); |
7318 // Make a copy of the frame to enable us to handle allocation | 7322 // Make a copy of the frame to enable us to handle allocation |
7319 // failure after the JumpTarget jump. | 7323 // failure after the JumpTarget jump. |
(...skipping 4265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11585 FieldOperand(number_string_cache, | 11589 FieldOperand(number_string_cache, |
11586 index, | 11590 index, |
11587 times_twice_pointer_size, | 11591 times_twice_pointer_size, |
11588 FixedArray::kHeaderSize)); | 11592 FixedArray::kHeaderSize)); |
11589 __ test(probe, Immediate(kSmiTagMask)); | 11593 __ test(probe, Immediate(kSmiTagMask)); |
11590 __ j(zero, not_found); | 11594 __ j(zero, not_found); |
11591 if (CpuFeatures::IsSupported(SSE2)) { | 11595 if (CpuFeatures::IsSupported(SSE2)) { |
11592 CpuFeatures::Scope fscope(SSE2); | 11596 CpuFeatures::Scope fscope(SSE2); |
11593 __ movdbl(xmm0, FieldOperand(object, HeapNumber::kValueOffset)); | 11597 __ movdbl(xmm0, FieldOperand(object, HeapNumber::kValueOffset)); |
11594 __ movdbl(xmm1, FieldOperand(probe, HeapNumber::kValueOffset)); | 11598 __ movdbl(xmm1, FieldOperand(probe, HeapNumber::kValueOffset)); |
11595 __ comisd(xmm0, xmm1); | 11599 __ ucomisd(xmm0, xmm1); |
11596 } else { | 11600 } else { |
11597 __ fld_d(FieldOperand(object, HeapNumber::kValueOffset)); | 11601 __ fld_d(FieldOperand(object, HeapNumber::kValueOffset)); |
11598 __ fld_d(FieldOperand(probe, HeapNumber::kValueOffset)); | 11602 __ fld_d(FieldOperand(probe, HeapNumber::kValueOffset)); |
11599 __ FCmp(); | 11603 __ FCmp(); |
11600 } | 11604 } |
11601 __ j(parity_even, not_found); // Bail out if NaN is involved. | 11605 __ j(parity_even, not_found); // Bail out if NaN is involved. |
11602 __ j(not_equal, not_found); // The cache did not contain this value. | 11606 __ j(not_equal, not_found); // The cache did not contain this value. |
11603 __ jmp(&load_result_from_cache); | 11607 __ jmp(&load_result_from_cache); |
11604 } | 11608 } |
11605 | 11609 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11810 | 11814 |
11811 // Generate the number comparison code. | 11815 // Generate the number comparison code. |
11812 if (include_number_compare_) { | 11816 if (include_number_compare_) { |
11813 Label non_number_comparison; | 11817 Label non_number_comparison; |
11814 Label unordered; | 11818 Label unordered; |
11815 if (CpuFeatures::IsSupported(SSE2)) { | 11819 if (CpuFeatures::IsSupported(SSE2)) { |
11816 CpuFeatures::Scope use_sse2(SSE2); | 11820 CpuFeatures::Scope use_sse2(SSE2); |
11817 CpuFeatures::Scope use_cmov(CMOV); | 11821 CpuFeatures::Scope use_cmov(CMOV); |
11818 | 11822 |
11819 FloatingPointHelper::LoadSSE2Operands(masm, &non_number_comparison); | 11823 FloatingPointHelper::LoadSSE2Operands(masm, &non_number_comparison); |
11820 __ comisd(xmm0, xmm1); | 11824 __ ucomisd(xmm0, xmm1); |
11821 | 11825 |
11822 // Don't base result on EFLAGS when a NaN is involved. | 11826 // Don't base result on EFLAGS when a NaN is involved. |
11823 __ j(parity_even, &unordered, not_taken); | 11827 __ j(parity_even, &unordered, not_taken); |
11824 // Return a result of -1, 0, or 1, based on EFLAGS. | 11828 // Return a result of -1, 0, or 1, based on EFLAGS. |
11825 __ mov(eax, 0); // equal | 11829 __ mov(eax, 0); // equal |
11826 __ mov(ecx, Immediate(Smi::FromInt(1))); | 11830 __ mov(ecx, Immediate(Smi::FromInt(1))); |
11827 __ cmov(above, eax, Operand(ecx)); | 11831 __ cmov(above, eax, Operand(ecx)); |
11828 __ mov(ecx, Immediate(Smi::FromInt(-1))); | 11832 __ mov(ecx, Immediate(Smi::FromInt(-1))); |
11829 __ cmov(below, eax, Operand(ecx)); | 11833 __ cmov(below, eax, Operand(ecx)); |
11830 __ ret(2 * kPointerSize); | 11834 __ ret(2 * kPointerSize); |
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13709 masm.GetCode(&desc); | 13713 masm.GetCode(&desc); |
13710 // Call the function from C++. | 13714 // Call the function from C++. |
13711 return FUNCTION_CAST<MemCopyFunction>(buffer); | 13715 return FUNCTION_CAST<MemCopyFunction>(buffer); |
13712 } | 13716 } |
13713 | 13717 |
13714 #undef __ | 13718 #undef __ |
13715 | 13719 |
13716 } } // namespace v8::internal | 13720 } } // namespace v8::internal |
13717 | 13721 |
13718 #endif // V8_TARGET_ARCH_IA32 | 13722 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |