| 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 | 7 |
| 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 492 |
| 493 cc_default = kNoCondition | 493 cc_default = kNoCondition |
| 494 }; | 494 }; |
| 495 | 495 |
| 496 | 496 |
| 497 // Returns the equivalent of !cc. | 497 // Returns the equivalent of !cc. |
| 498 // Negation of the default kNoCondition (-1) results in a non-default | 498 // Negation of the default kNoCondition (-1) results in a non-default |
| 499 // no_condition value (-2). As long as tests for no_condition check | 499 // no_condition value (-2). As long as tests for no_condition check |
| 500 // for condition < 0, this will work as expected. | 500 // for condition < 0, this will work as expected. |
| 501 inline Condition NegateCondition(Condition cc) { | 501 inline Condition NegateCondition(Condition cc) { |
| 502 ASSERT(cc != cc_always); | 502 DCHECK(cc != cc_always); |
| 503 return static_cast<Condition>(cc ^ 1); | 503 return static_cast<Condition>(cc ^ 1); |
| 504 } | 504 } |
| 505 | 505 |
| 506 | 506 |
| 507 // Commute a condition such that {a cond b == b cond' a}. | 507 // Commute a condition such that {a cond b == b cond' a}. |
| 508 inline Condition CommuteCondition(Condition cc) { | 508 inline Condition CommuteCondition(Condition cc) { |
| 509 switch (cc) { | 509 switch (cc) { |
| 510 case Uless: | 510 case Uless: |
| 511 return Ugreater; | 511 return Ugreater; |
| 512 case Ugreater: | 512 case Ugreater: |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 Type InstructionType() const; | 653 Type InstructionType() const; |
| 654 | 654 |
| 655 | 655 |
| 656 // Accessors for the different named fields used in the MIPS encoding. | 656 // Accessors for the different named fields used in the MIPS encoding. |
| 657 inline Opcode OpcodeValue() const { | 657 inline Opcode OpcodeValue() const { |
| 658 return static_cast<Opcode>( | 658 return static_cast<Opcode>( |
| 659 Bits(kOpcodeShift + kOpcodeBits - 1, kOpcodeShift)); | 659 Bits(kOpcodeShift + kOpcodeBits - 1, kOpcodeShift)); |
| 660 } | 660 } |
| 661 | 661 |
| 662 inline int RsValue() const { | 662 inline int RsValue() const { |
| 663 ASSERT(InstructionType() == kRegisterType || | 663 DCHECK(InstructionType() == kRegisterType || |
| 664 InstructionType() == kImmediateType); | 664 InstructionType() == kImmediateType); |
| 665 return Bits(kRsShift + kRsBits - 1, kRsShift); | 665 return Bits(kRsShift + kRsBits - 1, kRsShift); |
| 666 } | 666 } |
| 667 | 667 |
| 668 inline int RtValue() const { | 668 inline int RtValue() const { |
| 669 ASSERT(InstructionType() == kRegisterType || | 669 DCHECK(InstructionType() == kRegisterType || |
| 670 InstructionType() == kImmediateType); | 670 InstructionType() == kImmediateType); |
| 671 return Bits(kRtShift + kRtBits - 1, kRtShift); | 671 return Bits(kRtShift + kRtBits - 1, kRtShift); |
| 672 } | 672 } |
| 673 | 673 |
| 674 inline int RdValue() const { | 674 inline int RdValue() const { |
| 675 ASSERT(InstructionType() == kRegisterType); | 675 DCHECK(InstructionType() == kRegisterType); |
| 676 return Bits(kRdShift + kRdBits - 1, kRdShift); | 676 return Bits(kRdShift + kRdBits - 1, kRdShift); |
| 677 } | 677 } |
| 678 | 678 |
| 679 inline int SaValue() const { | 679 inline int SaValue() const { |
| 680 ASSERT(InstructionType() == kRegisterType); | 680 DCHECK(InstructionType() == kRegisterType); |
| 681 return Bits(kSaShift + kSaBits - 1, kSaShift); | 681 return Bits(kSaShift + kSaBits - 1, kSaShift); |
| 682 } | 682 } |
| 683 | 683 |
| 684 inline int FunctionValue() const { | 684 inline int FunctionValue() const { |
| 685 ASSERT(InstructionType() == kRegisterType || | 685 DCHECK(InstructionType() == kRegisterType || |
| 686 InstructionType() == kImmediateType); | 686 InstructionType() == kImmediateType); |
| 687 return Bits(kFunctionShift + kFunctionBits - 1, kFunctionShift); | 687 return Bits(kFunctionShift + kFunctionBits - 1, kFunctionShift); |
| 688 } | 688 } |
| 689 | 689 |
| 690 inline int FdValue() const { | 690 inline int FdValue() const { |
| 691 return Bits(kFdShift + kFdBits - 1, kFdShift); | 691 return Bits(kFdShift + kFdBits - 1, kFdShift); |
| 692 } | 692 } |
| 693 | 693 |
| 694 inline int FsValue() const { | 694 inline int FsValue() const { |
| 695 return Bits(kFsShift + kFsBits - 1, kFsShift); | 695 return Bits(kFsShift + kFsBits - 1, kFsShift); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 717 inline int FBtrueValue() const { | 717 inline int FBtrueValue() const { |
| 718 return Bits(kFBtrueShift + kFBtrueBits - 1, kFBtrueShift); | 718 return Bits(kFBtrueShift + kFBtrueBits - 1, kFBtrueShift); |
| 719 } | 719 } |
| 720 | 720 |
| 721 // Return the fields at their original place in the instruction encoding. | 721 // Return the fields at their original place in the instruction encoding. |
| 722 inline Opcode OpcodeFieldRaw() const { | 722 inline Opcode OpcodeFieldRaw() const { |
| 723 return static_cast<Opcode>(InstructionBits() & kOpcodeMask); | 723 return static_cast<Opcode>(InstructionBits() & kOpcodeMask); |
| 724 } | 724 } |
| 725 | 725 |
| 726 inline int RsFieldRaw() const { | 726 inline int RsFieldRaw() const { |
| 727 ASSERT(InstructionType() == kRegisterType || | 727 DCHECK(InstructionType() == kRegisterType || |
| 728 InstructionType() == kImmediateType); | 728 InstructionType() == kImmediateType); |
| 729 return InstructionBits() & kRsFieldMask; | 729 return InstructionBits() & kRsFieldMask; |
| 730 } | 730 } |
| 731 | 731 |
| 732 // Same as above function, but safe to call within InstructionType(). | 732 // Same as above function, but safe to call within InstructionType(). |
| 733 inline int RsFieldRawNoAssert() const { | 733 inline int RsFieldRawNoAssert() const { |
| 734 return InstructionBits() & kRsFieldMask; | 734 return InstructionBits() & kRsFieldMask; |
| 735 } | 735 } |
| 736 | 736 |
| 737 inline int RtFieldRaw() const { | 737 inline int RtFieldRaw() const { |
| 738 ASSERT(InstructionType() == kRegisterType || | 738 DCHECK(InstructionType() == kRegisterType || |
| 739 InstructionType() == kImmediateType); | 739 InstructionType() == kImmediateType); |
| 740 return InstructionBits() & kRtFieldMask; | 740 return InstructionBits() & kRtFieldMask; |
| 741 } | 741 } |
| 742 | 742 |
| 743 inline int RdFieldRaw() const { | 743 inline int RdFieldRaw() const { |
| 744 ASSERT(InstructionType() == kRegisterType); | 744 DCHECK(InstructionType() == kRegisterType); |
| 745 return InstructionBits() & kRdFieldMask; | 745 return InstructionBits() & kRdFieldMask; |
| 746 } | 746 } |
| 747 | 747 |
| 748 inline int SaFieldRaw() const { | 748 inline int SaFieldRaw() const { |
| 749 ASSERT(InstructionType() == kRegisterType); | 749 DCHECK(InstructionType() == kRegisterType); |
| 750 return InstructionBits() & kSaFieldMask; | 750 return InstructionBits() & kSaFieldMask; |
| 751 } | 751 } |
| 752 | 752 |
| 753 inline int FunctionFieldRaw() const { | 753 inline int FunctionFieldRaw() const { |
| 754 return InstructionBits() & kFunctionFieldMask; | 754 return InstructionBits() & kFunctionFieldMask; |
| 755 } | 755 } |
| 756 | 756 |
| 757 // Get the secondary field according to the opcode. | 757 // Get the secondary field according to the opcode. |
| 758 inline int SecondaryValue() const { | 758 inline int SecondaryValue() const { |
| 759 Opcode op = OpcodeFieldRaw(); | 759 Opcode op = OpcodeFieldRaw(); |
| 760 switch (op) { | 760 switch (op) { |
| 761 case SPECIAL: | 761 case SPECIAL: |
| 762 case SPECIAL2: | 762 case SPECIAL2: |
| 763 return FunctionValue(); | 763 return FunctionValue(); |
| 764 case COP1: | 764 case COP1: |
| 765 return RsValue(); | 765 return RsValue(); |
| 766 case REGIMM: | 766 case REGIMM: |
| 767 return RtValue(); | 767 return RtValue(); |
| 768 default: | 768 default: |
| 769 return NULLSF; | 769 return NULLSF; |
| 770 } | 770 } |
| 771 } | 771 } |
| 772 | 772 |
| 773 inline int32_t Imm16Value() const { | 773 inline int32_t Imm16Value() const { |
| 774 ASSERT(InstructionType() == kImmediateType); | 774 DCHECK(InstructionType() == kImmediateType); |
| 775 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); | 775 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); |
| 776 } | 776 } |
| 777 | 777 |
| 778 inline int32_t Imm26Value() const { | 778 inline int32_t Imm26Value() const { |
| 779 ASSERT(InstructionType() == kJumpType); | 779 DCHECK(InstructionType() == kJumpType); |
| 780 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); | 780 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); |
| 781 } | 781 } |
| 782 | 782 |
| 783 // Say if the instruction should not be used in a branch delay slot. | 783 // Say if the instruction should not be used in a branch delay slot. |
| 784 bool IsForbiddenInBranchDelay() const; | 784 bool IsForbiddenInBranchDelay() const; |
| 785 // Say if the instruction 'links'. e.g. jal, bal. | 785 // Say if the instruction 'links'. e.g. jal, bal. |
| 786 bool IsLinkingInstruction() const; | 786 bool IsLinkingInstruction() const; |
| 787 // Say if the instruction is a break or a trap. | 787 // Say if the instruction is a break or a trap. |
| 788 bool IsTrap() const; | 788 bool IsTrap() const; |
| 789 | 789 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 810 // JS argument slots size. | 810 // JS argument slots size. |
| 811 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; | 811 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; |
| 812 // Assembly builtins argument slots size. | 812 // Assembly builtins argument slots size. |
| 813 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; | 813 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; |
| 814 | 814 |
| 815 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 815 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
| 816 | 816 |
| 817 } } // namespace v8::internal | 817 } } // namespace v8::internal |
| 818 | 818 |
| 819 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 819 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
| OLD | NEW |