Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 2831009: Remove the comisd instruction from the ia32 and x64 assemblers. We... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 &not_numbers); 2995 &not_numbers);
2992 LoadComparisonOperandSSE2(masm_, right_side, xmm1, left_side, right_side, 2996 LoadComparisonOperandSSE2(masm_, right_side, xmm1, left_side, right_side,
2993 &not_numbers); 2997 &not_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 &not_numbers); 3004 &not_numbers);
3001 CheckComparisonOperand(masm_, right_side, left_side, right_side, 3005 CheckComparisonOperand(masm_, right_side, left_side, right_side,
3002 &not_numbers); 3006 &not_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
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(&not_minus_half); 7308 __ bind(&not_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
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
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
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
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698