OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_MIPS_CONSTANTS_H_ | 5 #ifndef V8_MIPS_CONSTANTS_H_ |
6 #define V8_MIPS_CONSTANTS_H_ | 6 #define V8_MIPS_CONSTANTS_H_ |
7 #include "src/globals.h" | 7 #include "src/globals.h" |
8 // UNIMPLEMENTED_ macro for MIPS. | 8 // UNIMPLEMENTED_ macro for MIPS. |
9 #ifdef DEBUG | 9 #ifdef DEBUG |
10 #define UNIMPLEMENTED_MIPS() \ | 10 #define UNIMPLEMENTED_MIPS() \ |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 | 601 |
602 // POP76 Encoding of rs Field. | 602 // POP76 Encoding of rs Field. |
603 JIALC = ((0 << 5) + 0), | 603 JIALC = ((0 << 5) + 0), |
604 | 604 |
605 NULLSF = 0 | 605 NULLSF = 0 |
606 }; | 606 }; |
607 | 607 |
608 | 608 |
609 // ----- Emulated conditions. | 609 // ----- Emulated conditions. |
610 // On MIPS we use this enum to abstract from conditional branch instructions. | 610 // On MIPS we use this enum to abstract from conditional branch instructions. |
611 // The 'U' prefix is used to specify unsigned comparisons. | |
612 // Opposite conditions must be paired as odd/even numbers | 611 // Opposite conditions must be paired as odd/even numbers |
613 // because 'NegateCondition' function flips LSB to negate condition. | 612 // because 'NegateCondition' function flips LSB to negate condition. |
613 // CC values for any comparison involving equality has LS bit set. | |
614 // TODO(plind): remove unused conditions, and renumber. | |
614 enum Condition { | 615 enum Condition { |
615 // Any value < 0 is considered no_condition. | 616 // Any value < 0 is considered no_condition. |
616 kNoCondition = -1, | 617 kNoCondition = -1, |
617 overflow = 0, | 618 // overflow = 0, |
618 no_overflow = 1, | 619 // no_overflow = 1, |
619 Uless = 2, | 620 |
620 Ugreater_equal = 3, | 621 lo = 2, // Unsigned less than (lower) |
621 Uless_equal = 4, | 622 hs = 3, // Unsigned greater than or equal (higher or same). |
622 Ugreater = 5, | 623 hi = 4, // Unsigned greater than (higher). |
623 equal = 6, | 624 ls = 5, // Unsigned less than or equal (lower or same). |
624 not_equal = 7, // Unordered or Not Equal. | 625 ne = 6, // Unordered or Not Equal. |
625 negative = 8, | 626 eq = 7, // Equal. |
626 positive = 9, | 627 // mi = 8, |
627 parity_even = 10, | 628 // pl = 9, |
628 parity_odd = 11, | 629 // parity_even = 10, |
629 less = 12, | 630 // parity_odd = 11, |
630 greater_equal = 13, | 631 lt = 12, // Less than. |
631 less_equal = 14, | 632 ge = 13, // Great than or equal. |
632 greater = 15, | 633 gt = 14, // Greater than. |
634 le = 15, // Less than or equal. | |
633 ueq = 16, // Unordered or Equal. | 635 ueq = 16, // Unordered or Equal. |
634 ogl = 17, // Ordered and Not Equal. | 636 ogl = 17, // Ordered and Not Equal. |
635 cc_always = 18, | 637 cc_always = 18, |
636 | 638 |
637 // Aliases. | 639 // Aliases. |
638 carry = Uless, | |
639 not_carry = Ugreater_equal, | |
640 zero = equal, | |
641 eq = equal, | |
642 not_zero = not_equal, | |
643 ne = not_equal, | |
644 nz = not_equal, | |
645 sign = negative, | |
646 not_sign = positive, | |
647 mi = negative, | |
648 pl = positive, | |
649 hi = Ugreater, | |
650 ls = Uless_equal, | |
651 ge = greater_equal, | |
652 lt = less, | |
653 gt = greater, | |
654 le = less_equal, | |
655 hs = Ugreater_equal, | |
656 lo = Uless, | |
657 al = cc_always, | 640 al = cc_always, |
658 ult = Uless, | 641 nz = ne, // TODO(plind): consider deleting nz |
659 uge = Ugreater_equal, | 642 |
660 ule = Uless_equal, | 643 // // TODO(plind): Currently unused aliases - delete. |
661 ugt = Ugreater, | 644 // carry = Uless, |
645 // not_carry = Ugreater_equal, | |
646 // equal = eq, | |
647 // zero = equal, | |
648 // not_equal = ne, | |
649 // not_zero = not_equal, | |
650 | |
651 // negative = mi, | |
652 // positive = pl, | |
653 // sign = negative, | |
654 // not_sign = positive, | |
655 | |
656 // // TODO(plind): These aliases ARE used, and should likey be factored out. | |
657 Ugreater = hi, | |
658 Uless_equal = ls, | |
659 greater_equal = ge, | |
660 less = lt, | |
661 greater = gt, | |
662 less_equal = le, | |
663 Ugreater_equal = hs, | |
664 Uless = lo, | |
665 | |
666 // TODO(plind): understand these aliases for FP, do we need them? | |
667 ult = lo, | |
668 uge = hs, | |
669 ule = ls, | |
670 ugt = hi, | |
671 | |
662 cc_default = kNoCondition | 672 cc_default = kNoCondition |
663 }; | 673 }; |
664 | 674 |
665 | 675 |
676 // Conditions are assigned so LSB is set for condition including equality. | |
677 inline bool ConditionIncludesEquality(Condition cc) { | |
678 DCHECK(cc != cc_always); | |
679 // TODO(plind): consider DCHECK to validate LSB set properly. | |
680 return (cc & 1); | |
681 } | |
682 | |
paul.l...
2015/09/04 03:45:24
This function is no longer needed. I had thought t
balazs.kilvady
2015/09/04 09:27:45
I think the unsused function should be removed but
| |
683 | |
666 // Returns the equivalent of !cc. | 684 // Returns the equivalent of !cc. |
667 // Negation of the default kNoCondition (-1) results in a non-default | 685 // Negation of the default kNoCondition (-1) results in a non-default |
668 // no_condition value (-2). As long as tests for no_condition check | 686 // no_condition value (-2). As long as tests for no_condition check |
669 // for condition < 0, this will work as expected. | 687 // for condition < 0, this will work as expected. |
670 inline Condition NegateCondition(Condition cc) { | 688 inline Condition NegateCondition(Condition cc) { |
671 DCHECK(cc != cc_always); | 689 DCHECK(cc != cc_always); |
672 return static_cast<Condition>(cc ^ 1); | 690 return static_cast<Condition>(cc ^ 1); |
673 } | 691 } |
674 | 692 |
675 | 693 |
(...skipping 26 matching lines...) Expand all Loading... | |
702 return ueq; | 720 return ueq; |
703 default: | 721 default: |
704 return cc; | 722 return cc; |
705 } | 723 } |
706 } | 724 } |
707 | 725 |
708 | 726 |
709 // Commute a condition such that {a cond b == b cond' a}. | 727 // Commute a condition such that {a cond b == b cond' a}. |
710 inline Condition CommuteCondition(Condition cc) { | 728 inline Condition CommuteCondition(Condition cc) { |
711 switch (cc) { | 729 switch (cc) { |
712 case Uless: | 730 case lo: |
713 return Ugreater; | 731 return hi; |
714 case Ugreater: | 732 case hi: |
715 return Uless; | 733 return lo; |
716 case Ugreater_equal: | 734 case hs: |
717 return Uless_equal; | 735 return ls; |
718 case Uless_equal: | 736 case ls: |
719 return Ugreater_equal; | 737 return hs; |
720 case less: | 738 case lt: |
721 return greater; | 739 return gt; |
722 case greater: | 740 case gt: |
723 return less; | 741 return lt; |
724 case greater_equal: | 742 case ge: |
725 return less_equal; | 743 return le; |
726 case less_equal: | 744 case le: |
727 return greater_equal; | 745 return ge; |
728 default: | 746 default: |
729 return cc; | 747 return cc; |
730 } | 748 } |
731 } | 749 } |
732 | 750 |
733 | 751 |
734 // ----- Coprocessor conditions. | 752 // ----- Coprocessor conditions. |
735 enum FPUCondition { | 753 enum FPUCondition { |
736 kNoFPUCondition = -1, | 754 kNoFPUCondition = -1, |
737 | 755 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1040 // JS argument slots size. | 1058 // JS argument slots size. |
1041 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; | 1059 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; |
1042 // Assembly builtins argument slots size. | 1060 // Assembly builtins argument slots size. |
1043 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; | 1061 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; |
1044 | 1062 |
1045 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 1063 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
1046 | 1064 |
1047 } } // namespace v8::internal | 1065 } } // namespace v8::internal |
1048 | 1066 |
1049 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 1067 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
OLD | NEW |