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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 void* operator new(size_t size); | 432 void* operator new(size_t size); |
433 void operator delete(void* p); | 433 void operator delete(void* p); |
434 | 434 |
435 int index_; | 435 int index_; |
436 }; | 436 }; |
437 | 437 |
438 | 438 |
439 class Bytecodes { | 439 class Bytecodes { |
440 public: | 440 public: |
| 441 // The maximum number of operands a bytecode may have. |
| 442 static const int kMaxOperands = 4; |
| 443 |
441 // Returns string representation of |bytecode|. | 444 // Returns string representation of |bytecode|. |
442 static const char* ToString(Bytecode bytecode); | 445 static const char* ToString(Bytecode bytecode); |
443 | 446 |
444 // Returns string representation of |bytecode|. | 447 // Returns string representation of |bytecode|. |
445 static std::string ToString(Bytecode bytecode, OperandScale operand_scale); | 448 static std::string ToString(Bytecode bytecode, OperandScale operand_scale); |
446 | 449 |
447 // Returns string representation of |accumulator_use|. | 450 // Returns string representation of |accumulator_use|. |
448 static const char* AccumulatorUseToString(AccumulatorUse accumulator_use); | 451 static const char* AccumulatorUseToString(AccumulatorUse accumulator_use); |
449 | 452 |
450 // Returns string representation of |operand_type|. | 453 // Returns string representation of |operand_type|. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 static const OperandType* GetOperandTypes(Bytecode bytecode); | 521 static const OperandType* GetOperandTypes(Bytecode bytecode); |
519 | 522 |
520 // Returns a pointer to an array of operand type info terminated in | 523 // Returns a pointer to an array of operand type info terminated in |
521 // OperandTypeInfo::kNone. | 524 // OperandTypeInfo::kNone. |
522 static const OperandTypeInfo* GetOperandTypeInfos(Bytecode bytecode); | 525 static const OperandTypeInfo* GetOperandTypeInfos(Bytecode bytecode); |
523 | 526 |
524 // Returns the size of the i-th operand of |bytecode|. | 527 // Returns the size of the i-th operand of |bytecode|. |
525 static OperandSize GetOperandSize(Bytecode bytecode, int i, | 528 static OperandSize GetOperandSize(Bytecode bytecode, int i, |
526 OperandScale operand_scale); | 529 OperandScale operand_scale); |
527 | 530 |
528 // Returns a pointer to an array of the operand sizes for |bytecode|. | |
529 static const OperandSize* GetOperandSizes(Bytecode bytecode, | |
530 OperandScale operand_scale); | |
531 | |
532 // Returns the offset of the i-th operand of |bytecode| relative to the start | 531 // Returns the offset of the i-th operand of |bytecode| relative to the start |
533 // of the bytecode. | 532 // of the bytecode. |
534 static int GetOperandOffset(Bytecode bytecode, int i, | 533 static int GetOperandOffset(Bytecode bytecode, int i, |
535 OperandScale operand_scale); | 534 OperandScale operand_scale); |
536 | 535 |
537 // Returns a zero-based bitmap of the register operand positions of | |
538 // |bytecode|. | |
539 static int GetRegisterOperandBitmap(Bytecode bytecode); | |
540 | |
541 // Returns a debug break bytecode to replace |bytecode|. | 536 // Returns a debug break bytecode to replace |bytecode|. |
542 static Bytecode GetDebugBreak(Bytecode bytecode); | 537 static Bytecode GetDebugBreak(Bytecode bytecode); |
543 | 538 |
544 // Returns the size of the bytecode including its operands for the | 539 // Returns the size of the bytecode including its operands for the |
545 // given |operand_scale|. | 540 // given |operand_scale|. |
546 static int Size(Bytecode bytecode, OperandScale operand_scale); | 541 static int Size(Bytecode bytecode, OperandScale operand_scale); |
547 | 542 |
548 // Returns the size of |operand|. | 543 // Returns the size of |operand|. |
549 static OperandSize SizeOfOperand(OperandType operand, OperandScale scale); | 544 static OperandSize SizeOfOperand(OperandType operand, OperandScale scale); |
550 | 545 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); | 668 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); |
674 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); | 669 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); |
675 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); | 670 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); |
676 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 671 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
677 | 672 |
678 } // namespace interpreter | 673 } // namespace interpreter |
679 } // namespace internal | 674 } // namespace internal |
680 } // namespace v8 | 675 } // namespace v8 |
681 | 676 |
682 #endif // V8_INTERPRETER_BYTECODES_H_ | 677 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |