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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 /* Unary Operators */ \ | 136 /* Unary Operators */ \ |
137 V(Inc, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 137 V(Inc, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
138 V(Dec, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 138 V(Dec, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
139 V(ToBooleanLogicalNot, AccumulatorUse::kReadWrite) \ | 139 V(ToBooleanLogicalNot, AccumulatorUse::kReadWrite) \ |
140 V(LogicalNot, AccumulatorUse::kReadWrite) \ | 140 V(LogicalNot, AccumulatorUse::kReadWrite) \ |
141 V(TypeOf, AccumulatorUse::kReadWrite) \ | 141 V(TypeOf, AccumulatorUse::kReadWrite) \ |
142 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 142 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
143 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 143 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
144 \ | 144 \ |
145 /* Call operations */ \ | 145 /* Call operations */ \ |
146 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ | 146 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ |
147 OperandType::kRegCount, OperandType::kIdx) \ | 147 OperandType::kRegCount, OperandType::kIdx) \ |
148 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ | 148 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ |
149 OperandType::kRegCount, OperandType::kIdx) \ | 149 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ |
150 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ | 150 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ |
151 OperandType::kMaybeReg, OperandType::kRegCount) \ | 151 OperandType::kRegList, OperandType::kRegCount) \ |
152 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ | 152 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ |
153 OperandType::kMaybeReg, OperandType::kRegCount, OperandType::kRegOutPair) \ | 153 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \ |
154 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ | 154 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ |
155 OperandType::kReg, OperandType::kRegCount) \ | 155 OperandType::kRegList, OperandType::kRegCount) \ |
156 \ | 156 \ |
157 /* Intrinsics */ \ | 157 /* Intrinsics */ \ |
158 V(InvokeIntrinsic, AccumulatorUse::kWrite, OperandType::kIntrinsicId, \ | 158 V(InvokeIntrinsic, AccumulatorUse::kWrite, OperandType::kIntrinsicId, \ |
159 OperandType::kMaybeReg, OperandType::kRegCount) \ | 159 OperandType::kRegList, OperandType::kRegCount) \ |
160 \ | 160 \ |
161 /* New operator */ \ | 161 /* New operator */ \ |
162 V(New, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 162 V(New, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kRegList, \ |
163 OperandType::kMaybeReg, OperandType::kRegCount, OperandType::kIdx) \ | 163 OperandType::kRegCount, OperandType::kIdx) \ |
164 \ | 164 \ |
165 /* Test Operators */ \ | 165 /* Test Operators */ \ |
166 V(TestEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 166 V(TestEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
167 OperandType::kIdx) \ | 167 OperandType::kIdx) \ |
168 V(TestNotEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 168 V(TestNotEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
169 OperandType::kIdx) \ | 169 OperandType::kIdx) \ |
170 V(TestEqualStrict, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 170 V(TestEqualStrict, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
171 OperandType::kIdx) \ | 171 OperandType::kIdx) \ |
172 V(TestLessThan, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 172 V(TestLessThan, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
173 OperandType::kIdx) \ | 173 OperandType::kIdx) \ |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 static bool IsRegisterInputOperandType(OperandType operand_type); | 641 static bool IsRegisterInputOperandType(OperandType operand_type); |
642 | 642 |
643 // Returns true if |operand_type| represents a register used as an output. | 643 // Returns true if |operand_type| represents a register used as an output. |
644 static bool IsRegisterOutputOperandType(OperandType operand_type); | 644 static bool IsRegisterOutputOperandType(OperandType operand_type); |
645 | 645 |
646 // Returns true if the handler for |bytecode| should look ahead and inline a | 646 // Returns true if the handler for |bytecode| should look ahead and inline a |
647 // dispatch to a Star bytecode. | 647 // dispatch to a Star bytecode. |
648 static bool IsStarLookahead(Bytecode bytecode, OperandScale operand_scale); | 648 static bool IsStarLookahead(Bytecode bytecode, OperandScale operand_scale); |
649 | 649 |
650 // Returns the number of registers represented by a register operand. For | 650 // Returns the number of registers represented by a register operand. For |
651 // instance, a RegPair represents two registers. | 651 // instance, a RegPair represents two registers. Should not be called for |
| 652 // kRegList which has a variable number of registers based on the following |
| 653 // kRegCount operand. |
652 static int GetNumberOfRegistersRepresentedBy(OperandType operand_type) { | 654 static int GetNumberOfRegistersRepresentedBy(OperandType operand_type) { |
653 switch (operand_type) { | 655 switch (operand_type) { |
654 case OperandType::kMaybeReg: | |
655 case OperandType::kReg: | 656 case OperandType::kReg: |
656 case OperandType::kRegOut: | 657 case OperandType::kRegOut: |
657 return 1; | 658 return 1; |
658 case OperandType::kRegPair: | 659 case OperandType::kRegPair: |
659 case OperandType::kRegOutPair: | 660 case OperandType::kRegOutPair: |
660 return 2; | 661 return 2; |
661 case OperandType::kRegOutTriple: | 662 case OperandType::kRegOutTriple: |
662 return 3; | 663 return 3; |
| 664 case OperandType::kRegList: |
| 665 UNREACHABLE(); |
| 666 return 0; |
663 default: | 667 default: |
664 return 0; | 668 return 0; |
665 } | 669 } |
666 return 0; | 670 return 0; |
667 } | 671 } |
668 | 672 |
669 // Returns the size of |operand| for |operand_scale|. | 673 // Returns the size of |operand| for |operand_scale|. |
670 static OperandSize SizeOfOperand(OperandType operand, OperandScale scale); | 674 static OperandSize SizeOfOperand(OperandType operand, OperandScale scale); |
671 | 675 |
672 // Returns true if |operand_type| is a runtime-id operand (kRuntimeId). | 676 // Returns true if |operand_type| is a runtime-id operand (kRuntimeId). |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 // See crbug.com/603131. | 733 // See crbug.com/603131. |
730 #undef CONSTEXPR | 734 #undef CONSTEXPR |
731 | 735 |
732 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 736 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
733 | 737 |
734 } // namespace interpreter | 738 } // namespace interpreter |
735 } // namespace internal | 739 } // namespace internal |
736 } // namespace v8 | 740 } // namespace v8 |
737 | 741 |
738 #endif // V8_INTERPRETER_BYTECODES_H_ | 742 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |