| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 bool is_new_target() const; | 380 bool is_new_target() const; |
| 381 | 381 |
| 382 // Returns the register for the bytecode array. | 382 // Returns the register for the bytecode array. |
| 383 static Register bytecode_array(); | 383 static Register bytecode_array(); |
| 384 bool is_bytecode_array() const; | 384 bool is_bytecode_array() const; |
| 385 | 385 |
| 386 // Returns the register for the saved bytecode offset. | 386 // Returns the register for the saved bytecode offset. |
| 387 static Register bytecode_offset(); | 387 static Register bytecode_offset(); |
| 388 bool is_bytecode_offset() const; | 388 bool is_bytecode_offset() const; |
| 389 | 389 |
| 390 // Returns a register that can be used to represent the accumulator |
| 391 // within code in the interpreter, but should never be emitted in |
| 392 // bytecode. |
| 393 static Register virtual_accumulator(); |
| 394 |
| 390 OperandSize SizeOfOperand() const; | 395 OperandSize SizeOfOperand() const; |
| 391 | 396 |
| 392 int32_t ToOperand() const { return kRegisterFileStartOffset - index_; } | 397 int32_t ToOperand() const { return kRegisterFileStartOffset - index_; } |
| 393 static Register FromOperand(int32_t operand) { | 398 static Register FromOperand(int32_t operand) { |
| 394 return Register(kRegisterFileStartOffset - operand); | 399 return Register(kRegisterFileStartOffset - operand); |
| 395 } | 400 } |
| 396 | 401 |
| 397 static bool AreContiguous(Register reg1, Register reg2, | 402 static bool AreContiguous(Register reg1, Register reg2, |
| 398 Register reg3 = Register(), | 403 Register reg3 = Register(), |
| 399 Register reg4 = Register(), | 404 Register reg4 = Register(), |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 static OperandType GetOperandType(Bytecode bytecode, int i); | 503 static OperandType GetOperandType(Bytecode bytecode, int i); |
| 499 | 504 |
| 500 // Returns a pointer to an array of operand types terminated in | 505 // Returns a pointer to an array of operand types terminated in |
| 501 // OperandType::kNone. | 506 // OperandType::kNone. |
| 502 static const OperandType* GetOperandTypes(Bytecode bytecode); | 507 static const OperandType* GetOperandTypes(Bytecode bytecode); |
| 503 | 508 |
| 504 // Returns the size of the i-th operand of |bytecode|. | 509 // Returns the size of the i-th operand of |bytecode|. |
| 505 static OperandSize GetOperandSize(Bytecode bytecode, int i, | 510 static OperandSize GetOperandSize(Bytecode bytecode, int i, |
| 506 OperandScale operand_scale); | 511 OperandScale operand_scale); |
| 507 | 512 |
| 513 // Returns a pointer to an array of the operand sizes for |bytecode|. |
| 514 static const OperandSize* GetOperandSizes(Bytecode bytecode, |
| 515 OperandScale operand_scale); |
| 516 |
| 508 // Returns the offset of the i-th operand of |bytecode| relative to the start | 517 // Returns the offset of the i-th operand of |bytecode| relative to the start |
| 509 // of the bytecode. | 518 // of the bytecode. |
| 510 static int GetOperandOffset(Bytecode bytecode, int i, | 519 static int GetOperandOffset(Bytecode bytecode, int i, |
| 511 OperandScale operand_scale); | 520 OperandScale operand_scale); |
| 512 | 521 |
| 513 // Returns a zero-based bitmap of the register operand positions of | 522 // Returns a zero-based bitmap of the register operand positions of |
| 514 // |bytecode|. | 523 // |bytecode|. |
| 515 static int GetRegisterOperandBitmap(Bytecode bytecode); | 524 static int GetRegisterOperandBitmap(Bytecode bytecode); |
| 516 | 525 |
| 517 // Returns a debug break bytecode to replace |bytecode|. | 526 // Returns a debug break bytecode to replace |bytecode|. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 static OperandSize SizeForSignedOperand(int value); | 644 static OperandSize SizeForSignedOperand(int value); |
| 636 | 645 |
| 637 // Return the operand size required to hold an unsigned operand. | 646 // Return the operand size required to hold an unsigned operand. |
| 638 static OperandSize SizeForUnsignedOperand(int value); | 647 static OperandSize SizeForUnsignedOperand(int value); |
| 639 | 648 |
| 640 // Return the operand size required to hold an unsigned operand. | 649 // Return the operand size required to hold an unsigned operand. |
| 641 static OperandSize SizeForUnsignedOperand(size_t value); | 650 static OperandSize SizeForUnsignedOperand(size_t value); |
| 642 | 651 |
| 643 // Return the OperandScale required for bytecode emission of | 652 // Return the OperandScale required for bytecode emission of |
| 644 // operand sizes. | 653 // operand sizes. |
| 654 static OperandScale OperandSizesToScale(OperandSize size0); |
| 655 static OperandScale OperandSizesToScale(OperandSize size0, OperandSize size1); |
| 645 static OperandScale OperandSizesToScale( | 656 static OperandScale OperandSizesToScale( |
| 646 OperandSize size0, OperandSize size1 = OperandSize::kByte, | 657 OperandSize size0, OperandSize size1, OperandSize size2, |
| 647 OperandSize size2 = OperandSize::kByte, | |
| 648 OperandSize size3 = OperandSize::kByte); | 658 OperandSize size3 = OperandSize::kByte); |
| 649 | 659 |
| 650 private: | 660 private: |
| 651 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 661 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
| 652 }; | 662 }; |
| 653 | 663 |
| 654 class CreateObjectLiteralFlags { | 664 class CreateObjectLiteralFlags { |
| 655 public: | 665 public: |
| 656 class FlagsBits : public BitField8<int, 0, 3> {}; | 666 class FlagsBits : public BitField8<int, 0, 3> {}; |
| 657 class FastClonePropertiesCountBits | 667 class FastClonePropertiesCountBits |
| 658 : public BitField8<int, FlagsBits::kNext, 3> {}; | 668 : public BitField8<int, FlagsBits::kNext, 3> {}; |
| 659 STATIC_ASSERT((FlagsBits::kMask & FastClonePropertiesCountBits::kMask) == 0); | 669 STATIC_ASSERT((FlagsBits::kMask & FastClonePropertiesCountBits::kMask) == 0); |
| 660 }; | 670 }; |
| 661 | 671 |
| 662 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 672 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
| 663 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); | 673 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); |
| 664 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); | 674 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); |
| 665 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); | 675 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); |
| 666 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 676 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
| 667 | 677 |
| 668 } // namespace interpreter | 678 } // namespace interpreter |
| 669 } // namespace internal | 679 } // namespace internal |
| 670 } // namespace v8 | 680 } // namespace v8 |
| 671 | 681 |
| 672 #endif // V8_INTERPRETER_BYTECODES_H_ | 682 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |