OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_INTERPRETER_BYTECODES_H_ | 5 #ifndef V8_INTERPRETER_BYTECODES_H_ |
6 #define V8_INTERPRETER_BYTECODES_H_ | 6 #define V8_INTERPRETER_BYTECODES_H_ |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <string> | 10 #include <string> |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 return 3; | 865 return 3; |
866 case OperandType::kRegList: | 866 case OperandType::kRegList: |
867 case OperandType::kRegOutList: | 867 case OperandType::kRegOutList: |
868 UNREACHABLE(); | 868 UNREACHABLE(); |
869 default: | 869 default: |
870 return 0; | 870 return 0; |
871 } | 871 } |
872 UNREACHABLE(); | 872 UNREACHABLE(); |
873 } | 873 } |
874 | 874 |
875 // Returns the size of |operand_type| for |operand_scale|. | 875 // Returns the size of |operand| for |operand_scale|. |
876 static OperandSize SizeOfOperand(OperandType operand_type, | 876 static OperandSize SizeOfOperand(OperandType operand, OperandScale scale); |
877 OperandScale operand_scale) { | |
878 DCHECK_LE(operand_type, OperandType::kLast); | |
879 DCHECK_GE(operand_scale, OperandScale::kSingle); | |
880 DCHECK_LE(operand_scale, OperandScale::kLast); | |
881 STATIC_ASSERT(static_cast<int>(OperandScale::kQuadruple) == 4 && | |
882 OperandScale::kLast == OperandScale::kQuadruple); | |
883 int scale_index = static_cast<int>(operand_scale) >> 1; | |
884 return kOperandKindSizes[static_cast<size_t>(operand_type)][scale_index]; | |
885 } | |
886 | 877 |
887 // Returns true if |operand_type| is a runtime-id operand (kRuntimeId). | 878 // Returns true if |operand_type| is a runtime-id operand (kRuntimeId). |
888 static bool IsRuntimeIdOperandType(OperandType operand_type); | 879 static bool IsRuntimeIdOperandType(OperandType operand_type); |
889 | 880 |
890 // Returns true if |operand_type| is unsigned, false if signed. | 881 // Returns true if |operand_type| is unsigned, false if signed. |
891 static bool IsUnsignedOperandType(OperandType operand_type); | 882 static bool IsUnsignedOperandType(OperandType operand_type); |
892 | 883 |
893 // Returns true if a handler is generated for a bytecode at a given | 884 // Returns true if a handler is generated for a bytecode at a given |
894 // operand scale. All bytecodes have handlers at OperandScale::kSingle, | 885 // operand scale. All bytecodes have handlers at OperandScale::kSingle, |
895 // but only bytecodes with scalable operands have handlers with larger | 886 // but only bytecodes with scalable operands have handlers with larger |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 | 922 |
932 private: | 923 private: |
933 static const OperandType* const kOperandTypes[]; | 924 static const OperandType* const kOperandTypes[]; |
934 static const OperandTypeInfo* const kOperandTypeInfos[]; | 925 static const OperandTypeInfo* const kOperandTypeInfos[]; |
935 static const int kOperandCount[]; | 926 static const int kOperandCount[]; |
936 static const int kNumberOfRegisterOperands[]; | 927 static const int kNumberOfRegisterOperands[]; |
937 static const AccumulatorUse kAccumulatorUse[]; | 928 static const AccumulatorUse kAccumulatorUse[]; |
938 static const bool kIsScalable[]; | 929 static const bool kIsScalable[]; |
939 static const int kBytecodeSizes[][3]; | 930 static const int kBytecodeSizes[][3]; |
940 static const OperandSize* const kOperandSizes[][3]; | 931 static const OperandSize* const kOperandSizes[][3]; |
941 static OperandSize const kOperandKindSizes[][3]; | |
942 }; | 932 }; |
943 | 933 |
944 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 934 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
945 const Bytecode& bytecode); | 935 const Bytecode& bytecode); |
946 | 936 |
947 } // namespace interpreter | 937 } // namespace interpreter |
948 } // namespace internal | 938 } // namespace internal |
949 } // namespace v8 | 939 } // namespace v8 |
950 | 940 |
951 #endif // V8_INTERPRETER_BYTECODES_H_ | 941 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |