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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // Returns bytecode for |value|. | 84 // Returns bytecode for |value|. |
85 static Bytecode FromByte(uint8_t value); | 85 static Bytecode FromByte(uint8_t value); |
86 | 86 |
87 // Returns the number of operands expected by |bytecode|. | 87 // Returns the number of operands expected by |bytecode|. |
88 static int NumberOfOperands(Bytecode bytecode); | 88 static int NumberOfOperands(Bytecode bytecode); |
89 | 89 |
90 // Return the i-th operand of |bytecode|. | 90 // Return the i-th operand of |bytecode|. |
91 static OperandType GetOperandType(Bytecode bytecode, int i); | 91 static OperandType GetOperandType(Bytecode bytecode, int i); |
92 | 92 |
93 // Returns the size of the bytecode including its arguments. | 93 // Returns the size of the bytecode including its operands. |
94 static int Size(Bytecode bytecode); | 94 static int Size(Bytecode bytecode); |
95 | 95 |
96 // The maximum number of operands across all bytecodes. | 96 // The maximum number of operands across all bytecodes. |
97 static int MaximumNumberOfOperands(); | 97 static int MaximumNumberOfOperands(); |
98 | 98 |
99 // Maximum size of a bytecode and its arguments. | 99 // Maximum size of a bytecode and its operands. |
100 static int MaximumSize(); | 100 static int MaximumSize(); |
101 | 101 |
| 102 // Decode a single bytecode and operands to |os|. |
| 103 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start); |
| 104 |
102 private: | 105 private: |
103 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 106 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
104 }; | 107 }; |
105 | 108 |
106 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 109 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
107 | 110 |
108 } // namespace interpreter | 111 } // namespace interpreter |
109 } // namespace internal | 112 } // namespace internal |
110 } // namespace v8 | 113 } // namespace v8 |
111 | 114 |
112 #endif // V8_INTERPRETER_BYTECODES_H_ | 115 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |