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 30 matching lines...) Expand all Loading... |
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 /* Globals */ \ | 46 /* Globals */ \ |
47 V(LdaGlobal, OperandType::kIdx8) \ | 47 V(LdaGlobal, OperandType::kIdx8) \ |
48 V(StaGlobal, OperandType::kIdx8) \ | 48 V(StaGlobal, OperandType::kIdx8) \ |
49 \ | 49 \ |
50 /* Context operations */ \ | 50 /* Context operations */ \ |
| 51 V(PushContext, OperandType::kReg8) \ |
| 52 V(PopContext, OperandType::kReg8) \ |
51 V(LdaContextSlot, OperandType::kReg8, OperandType::kIdx8) \ | 53 V(LdaContextSlot, OperandType::kReg8, OperandType::kIdx8) \ |
| 54 V(StaContextSlot, OperandType::kReg8, OperandType::kIdx8) \ |
52 \ | 55 \ |
53 /* Register-accumulator transfers */ \ | 56 /* Register-accumulator transfers */ \ |
54 V(Ldar, OperandType::kReg8) \ | 57 V(Ldar, OperandType::kReg8) \ |
55 V(Star, OperandType::kReg8) \ | 58 V(Star, OperandType::kReg8) \ |
56 \ | 59 \ |
57 /* LoadIC operations */ \ | 60 /* LoadIC operations */ \ |
58 V(LoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ | 61 V(LoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ |
59 V(LoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ | 62 V(LoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ |
60 V(KeyedLoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ | 63 V(KeyedLoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ |
61 V(KeyedLoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ | 64 V(KeyedLoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ |
62 \ | 65 \ |
63 /* StoreIC operations */ \ | 66 /* StoreIC operations */ \ |
64 V(StoreICSloppy, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ | 67 V(StoreICSloppy, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ |
65 V(StoreICStrict, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ | 68 V(StoreICStrict, OperandType::kReg8, OperandType::kReg8, OperandType::kIdx8) \ |
66 V(KeyedStoreICSloppy, OperandType::kReg8, OperandType::kReg8, \ | 69 V(KeyedStoreICSloppy, OperandType::kReg8, OperandType::kReg8, \ |
67 OperandType::kIdx8) \ | 70 OperandType::kIdx8) \ |
68 V(KeyedStoreICStrict, OperandType::kReg8, OperandType::kReg8, \ | 71 V(KeyedStoreICStrict, OperandType::kReg8, OperandType::kReg8, \ |
69 OperandType::kIdx8) \ | 72 OperandType::kIdx8) \ |
70 \ | 73 \ |
71 /* Context operations */ \ | |
72 V(PushContext, OperandType::kReg8) \ | |
73 V(PopContext, OperandType::kReg8) \ | |
74 \ | |
75 /* Binary Operators */ \ | 74 /* Binary Operators */ \ |
76 V(Add, OperandType::kReg8) \ | 75 V(Add, OperandType::kReg8) \ |
77 V(Sub, OperandType::kReg8) \ | 76 V(Sub, OperandType::kReg8) \ |
78 V(Mul, OperandType::kReg8) \ | 77 V(Mul, OperandType::kReg8) \ |
79 V(Div, OperandType::kReg8) \ | 78 V(Div, OperandType::kReg8) \ |
80 V(Mod, OperandType::kReg8) \ | 79 V(Mod, OperandType::kReg8) \ |
81 V(BitwiseOr, OperandType::kReg8) \ | 80 V(BitwiseOr, OperandType::kReg8) \ |
82 V(BitwiseXor, OperandType::kReg8) \ | 81 V(BitwiseXor, OperandType::kReg8) \ |
83 V(BitwiseAnd, OperandType::kReg8) \ | 82 V(BitwiseAnd, OperandType::kReg8) \ |
84 V(ShiftLeft, OperandType::kReg8) \ | 83 V(ShiftLeft, OperandType::kReg8) \ |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool is_function_context() const; | 198 bool is_function_context() const; |
200 | 199 |
201 static Register FromOperand(uint8_t operand); | 200 static Register FromOperand(uint8_t operand); |
202 uint8_t ToOperand() const; | 201 uint8_t ToOperand() const; |
203 | 202 |
204 static bool AreContiguous(Register reg1, Register reg2, | 203 static bool AreContiguous(Register reg1, Register reg2, |
205 Register reg3 = Register(), | 204 Register reg3 = Register(), |
206 Register reg4 = Register(), | 205 Register reg4 = Register(), |
207 Register reg5 = Register()); | 206 Register reg5 = Register()); |
208 | 207 |
| 208 bool operator==(const Register& o) const { return o.index() == index(); } |
| 209 bool operator!=(const Register& o) const { return o.index() != index(); } |
| 210 |
209 private: | 211 private: |
210 static const int kIllegalIndex = kMaxInt; | 212 static const int kIllegalIndex = kMaxInt; |
211 | 213 |
212 void* operator new(size_t size); | 214 void* operator new(size_t size); |
213 void operator delete(void* p); | 215 void operator delete(void* p); |
214 | 216 |
215 int index_; | 217 int index_; |
216 }; | 218 }; |
217 | 219 |
218 | 220 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 278 |
277 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 279 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
278 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 280 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
279 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | 281 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); |
280 | 282 |
281 } // namespace interpreter | 283 } // namespace interpreter |
282 } // namespace internal | 284 } // namespace internal |
283 } // namespace v8 | 285 } // namespace v8 |
284 | 286 |
285 #endif // V8_INTERPRETER_BYTECODES_H_ | 287 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |