| OLD | NEW |
| 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 // Fall through. | 660 // Fall through. |
| 661 case kUnsignedLessThanOrEqual: | 661 case kUnsignedLessThanOrEqual: |
| 662 __ j(below_equal, tlabel); | 662 __ j(below_equal, tlabel); |
| 663 break; | 663 break; |
| 664 case kUnorderedGreaterThan: | 664 case kUnorderedGreaterThan: |
| 665 __ j(parity_even, tlabel); | 665 __ j(parity_even, tlabel); |
| 666 // Fall through. | 666 // Fall through. |
| 667 case kUnsignedGreaterThan: | 667 case kUnsignedGreaterThan: |
| 668 __ j(above, tlabel); | 668 __ j(above, tlabel); |
| 669 break; | 669 break; |
| 670 case kOverflow: |
| 671 __ j(overflow, tlabel); |
| 672 break; |
| 673 case kNotOverflow: |
| 674 __ j(no_overflow, tlabel); |
| 675 break; |
| 670 } | 676 } |
| 671 if (!fallthru) __ jmp(flabel, flabel_distance); // no fallthru to flabel. | 677 if (!fallthru) __ jmp(flabel, flabel_distance); // no fallthru to flabel. |
| 672 __ bind(&done); | 678 __ bind(&done); |
| 673 } | 679 } |
| 674 | 680 |
| 675 | 681 |
| 676 // Assembles boolean materializations after this instruction. | 682 // Assembles boolean materializations after this instruction. |
| 677 void CodeGenerator::AssembleArchBoolean(Instruction* instr, | 683 void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
| 678 FlagsCondition condition) { | 684 FlagsCondition condition) { |
| 679 X64OperandConverter i(this, instr); | 685 X64OperandConverter i(this, instr); |
| 680 Label done; | 686 Label done; |
| 681 | 687 |
| 682 // Materialize a full 32-bit 1 or 0 value. | 688 // Materialize a full 64-bit 1 or 0 value. The result register is always the |
| 689 // last output of the instruction. |
| 683 Label check; | 690 Label check; |
| 684 Register reg = i.OutputRegister(); | 691 ASSERT_NE(0, instr->OutputCount()); |
| 692 Register reg = i.OutputRegister(instr->OutputCount() - 1); |
| 685 Condition cc = no_condition; | 693 Condition cc = no_condition; |
| 686 switch (condition) { | 694 switch (condition) { |
| 687 case kUnorderedEqual: | 695 case kUnorderedEqual: |
| 688 __ j(parity_odd, &check, Label::kNear); | 696 __ j(parity_odd, &check, Label::kNear); |
| 689 __ movl(reg, Immediate(0)); | 697 __ movl(reg, Immediate(0)); |
| 690 __ jmp(&done, Label::kNear); | 698 __ jmp(&done, Label::kNear); |
| 691 // Fall through. | 699 // Fall through. |
| 692 case kEqual: | 700 case kEqual: |
| 693 cc = equal; | 701 cc = equal; |
| 694 break; | 702 break; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 cc = below_equal; | 745 cc = below_equal; |
| 738 break; | 746 break; |
| 739 case kUnorderedGreaterThan: | 747 case kUnorderedGreaterThan: |
| 740 __ j(parity_odd, &check, Label::kNear); | 748 __ j(parity_odd, &check, Label::kNear); |
| 741 __ movl(reg, Immediate(1)); | 749 __ movl(reg, Immediate(1)); |
| 742 __ jmp(&done, Label::kNear); | 750 __ jmp(&done, Label::kNear); |
| 743 // Fall through. | 751 // Fall through. |
| 744 case kUnsignedGreaterThan: | 752 case kUnsignedGreaterThan: |
| 745 cc = above; | 753 cc = above; |
| 746 break; | 754 break; |
| 755 case kOverflow: |
| 756 cc = overflow; |
| 757 break; |
| 758 case kNotOverflow: |
| 759 cc = no_overflow; |
| 760 break; |
| 747 } | 761 } |
| 748 __ bind(&check); | 762 __ bind(&check); |
| 749 __ setcc(cc, reg); | 763 __ setcc(cc, reg); |
| 750 __ movzxbl(reg, reg); | 764 __ movzxbl(reg, reg); |
| 751 __ bind(&done); | 765 __ bind(&done); |
| 752 } | 766 } |
| 753 | 767 |
| 754 | 768 |
| 755 void CodeGenerator::AssemblePrologue() { | 769 void CodeGenerator::AssemblePrologue() { |
| 756 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 770 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 return *(code->instruction_start() + start_pc) == | 995 return *(code->instruction_start() + start_pc) == |
| 982 v8::internal::Assembler::kNopByte; | 996 v8::internal::Assembler::kNopByte; |
| 983 } | 997 } |
| 984 | 998 |
| 985 #endif | 999 #endif |
| 986 | 1000 |
| 987 #endif | 1001 #endif |
| 988 } | 1002 } |
| 989 } | 1003 } |
| 990 } // namespace v8::internal::compiler | 1004 } // namespace v8::internal::compiler |
| OLD | NEW |