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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 bool is_valid() const { return index_ != kInvalidIndex; } | 311 bool is_valid() const { return index_ != kInvalidIndex; } |
312 bool is_byte_operand() const; | 312 bool is_byte_operand() const; |
313 bool is_short_operand() const; | 313 bool is_short_operand() const; |
314 | 314 |
315 static Register FromParameterIndex(int index, int parameter_count); | 315 static Register FromParameterIndex(int index, int parameter_count); |
316 int ToParameterIndex(int parameter_count) const; | 316 int ToParameterIndex(int parameter_count) const; |
317 static int MaxParameterIndex(); | 317 static int MaxParameterIndex(); |
318 static int MaxRegisterIndex(); | 318 static int MaxRegisterIndex(); |
319 static int MaxRegisterIndexForByteOperand(); | 319 static int MaxRegisterIndexForByteOperand(); |
320 | 320 |
| 321 // Returns an invalid register. |
| 322 static Register invalid_value() { return Register(); } |
| 323 |
321 // Returns the register for the function's closure object. | 324 // Returns the register for the function's closure object. |
322 static Register function_closure(); | 325 static Register function_closure(); |
323 bool is_function_closure() const; | 326 bool is_function_closure() const; |
324 | 327 |
325 // Returns the register which holds the current context object. | 328 // Returns the register which holds the current context object. |
326 static Register current_context(); | 329 static Register current_context(); |
327 bool is_current_context() const; | 330 bool is_current_context() const; |
328 | 331 |
329 // Returns the register for the incoming new target value. | 332 // Returns the register for the incoming new target value. |
330 static Register new_target(); | 333 static Register new_target(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 // constant pool entry (OperandType::kIdx16). | 449 // constant pool entry (OperandType::kIdx16). |
447 static bool IsJumpConstantWide(Bytecode bytecode); | 450 static bool IsJumpConstantWide(Bytecode bytecode); |
448 | 451 |
449 // Returns true if the bytecode is a jump or conditional jump taking | 452 // Returns true if the bytecode is a jump or conditional jump taking |
450 // any kind of operand. | 453 // any kind of operand. |
451 static bool IsJump(Bytecode bytecode); | 454 static bool IsJump(Bytecode bytecode); |
452 | 455 |
453 // Returns true if the bytecode is a conditional jump, a jump, or a return. | 456 // Returns true if the bytecode is a conditional jump, a jump, or a return. |
454 static bool IsJumpOrReturn(Bytecode bytecode); | 457 static bool IsJumpOrReturn(Bytecode bytecode); |
455 | 458 |
| 459 // Returns true if |operand_type| is a maybe register operand |
| 460 // (kMaybeReg8/kMaybeReg16). |
| 461 static bool IsMaybeRegisterOperandType(OperandType operand_type); |
| 462 |
| 463 // Returns true if |operand_type| is a register count operand |
| 464 // (kRegCount8/kRegCount16). |
| 465 static bool IsRegisterCountOperandType(OperandType operand_type); |
| 466 |
456 // Returns true if |operand_type| is any type of register operand. | 467 // Returns true if |operand_type| is any type of register operand. |
457 static bool IsRegisterOperandType(OperandType operand_type); | 468 static bool IsRegisterOperandType(OperandType operand_type); |
458 | 469 |
459 // Returns true if |operand_type| represents a register used as an input. | 470 // Returns true if |operand_type| represents a register used as an input. |
460 static bool IsRegisterInputOperandType(OperandType operand_type); | 471 static bool IsRegisterInputOperandType(OperandType operand_type); |
461 | 472 |
462 // Returns true if |operand_type| represents a register used as an output. | 473 // Returns true if |operand_type| represents a register used as an output. |
463 static bool IsRegisterOutputOperandType(OperandType operand_type); | 474 static bool IsRegisterOutputOperandType(OperandType operand_type); |
464 | 475 |
465 // Decode a single bytecode and operands to |os|. | 476 // Decode a single bytecode and operands to |os|. |
466 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, | 477 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
467 int number_of_parameters); | 478 int number_of_parameters); |
468 | 479 |
469 private: | 480 private: |
470 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 481 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
471 }; | 482 }; |
472 | 483 |
473 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 484 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
474 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 485 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
475 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | 486 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); |
476 | 487 |
477 } // namespace interpreter | 488 } // namespace interpreter |
478 } // namespace internal | 489 } // namespace internal |
479 } // namespace v8 | 490 } // namespace v8 |
480 | 491 |
481 #endif // V8_INTERPRETER_BYTECODES_H_ | 492 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |