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. |
(...skipping 13 matching lines...) Expand all Loading... | |
24 /* Byte operands. */ \ | 24 /* Byte operands. */ \ |
25 V(Count8, OperandSize::kByte) \ | 25 V(Count8, OperandSize::kByte) \ |
26 V(Imm8, OperandSize::kByte) \ | 26 V(Imm8, OperandSize::kByte) \ |
27 V(Idx8, OperandSize::kByte) \ | 27 V(Idx8, OperandSize::kByte) \ |
28 V(Reg8, OperandSize::kByte) \ | 28 V(Reg8, OperandSize::kByte) \ |
29 \ | 29 \ |
30 /* Short operands. */ \ | 30 /* Short operands. */ \ |
31 V(Idx16, OperandSize::kShort) | 31 V(Idx16, OperandSize::kShort) |
32 | 32 |
33 // The list of bytecodes which are interpreted by the interpreter. | 33 // The list of bytecodes which are interpreted by the interpreter. |
34 #define BYTECODE_LIST(V) \ | 34 #define BYTECODE_LIST(V) \ |
35 \ | 35 \ |
36 /* Loading the accumulator */ \ | 36 /* Loading the accumulator */ \ |
37 V(LdaZero, OperandType::kNone) \ | 37 V(LdaZero, OperandType::kNone) \ |
38 V(LdaSmi8, OperandType::kImm8) \ | 38 V(LdaSmi8, OperandType::kImm8) \ |
39 V(LdaConstant, OperandType::kIdx8) \ | 39 V(LdaConstant, OperandType::kIdx8) \ |
40 V(LdaUndefined, OperandType::kNone) \ | 40 V(LdaUndefined, OperandType::kNone) \ |
41 V(LdaNull, OperandType::kNone) \ | 41 V(LdaNull, OperandType::kNone) \ |
42 V(LdaTheHole, OperandType::kNone) \ | 42 V(LdaTheHole, OperandType::kNone) \ |
43 V(LdaTrue, OperandType::kNone) \ | 43 V(LdaTrue, OperandType::kNone) \ |
44 V(LdaFalse, OperandType::kNone) \ | 44 V(LdaFalse, OperandType::kNone) \ |
45 \ | 45 \ |
46 /* Load globals */ \ | 46 /* Load globals */ \ |
47 V(LdaGlobal, OperandType::kIdx8) \ | 47 V(LdaGlobal, OperandType::kIdx8) \ |
48 \ | 48 \ |
49 /* Reg8ister-accumulator transfers */ \ | 49 /* Reg8ister-accumulator transfers */ \ |
50 V(Ldar, OperandType::kReg8) \ | 50 V(Ldar, OperandType::kReg8) \ |
51 V(Star, OperandType::kReg8) \ | 51 V(Star, OperandType::kReg8) \ |
52 \ | 52 \ |
53 /* LoadIC operations */ \ | 53 /* LoadIC operations */ \ |
54 V(LoadIC, OperandType::kReg8, OperandType::kIdx8) \ | 54 V(KeyedLoadIC, OperandType::kReg8, OperandType::kIdx8) \ |
Michael Starzinger
2015/10/05 12:04:45
nit: Weird ordering is that on purpose?
rmcilroy
2015/10/06 13:56:34
Opps, mistake - fixed
| |
55 V(KeyedLoadIC, OperandType::kReg8, OperandType::kIdx8) \ | 55 V(LoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ |
56 \ | 56 V(LoadIC, OperandType::kReg8, OperandType::kIdx8) \ |
Michael Starzinger
2015/10/05 12:04:45
suggestion: What would you think about s/LoadIC/Lo
rmcilroy
2015/10/06 13:56:34
Yeah I was thinking about that - I think it makes
| |
57 /* StoreIC operations */ \ | 57 V(KeyedLoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ |
58 V(StoreIC, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ | 58 \ |
59 V(KeyedStoreIC, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ | 59 /* StoreIC operations */ \ |
60 \ | 60 V(StoreIC, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ |
61 /* Binary Operators */ \ | 61 V(StoreICStrict, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ |
62 V(Add, OperandType::kReg8) \ | 62 V(KeyedStoreIC, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ |
63 V(Sub, OperandType::kReg8) \ | 63 V(KeyedStoreICStrict, OperandType::kReg8, OperandType::kReg8, \ |
64 V(Mul, OperandType::kReg8) \ | 64 OperandType::kIdx8) \ |
65 V(Div, OperandType::kReg8) \ | 65 \ |
66 V(Mod, OperandType::kReg8) \ | 66 /* Binary Operators */ \ |
67 \ | 67 V(Add, OperandType::kReg8) \ |
68 /* Call operations. */ \ | 68 V(Sub, OperandType::kReg8) \ |
69 V(Call, OperandType::kReg8, OperandType::kReg8, OperandType::kCount8) \ | 69 V(Mul, OperandType::kReg8) \ |
70 \ | 70 V(Div, OperandType::kReg8) \ |
71 /* Test Operators */ \ | 71 V(Mod, OperandType::kReg8) \ |
72 V(TestEqual, OperandType::kReg8) \ | 72 \ |
73 V(TestNotEqual, OperandType::kReg8) \ | 73 /* Call operations. */ \ |
74 V(TestEqualStrict, OperandType::kReg8) \ | 74 V(Call, OperandType::kReg8, OperandType::kReg8, OperandType::kCount8) \ |
75 V(TestNotEqualStrict, OperandType::kReg8) \ | 75 \ |
76 V(TestLessThan, OperandType::kReg8) \ | 76 /* Test Operators */ \ |
77 V(TestGreaterThan, OperandType::kReg8) \ | 77 V(TestEqual, OperandType::kReg8) \ |
78 V(TestLessThanOrEqual, OperandType::kReg8) \ | 78 V(TestNotEqual, OperandType::kReg8) \ |
79 V(TestGreaterThanOrEqual, OperandType::kReg8) \ | 79 V(TestEqualStrict, OperandType::kReg8) \ |
80 V(TestInstanceOf, OperandType::kReg8) \ | 80 V(TestNotEqualStrict, OperandType::kReg8) \ |
81 V(TestIn, OperandType::kReg8) \ | 81 V(TestLessThan, OperandType::kReg8) \ |
82 \ | 82 V(TestGreaterThan, OperandType::kReg8) \ |
83 /* Cast operators */ \ | 83 V(TestLessThanOrEqual, OperandType::kReg8) \ |
84 V(ToBoolean, OperandType::kNone) \ | 84 V(TestGreaterThanOrEqual, OperandType::kReg8) \ |
85 \ | 85 V(TestInstanceOf, OperandType::kReg8) \ |
86 /* Control Flow */ \ | 86 V(TestIn, OperandType::kReg8) \ |
87 V(Jump, OperandType::kImm8) \ | 87 \ |
88 V(JumpConstant, OperandType::kIdx8) \ | 88 /* Cast operators */ \ |
89 V(JumpIfTrue, OperandType::kImm8) \ | 89 V(ToBoolean, OperandType::kNone) \ |
90 V(JumpIfTrueConstant, OperandType::kIdx8) \ | 90 \ |
91 V(JumpIfFalse, OperandType::kImm8) \ | 91 /* Control Flow */ \ |
92 V(JumpIfFalseConstant, OperandType::kIdx8) \ | 92 V(Jump, OperandType::kImm8) \ |
93 V(JumpConstant, OperandType::kIdx8) \ | |
94 V(JumpIfTrue, OperandType::kImm8) \ | |
95 V(JumpIfTrueConstant, OperandType::kIdx8) \ | |
96 V(JumpIfFalse, OperandType::kImm8) \ | |
97 V(JumpIfFalseConstant, OperandType::kIdx8) \ | |
93 V(Return, OperandType::kNone) | 98 V(Return, OperandType::kNone) |
94 | 99 |
95 | 100 |
96 // Enumeration of the size classes of operand types used by bytecodes. | 101 // Enumeration of the size classes of operand types used by bytecodes. |
97 enum class OperandSize : uint8_t { | 102 enum class OperandSize : uint8_t { |
98 kNone = 0, | 103 kNone = 0, |
99 kByte = 1, | 104 kByte = 1, |
100 kShort = 2, | 105 kShort = 2, |
101 }; | 106 }; |
102 | 107 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 229 |
225 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 230 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
226 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 231 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
227 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | 232 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); |
228 | 233 |
229 } // namespace interpreter | 234 } // namespace interpreter |
230 } // namespace internal | 235 } // namespace internal |
231 } // namespace v8 | 236 } // namespace v8 |
232 | 237 |
233 #endif // V8_INTERPRETER_BYTECODES_H_ | 238 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |