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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 // Returns true if |bytecode| has no effects. | 511 // Returns true if |bytecode| has no effects. |
512 static bool IsWithoutExternalSideEffects(Bytecode bytecode); | 512 static bool IsWithoutExternalSideEffects(Bytecode bytecode); |
513 | 513 |
514 // Returns the i-th operand of |bytecode|. | 514 // Returns the i-th operand of |bytecode|. |
515 static OperandType GetOperandType(Bytecode bytecode, int i); | 515 static OperandType GetOperandType(Bytecode bytecode, int i); |
516 | 516 |
517 // Returns a pointer to an array of operand types terminated in | 517 // Returns a pointer to an array of operand types terminated in |
518 // OperandType::kNone. | 518 // OperandType::kNone. |
519 static const OperandType* GetOperandTypes(Bytecode bytecode); | 519 static const OperandType* GetOperandTypes(Bytecode bytecode); |
520 | 520 |
| 521 // Returns a pointer to an array of operand type info terminated in |
| 522 // OperandTypeInfo::kNone. |
| 523 static const OperandTypeInfo* GetOperandTypeInfos(Bytecode bytecode); |
| 524 |
521 // Returns the size of the i-th operand of |bytecode|. | 525 // Returns the size of the i-th operand of |bytecode|. |
522 static OperandSize GetOperandSize(Bytecode bytecode, int i, | 526 static OperandSize GetOperandSize(Bytecode bytecode, int i, |
523 OperandScale operand_scale); | 527 OperandScale operand_scale); |
524 | 528 |
525 // Returns a pointer to an array of the operand sizes for |bytecode|. | 529 // Returns a pointer to an array of the operand sizes for |bytecode|. |
526 static const OperandSize* GetOperandSizes(Bytecode bytecode, | 530 static const OperandSize* GetOperandSizes(Bytecode bytecode, |
527 OperandScale operand_scale); | 531 OperandScale operand_scale); |
528 | 532 |
529 // Returns the offset of the i-th operand of |bytecode| relative to the start | 533 // Returns the offset of the i-th operand of |bytecode| relative to the start |
530 // of the bytecode. | 534 // of the bytecode. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 // Returns true if a handler is generated for a bytecode at a given | 649 // Returns true if a handler is generated for a bytecode at a given |
646 // operand scale. All bytecodes have handlers at OperandScale::kSingle, | 650 // operand scale. All bytecodes have handlers at OperandScale::kSingle, |
647 // but only bytecodes with scalable operands have handlers with larger | 651 // but only bytecodes with scalable operands have handlers with larger |
648 // OperandScale values. | 652 // OperandScale values. |
649 static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale); | 653 static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale); |
650 | 654 |
651 // Return the operand size required to hold a signed operand. | 655 // Return the operand size required to hold a signed operand. |
652 static OperandSize SizeForSignedOperand(int value); | 656 static OperandSize SizeForSignedOperand(int value); |
653 | 657 |
654 // Return the operand size required to hold an unsigned operand. | 658 // Return the operand size required to hold an unsigned operand. |
655 static OperandSize SizeForUnsignedOperand(int value); | 659 static OperandSize SizeForUnsignedOperand(uint32_t value); |
656 | |
657 // Return the operand size required to hold an unsigned operand. | |
658 static OperandSize SizeForUnsignedOperand(size_t value); | |
659 | |
660 // Return the OperandScale required for bytecode emission of | |
661 // operand sizes. | |
662 static OperandScale OperandSizesToScale(OperandSize size0); | |
663 static OperandScale OperandSizesToScale(OperandSize size0, OperandSize size1); | |
664 static OperandScale OperandSizesToScale( | |
665 OperandSize size0, OperandSize size1, OperandSize size2, | |
666 OperandSize size3 = OperandSize::kByte); | |
667 | 660 |
668 private: | 661 private: |
669 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 662 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
670 }; | 663 }; |
671 | 664 |
672 class CreateObjectLiteralFlags { | 665 class CreateObjectLiteralFlags { |
673 public: | 666 public: |
674 class FlagsBits : public BitField8<int, 0, 3> {}; | 667 class FlagsBits : public BitField8<int, 0, 3> {}; |
675 class FastClonePropertiesCountBits | 668 class FastClonePropertiesCountBits |
676 : public BitField8<int, FlagsBits::kNext, 3> {}; | 669 : public BitField8<int, FlagsBits::kNext, 3> {}; |
677 STATIC_ASSERT((FlagsBits::kMask & FastClonePropertiesCountBits::kMask) == 0); | 670 STATIC_ASSERT((FlagsBits::kMask & FastClonePropertiesCountBits::kMask) == 0); |
678 }; | 671 }; |
679 | 672 |
680 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 673 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
681 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); | 674 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); |
682 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); | 675 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); |
683 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); | 676 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); |
684 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 677 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
685 | 678 |
686 } // namespace interpreter | 679 } // namespace interpreter |
687 } // namespace internal | 680 } // namespace internal |
688 } // namespace v8 | 681 } // namespace v8 |
689 | 682 |
690 #endif // V8_INTERPRETER_BYTECODES_H_ | 683 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |