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 <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 // Clients of this interface shouldn't depend on lots of interpreter internals. | 10 // Clients of this interface shouldn't depend on lots of interpreter internals. |
11 // Do not include anything from src/interpreter here! | 11 // Do not include anything from src/interpreter here! |
12 #include "src/utils.h" | 12 #include "src/utils.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace interpreter { | 16 namespace interpreter { |
17 | 17 |
18 // The list of operand types used by bytecodes. | 18 // The list of operand types used by bytecodes. |
19 #define OPERAND_TYPE_LIST(V) \ | 19 #define OPERAND_TYPE_LIST(V) \ |
20 V(None) \ | 20 V(None) \ |
| 21 V(Count) \ |
21 V(Imm8) \ | 22 V(Imm8) \ |
22 V(Idx) \ | 23 V(Idx) \ |
23 V(Reg) | 24 V(Reg) |
24 | 25 |
25 // The list of bytecodes which are interpreted by the interpreter. | 26 // The list of bytecodes which are interpreted by the interpreter. |
26 #define BYTECODE_LIST(V) \ | 27 #define BYTECODE_LIST(V) \ |
27 \ | 28 \ |
28 /* Loading the accumulator */ \ | 29 /* Loading the accumulator */ \ |
29 V(LdaZero, OperandType::kNone) \ | 30 V(LdaZero, OperandType::kNone) \ |
30 V(LdaSmi8, OperandType::kImm8) \ | 31 V(LdaSmi8, OperandType::kImm8) \ |
(...skipping 16 matching lines...) Expand all Loading... |
47 V(StoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ | 48 V(StoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ |
48 V(KeyedStoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ | 49 V(KeyedStoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ |
49 \ | 50 \ |
50 /* Binary Operators */ \ | 51 /* Binary Operators */ \ |
51 V(Add, OperandType::kReg) \ | 52 V(Add, OperandType::kReg) \ |
52 V(Sub, OperandType::kReg) \ | 53 V(Sub, OperandType::kReg) \ |
53 V(Mul, OperandType::kReg) \ | 54 V(Mul, OperandType::kReg) \ |
54 V(Div, OperandType::kReg) \ | 55 V(Div, OperandType::kReg) \ |
55 V(Mod, OperandType::kReg) \ | 56 V(Mod, OperandType::kReg) \ |
56 \ | 57 \ |
| 58 /* Call operations. */ \ |
| 59 V(Call, OperandType::kReg, OperandType::kReg, OperandType::kCount) \ |
| 60 \ |
57 /* Control Flow */ \ | 61 /* Control Flow */ \ |
58 V(Return, OperandType::kNone) | 62 V(Return, OperandType::kNone) |
59 | 63 |
60 | 64 |
61 // Enumeration of operand types used by bytecodes. | 65 // Enumeration of operand types used by bytecodes. |
62 enum class OperandType : uint8_t { | 66 enum class OperandType : uint8_t { |
63 #define DECLARE_OPERAND_TYPE(Name) k##Name, | 67 #define DECLARE_OPERAND_TYPE(Name) k##Name, |
64 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) | 68 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) |
65 #undef DECLARE_OPERAND_TYPE | 69 #undef DECLARE_OPERAND_TYPE |
66 #define COUNT_OPERAND_TYPES(x) +1 | 70 #define COUNT_OPERAND_TYPES(x) +1 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 }; | 163 }; |
160 | 164 |
161 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 165 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
162 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 166 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
163 | 167 |
164 } // namespace interpreter | 168 } // namespace interpreter |
165 } // namespace internal | 169 } // namespace internal |
166 } // namespace v8 | 170 } // namespace v8 |
167 | 171 |
168 #endif // V8_INTERPRETER_BYTECODES_H_ | 172 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |