| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 V(TestNotEqualStrict, OperandType::kReg8) \ | 103 V(TestNotEqualStrict, OperandType::kReg8) \ |
| 104 V(TestLessThan, OperandType::kReg8) \ | 104 V(TestLessThan, OperandType::kReg8) \ |
| 105 V(TestGreaterThan, OperandType::kReg8) \ | 105 V(TestGreaterThan, OperandType::kReg8) \ |
| 106 V(TestLessThanOrEqual, OperandType::kReg8) \ | 106 V(TestLessThanOrEqual, OperandType::kReg8) \ |
| 107 V(TestGreaterThanOrEqual, OperandType::kReg8) \ | 107 V(TestGreaterThanOrEqual, OperandType::kReg8) \ |
| 108 V(TestInstanceOf, OperandType::kReg8) \ | 108 V(TestInstanceOf, OperandType::kReg8) \ |
| 109 V(TestIn, OperandType::kReg8) \ | 109 V(TestIn, OperandType::kReg8) \ |
| 110 \ | 110 \ |
| 111 /* Cast operators */ \ | 111 /* Cast operators */ \ |
| 112 V(ToBoolean, OperandType::kNone) \ | 112 V(ToBoolean, OperandType::kNone) \ |
| 113 V(ToName, OperandType::kNone) \ |
| 113 \ | 114 \ |
| 114 /* Literals */ \ | 115 /* Literals */ \ |
| 115 V(CreateArrayLiteral, OperandType::kIdx8, OperandType::kImm8) \ | 116 V(CreateArrayLiteral, OperandType::kIdx8, OperandType::kImm8) \ |
| 117 V(CreateObjectLiteral, OperandType::kIdx8, OperandType::kImm8) \ |
| 116 \ | 118 \ |
| 117 /* Closure allocation */ \ | 119 /* Closure allocation */ \ |
| 118 V(CreateClosure, OperandType::kImm8) \ | 120 V(CreateClosure, OperandType::kImm8) \ |
| 119 \ | 121 \ |
| 120 /* Control Flow */ \ | 122 /* Control Flow */ \ |
| 121 V(Jump, OperandType::kImm8) \ | 123 V(Jump, OperandType::kImm8) \ |
| 122 V(JumpConstant, OperandType::kIdx8) \ | 124 V(JumpConstant, OperandType::kIdx8) \ |
| 123 V(JumpIfTrue, OperandType::kImm8) \ | 125 V(JumpIfTrue, OperandType::kImm8) \ |
| 124 V(JumpIfTrueConstant, OperandType::kIdx8) \ | 126 V(JumpIfTrueConstant, OperandType::kIdx8) \ |
| 125 V(JumpIfFalse, OperandType::kImm8) \ | 127 V(JumpIfFalse, OperandType::kImm8) \ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 explicit Register(int index) : index_(index) { | 175 explicit Register(int index) : index_(index) { |
| 174 DCHECK_LE(index_, kMaxRegisterIndex); | 176 DCHECK_LE(index_, kMaxRegisterIndex); |
| 175 DCHECK_GE(index_, kMinRegisterIndex); | 177 DCHECK_GE(index_, kMinRegisterIndex); |
| 176 } | 178 } |
| 177 | 179 |
| 178 int index() const { | 180 int index() const { |
| 179 DCHECK(index_ != kIllegalIndex); | 181 DCHECK(index_ != kIllegalIndex); |
| 180 return index_; | 182 return index_; |
| 181 } | 183 } |
| 182 bool is_parameter() const { return index() < 0; } | 184 bool is_parameter() const { return index() < 0; } |
| 185 bool is_valid() const { return index_ != kIllegalIndex; } |
| 183 | 186 |
| 184 static Register FromParameterIndex(int index, int parameter_count); | 187 static Register FromParameterIndex(int index, int parameter_count); |
| 185 int ToParameterIndex(int parameter_count) const; | 188 int ToParameterIndex(int parameter_count) const; |
| 186 static int MaxParameterIndex(); | 189 static int MaxParameterIndex(); |
| 187 | 190 |
| 188 // Returns the register for the function's closure object. | 191 // Returns the register for the function's closure object. |
| 189 static Register function_closure(); | 192 static Register function_closure(); |
| 190 bool is_function_closure() const; | 193 bool is_function_closure() const; |
| 191 | 194 |
| 192 // Returns the register for the function's outer context. | 195 // Returns the register for the function's outer context. |
| 193 static Register function_context(); | 196 static Register function_context(); |
| 194 bool is_function_context() const; | 197 bool is_function_context() const; |
| 195 | 198 |
| 196 static Register FromOperand(uint8_t operand); | 199 static Register FromOperand(uint8_t operand); |
| 197 uint8_t ToOperand() const; | 200 uint8_t ToOperand() const; |
| 198 | 201 |
| 202 static bool AreContiguous(Register reg1, Register reg2, |
| 203 Register reg3 = Register(), |
| 204 Register reg4 = Register(), |
| 205 Register reg5 = Register()); |
| 206 |
| 199 private: | 207 private: |
| 200 static const int kIllegalIndex = kMaxInt; | 208 static const int kIllegalIndex = kMaxInt; |
| 201 | 209 |
| 202 void* operator new(size_t size); | 210 void* operator new(size_t size); |
| 203 void operator delete(void* p); | 211 void operator delete(void* p); |
| 204 | 212 |
| 205 int index_; | 213 int index_; |
| 206 }; | 214 }; |
| 207 | 215 |
| 208 | 216 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 274 |
| 267 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 275 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
| 268 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 276 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
| 269 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | 277 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); |
| 270 | 278 |
| 271 } // namespace interpreter | 279 } // namespace interpreter |
| 272 } // namespace internal | 280 } // namespace internal |
| 273 } // namespace v8 | 281 } // namespace v8 |
| 274 | 282 |
| 275 #endif // V8_INTERPRETER_BYTECODES_H_ | 283 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |