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 25 matching lines...) Expand all Loading... |
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 /* Globals */ \ |
47 V(LdaGlobal, OperandType::kIdx8) \ | 47 V(LdaGlobal, OperandType::kIdx8) \ |
| 48 V(StaGlobal, OperandType::kIdx8) \ |
| 49 \ |
| 50 /* Context operations */ \ |
| 51 V(LdaContextSlot, OperandType::kReg8, OperandType::kIdx8) \ |
48 \ | 52 \ |
49 /* Register-accumulator transfers */ \ | 53 /* Register-accumulator transfers */ \ |
50 V(Ldar, OperandType::kReg8) \ | 54 V(Ldar, OperandType::kReg8) \ |
51 V(Star, OperandType::kReg8) \ | 55 V(Star, OperandType::kReg8) \ |
52 \ | 56 \ |
53 /* LoadIC operations */ \ | 57 /* LoadIC operations */ \ |
54 V(LoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ | 58 V(LoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ |
55 V(LoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ | 59 V(LoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ |
56 V(KeyedLoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ | 60 V(KeyedLoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ |
57 V(KeyedLoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ | 61 V(KeyedLoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 int index() const { | 160 int index() const { |
157 DCHECK(index_ != kIllegalIndex); | 161 DCHECK(index_ != kIllegalIndex); |
158 return index_; | 162 return index_; |
159 } | 163 } |
160 bool is_parameter() const { return index() < 0; } | 164 bool is_parameter() const { return index() < 0; } |
161 | 165 |
162 static Register FromParameterIndex(int index, int parameter_count); | 166 static Register FromParameterIndex(int index, int parameter_count); |
163 int ToParameterIndex(int parameter_count) const; | 167 int ToParameterIndex(int parameter_count) const; |
164 static int MaxParameterIndex(); | 168 static int MaxParameterIndex(); |
165 | 169 |
| 170 // Returns the register for the function's outer context. |
| 171 static Register function_context(); |
| 172 bool is_function_context() const; |
| 173 |
166 static Register FromOperand(uint8_t operand); | 174 static Register FromOperand(uint8_t operand); |
167 uint8_t ToOperand() const; | 175 uint8_t ToOperand() const; |
168 | 176 |
169 private: | 177 private: |
170 static const int kIllegalIndex = kMaxInt; | 178 static const int kIllegalIndex = kMaxInt; |
171 | 179 |
172 void* operator new(size_t size); | 180 void* operator new(size_t size); |
173 void operator delete(void* p); | 181 void operator delete(void* p); |
174 | 182 |
175 int index_; | 183 int index_; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 244 |
237 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 245 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
238 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 246 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
239 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | 247 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); |
240 | 248 |
241 } // namespace interpreter | 249 } // namespace interpreter |
242 } // namespace internal | 250 } // namespace internal |
243 } // namespace v8 | 251 } // namespace v8 |
244 | 252 |
245 #endif // V8_INTERPRETER_BYTECODES_H_ | 253 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |