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 12 matching lines...) Expand all Loading... |
43 V(LoadIC, OperandType::kReg, OperandType::kIdx) \ | 44 V(LoadIC, OperandType::kReg, OperandType::kIdx) \ |
44 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \ | 45 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \ |
45 \ | 46 \ |
46 /* Binary Operators */ \ | 47 /* Binary Operators */ \ |
47 V(Add, OperandType::kReg) \ | 48 V(Add, OperandType::kReg) \ |
48 V(Sub, OperandType::kReg) \ | 49 V(Sub, OperandType::kReg) \ |
49 V(Mul, OperandType::kReg) \ | 50 V(Mul, OperandType::kReg) \ |
50 V(Div, OperandType::kReg) \ | 51 V(Div, OperandType::kReg) \ |
51 V(Mod, OperandType::kReg) \ | 52 V(Mod, OperandType::kReg) \ |
52 \ | 53 \ |
| 54 /* Call operations. */ \ |
| 55 V(CallJS, OperandType::kReg, OperandType::kCount) \ |
| 56 \ |
53 /* Control Flow */ \ | 57 /* Control Flow */ \ |
54 V(Return, OperandType::kNone) | 58 V(Return, OperandType::kNone) |
55 | 59 |
56 | 60 |
57 // Enumeration of operand types used by bytecodes. | 61 // Enumeration of operand types used by bytecodes. |
58 enum class OperandType : uint8_t { | 62 enum class OperandType : uint8_t { |
59 #define DECLARE_OPERAND_TYPE(Name) k##Name, | 63 #define DECLARE_OPERAND_TYPE(Name) k##Name, |
60 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) | 64 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) |
61 #undef DECLARE_OPERAND_TYPE | 65 #undef DECLARE_OPERAND_TYPE |
62 #define COUNT_OPERAND_TYPES(x) +1 | 66 #define COUNT_OPERAND_TYPES(x) +1 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 }; | 152 }; |
149 | 153 |
150 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 154 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
151 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 155 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
152 | 156 |
153 } // namespace interpreter | 157 } // namespace interpreter |
154 } // namespace internal | 158 } // namespace internal |
155 } // namespace v8 | 159 } // namespace v8 |
156 | 160 |
157 #endif // V8_INTERPRETER_BYTECODES_H_ | 161 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |