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

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

Issue 197037: Use fucomi instruction to compare floats and put results directly into EFLAGS... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 3 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 6491 matching lines...) Expand 10 before | Expand all | Expand 10 after
6502 __ shr(edx, String::kShortLengthShift); 6502 __ shr(edx, String::kShortLengthShift);
6503 __ j(zero, &false_result); 6503 __ j(zero, &false_result);
6504 __ jmp(&true_result); 6504 __ jmp(&true_result);
6505 6505
6506 __ bind(&not_string); 6506 __ bind(&not_string);
6507 // HeapNumber => false iff +0, -0, or NaN. 6507 // HeapNumber => false iff +0, -0, or NaN.
6508 __ cmp(edx, Factory::heap_number_map()); 6508 __ cmp(edx, Factory::heap_number_map());
6509 __ j(not_equal, &true_result); 6509 __ j(not_equal, &true_result);
6510 __ fldz(); 6510 __ fldz();
6511 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); 6511 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
6512 __ fucompp(); 6512 __ FCmp();
6513 __ push(eax);
6514 __ fnstsw_ax();
6515 __ sahf();
6516 __ pop(eax);
6517 __ j(zero, &false_result); 6513 __ j(zero, &false_result);
6518 // Fall through to |true_result|. 6514 // Fall through to |true_result|.
6519 6515
6520 // Return 1/0 for true/false in eax. 6516 // Return 1/0 for true/false in eax.
6521 __ bind(&true_result); 6517 __ bind(&true_result);
6522 __ mov(eax, 1); 6518 __ mov(eax, 1);
6523 __ ret(1 * kPointerSize); 6519 __ ret(1 * kPointerSize);
6524 __ bind(&false_result); 6520 __ bind(&false_result);
6525 __ mov(eax, 0); 6521 __ mov(eax, 0);
6526 __ ret(1 * kPointerSize); 6522 __ ret(1 * kPointerSize);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
6759 CpuFeatures::Scope scope(CpuFeatures::SSE3); 6755 CpuFeatures::Scope scope(CpuFeatures::SSE3);
6760 __ fisttp_s(Operand(esp, 0 * kPointerSize)); 6756 __ fisttp_s(Operand(esp, 0 * kPointerSize));
6761 __ fisttp_s(Operand(esp, 1 * kPointerSize)); 6757 __ fisttp_s(Operand(esp, 1 * kPointerSize));
6762 __ fnstsw_ax(); 6758 __ fnstsw_ax();
6763 __ test(eax, Immediate(1)); 6759 __ test(eax, Immediate(1));
6764 __ j(not_zero, &operand_conversion_failure); 6760 __ j(not_zero, &operand_conversion_failure);
6765 } else { 6761 } else {
6766 // Check if right operand is int32. 6762 // Check if right operand is int32.
6767 __ fist_s(Operand(esp, 0 * kPointerSize)); 6763 __ fist_s(Operand(esp, 0 * kPointerSize));
6768 __ fild_s(Operand(esp, 0 * kPointerSize)); 6764 __ fild_s(Operand(esp, 0 * kPointerSize));
6769 __ fucompp(); 6765 __ FCmp();
6770 __ fnstsw_ax();
6771 __ sahf();
6772 __ j(not_zero, &operand_conversion_failure); 6766 __ j(not_zero, &operand_conversion_failure);
6773 __ j(parity_even, &operand_conversion_failure); 6767 __ j(parity_even, &operand_conversion_failure);
6774 6768
6775 // Check if left operand is int32. 6769 // Check if left operand is int32.
6776 __ fist_s(Operand(esp, 1 * kPointerSize)); 6770 __ fist_s(Operand(esp, 1 * kPointerSize));
6777 __ fild_s(Operand(esp, 1 * kPointerSize)); 6771 __ fild_s(Operand(esp, 1 * kPointerSize));
6778 __ fucompp(); 6772 __ FCmp();
6779 __ fnstsw_ax();
6780 __ sahf();
6781 __ j(not_zero, &operand_conversion_failure); 6773 __ j(not_zero, &operand_conversion_failure);
6782 __ j(parity_even, &operand_conversion_failure); 6774 __ j(parity_even, &operand_conversion_failure);
6783 } 6775 }
6784 6776
6785 // Get int32 operands and perform bitop. 6777 // Get int32 operands and perform bitop.
6786 __ pop(ecx); 6778 __ pop(ecx);
6787 __ pop(eax); 6779 __ pop(eax);
6788 switch (op_) { 6780 switch (op_) {
6789 case Token::BIT_OR: __ or_(eax, Operand(ecx)); break; 6781 case Token::BIT_OR: __ or_(eax, Operand(ecx)); break;
6790 case Token::BIT_AND: __ and_(eax, Operand(ecx)); break; 6782 case Token::BIT_AND: __ and_(eax, Operand(ecx)); break;
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
7869 7861
7870 int CompareStub::MinorKey() { 7862 int CompareStub::MinorKey() {
7871 // Encode the two parameters in a unique 16 bit value. 7863 // Encode the two parameters in a unique 16 bit value.
7872 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7864 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7873 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7865 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7874 } 7866 }
7875 7867
7876 #undef __ 7868 #undef __
7877 7869
7878 } } // namespace v8::internal 7870 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698