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

Side by Side Diff: src/compiler/x64/code-generator-x64.cc

Issue 436593002: [turbofan] Add Int32AddWithOverflow machine operator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 // Fall through. 655 // Fall through.
656 case kUnsignedLessThanOrEqual: 656 case kUnsignedLessThanOrEqual:
657 __ j(below_equal, tlabel); 657 __ j(below_equal, tlabel);
658 break; 658 break;
659 case kUnorderedGreaterThan: 659 case kUnorderedGreaterThan:
660 __ j(parity_even, tlabel); 660 __ j(parity_even, tlabel);
661 // Fall through. 661 // Fall through.
662 case kUnsignedGreaterThan: 662 case kUnsignedGreaterThan:
663 __ j(above, tlabel); 663 __ j(above, tlabel);
664 break; 664 break;
665 case kOverflow:
666 __ j(overflow, tlabel);
667 break;
668 case kNotOverflow:
669 __ j(no_overflow, tlabel);
670 break;
665 } 671 }
666 if (!fallthru) __ jmp(flabel, flabel_distance); // no fallthru to flabel. 672 if (!fallthru) __ jmp(flabel, flabel_distance); // no fallthru to flabel.
667 __ bind(&done); 673 __ bind(&done);
668 } 674 }
669 675
670 676
671 // Assembles boolean materializations after this instruction. 677 // Assembles boolean materializations after this instruction.
672 void CodeGenerator::AssembleArchBoolean(Instruction* instr, 678 void CodeGenerator::AssembleArchBoolean(Instruction* instr,
673 FlagsCondition condition) { 679 FlagsCondition condition) {
674 X64OperandConverter i(this, instr); 680 X64OperandConverter i(this, instr);
675 Label done; 681 Label done;
676 682
677 // Materialize a full 32-bit 1 or 0 value. 683 // Materialize a full 64-bit 1 or 0 value. The result register is always the
684 // last output of the instruction.
678 Label check; 685 Label check;
679 Register reg = i.OutputRegister(); 686 ASSERT_NE(0, instr->OutputCount());
687 Register reg = i.OutputRegister(instr->OutputCount() - 1);
680 Condition cc = no_condition; 688 Condition cc = no_condition;
681 switch (condition) { 689 switch (condition) {
682 case kUnorderedEqual: 690 case kUnorderedEqual:
683 __ j(parity_odd, &check, Label::kNear); 691 __ j(parity_odd, &check, Label::kNear);
684 __ movl(reg, Immediate(0)); 692 __ movl(reg, Immediate(0));
685 __ jmp(&done, Label::kNear); 693 __ jmp(&done, Label::kNear);
686 // Fall through. 694 // Fall through.
687 case kEqual: 695 case kEqual:
688 cc = equal; 696 cc = equal;
689 break; 697 break;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 cc = below_equal; 740 cc = below_equal;
733 break; 741 break;
734 case kUnorderedGreaterThan: 742 case kUnorderedGreaterThan:
735 __ j(parity_odd, &check, Label::kNear); 743 __ j(parity_odd, &check, Label::kNear);
736 __ movl(reg, Immediate(1)); 744 __ movl(reg, Immediate(1));
737 __ jmp(&done, Label::kNear); 745 __ jmp(&done, Label::kNear);
738 // Fall through. 746 // Fall through.
739 case kUnsignedGreaterThan: 747 case kUnsignedGreaterThan:
740 cc = above; 748 cc = above;
741 break; 749 break;
750 case kOverflow:
751 cc = overflow;
752 break;
753 case kNotOverflow:
754 cc = no_overflow;
755 break;
742 } 756 }
743 __ bind(&check); 757 __ bind(&check);
744 __ setcc(cc, reg); 758 __ setcc(cc, reg);
745 __ movzxbl(reg, reg); 759 __ movzxbl(reg, reg);
746 __ bind(&done); 760 __ bind(&done);
747 } 761 }
748 762
749 763
750 void CodeGenerator::AssemblePrologue() { 764 void CodeGenerator::AssemblePrologue() {
751 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 765 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 return false; 988 return false;
975 } 989 }
976 return *(code->instruction_start() + start_pc) == 990 return *(code->instruction_start() + start_pc) ==
977 v8::internal::Assembler::kNopByte; 991 v8::internal::Assembler::kNopByte;
978 } 992 }
979 993
980 #endif 994 #endif
981 } 995 }
982 } 996 }
983 } // namespace v8::internal::compiler 997 } // namespace v8::internal::compiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698