Chromium Code Reviews| 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(Imm8) \ | 21 V(Imm8) \ |
| 22 V(Reg) | 22 V(Reg) |
| 23 | 23 |
| 24 // The list of bytecodes which are interpreted by the interpreter. | 24 // The list of bytecodes which are interpreted by the interpreter. |
| 25 #define BYTECODE_LIST(V) \ | 25 #define BYTECODE_LIST(V) \ |
| 26 V(LoadLiteral0, OperandType::kReg) \ | 26 V(LoadLiteral0, OperandType::kNone) \ |
| 27 V(LoadSmi8, OperandType::kReg, OperandType::kImm8) \ | 27 V(LoadSmi8, OperandType::kImm8) \ |
|
rmcilroy
2015/07/30 10:12:25
nit - can we update the bytecodes above to be in t
oth
2015/07/30 15:38:42
Done.
oth
2015/07/30 15:38:43
The pattern has been to add instructions as needed
| |
| 28 V(LdaUndefined, OperandType::kNone) \ | |
| 29 V(LdaNull, OperandType::kNone) \ | |
| 30 V(LdaTheHole, OperandType::kNone) \ | |
| 31 V(LdaTrue, OperandType::kNone) \ | |
| 32 V(LdaFalse, OperandType::kNone) \ | |
| 33 V(Ldar, OperandType::kReg) \ | |
| 34 V(Stra, OperandType::kReg) \ | |
| 35 V(Add, OperandType::kReg) \ | |
| 36 V(Sub, OperandType::kReg) \ | |
| 37 V(Mul, OperandType::kReg) \ | |
| 38 V(Div, OperandType::kReg) \ | |
| 28 V(Return, OperandType::kNone) | 39 V(Return, OperandType::kNone) |
| 29 | 40 |
| 30 | 41 |
| 31 // Enumeration of operand types used by bytecodes. | 42 // Enumeration of operand types used by bytecodes. |
| 32 enum class OperandType : uint8_t { | 43 enum class OperandType : uint8_t { |
| 33 #define DECLARE_OPERAND_TYPE(Name) k##Name, | 44 #define DECLARE_OPERAND_TYPE(Name) k##Name, |
| 34 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) | 45 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) |
| 35 #undef DECLARE_OPERAND_TYPE | 46 #undef DECLARE_OPERAND_TYPE |
| 36 #define COUNT_OPERAND_TYPES(x) +1 | 47 #define COUNT_OPERAND_TYPES(x) +1 |
| 37 // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will | 48 // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 95 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
| 85 }; | 96 }; |
| 86 | 97 |
| 87 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 98 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
| 88 | 99 |
| 89 } // namespace interpreter | 100 } // namespace interpreter |
| 90 } // namespace internal | 101 } // namespace internal |
| 91 } // namespace v8 | 102 } // namespace v8 |
| 92 | 103 |
| 93 #endif // V8_INTERPRETER_BYTECODES_H_ | 104 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |