| 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_BYTECODE_PIPELINE_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_PIPELINE_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_PIPELINE_H_ | 6 #define V8_INTERPRETER_BYTECODE_PIPELINE_H_ |
| 7 | 7 |
| 8 #include "src/interpreter/bytecode-register-allocator.h" | 8 #include "src/interpreter/bytecode-register-allocator.h" |
| 9 #include "src/interpreter/bytecodes.h" | 9 #include "src/interpreter/bytecodes.h" |
| 10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 BytecodeNode(Bytecode bytecode, uint32_t operand0, | 81 BytecodeNode(Bytecode bytecode, uint32_t operand0, |
| 82 OperandScale operand_scale); | 82 OperandScale operand_scale); |
| 83 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, | 83 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
| 84 OperandScale operand_scale); | 84 OperandScale operand_scale); |
| 85 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, | 85 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
| 86 uint32_t operand2, OperandScale operand_scale); | 86 uint32_t operand2, OperandScale operand_scale); |
| 87 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, | 87 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
| 88 uint32_t operand2, uint32_t operand3, | 88 uint32_t operand2, uint32_t operand3, |
| 89 OperandScale operand_scale); | 89 OperandScale operand_scale); |
| 90 | 90 |
| 91 BytecodeNode(const BytecodeNode& other); |
| 92 BytecodeNode& operator=(const BytecodeNode& other); |
| 93 |
| 91 void set_bytecode(Bytecode bytecode); | 94 void set_bytecode(Bytecode bytecode); |
| 92 void set_bytecode(Bytecode bytecode, uint32_t operand0, | 95 void set_bytecode(Bytecode bytecode, uint32_t operand0, |
| 93 OperandScale operand_scale); | 96 OperandScale operand_scale); |
| 94 | 97 |
| 95 // Clone |other|. | 98 // Clone |other|. |
| 96 void Clone(const BytecodeNode* const other); | 99 void Clone(const BytecodeNode* const other); |
| 97 | 100 |
| 98 // Print to stream |os|. | 101 // Print to stream |os|. |
| 99 void Print(std::ostream& os) const; | 102 void Print(std::ostream& os) const; |
| 100 | 103 |
| 101 // Return the size when this node is serialized to a bytecode array. | 104 // Return the size when this node is serialized to a bytecode array. |
| 102 size_t Size() const; | 105 size_t Size() const; |
| 103 | 106 |
| 104 // Transform to a node representing |new_bytecode| which has one | 107 // Transform to a node representing |new_bytecode| which has one |
| 105 // operand more than the current bytecode. | 108 // operand more than the current bytecode. |
| 106 void Transform(Bytecode new_bytecode, uint32_t extra_operand, | 109 void Transform(Bytecode new_bytecode, uint32_t extra_operand, |
| 107 OperandScale extra_operand_scale); | 110 OperandScale extra_operand_scale); |
| 108 | 111 |
| 109 Bytecode bytecode() const { return bytecode_; } | 112 Bytecode bytecode() const { return bytecode_; } |
| 110 | 113 |
| 111 uint32_t operand(int i) const { | 114 uint32_t operand(int i) const { |
| 112 DCHECK_LT(i, operand_count()); | 115 DCHECK_LT(i, operand_count()); |
| 113 return operands_[i]; | 116 return operands_[i]; |
| 114 } | 117 } |
| 115 uint32_t* operands() { return operands_; } | 118 uint32_t* operands() { return operands_; } |
| 116 const uint32_t* operands() const { return operands_; } | 119 const uint32_t* operands() const { return operands_; } |
| 117 | 120 |
| 118 int operand_count() const { return Bytecodes::NumberOfOperands(bytecode_); } | 121 int operand_count() const { return Bytecodes::NumberOfOperands(bytecode_); } |
| 119 OperandScale operand_scale() const { return operand_scale_; } | 122 OperandScale operand_scale() const { return operand_scale_; } |
| 123 void set_operand_scale(OperandScale operand_scale) { |
| 124 operand_scale_ = operand_scale; |
| 125 } |
| 120 | 126 |
| 121 const BytecodeSourceInfo& source_info() const { return source_info_; } | 127 const BytecodeSourceInfo& source_info() const { return source_info_; } |
| 122 BytecodeSourceInfo& source_info() { return source_info_; } | 128 BytecodeSourceInfo& source_info() { return source_info_; } |
| 123 | 129 |
| 124 bool operator==(const BytecodeNode& other) const; | 130 bool operator==(const BytecodeNode& other) const; |
| 125 bool operator!=(const BytecodeNode& other) const { return !(*this == other); } | 131 bool operator!=(const BytecodeNode& other) const { return !(*this == other); } |
| 126 | 132 |
| 127 private: | 133 private: |
| 128 static const int kInvalidPosition = kMinInt; | 134 static const int kInvalidPosition = kMinInt; |
| 129 static const size_t kMaxOperands = 4; | 135 static const size_t kMaxOperands = 4; |
| 130 | 136 |
| 131 Bytecode bytecode_; | 137 Bytecode bytecode_; |
| 132 uint32_t operands_[kMaxOperands]; | 138 uint32_t operands_[kMaxOperands]; |
| 133 OperandScale operand_scale_; | 139 OperandScale operand_scale_; |
| 134 BytecodeSourceInfo source_info_; | 140 BytecodeSourceInfo source_info_; |
| 135 }; | 141 }; |
| 136 | 142 |
| 137 std::ostream& operator<<(std::ostream& os, const BytecodeSourceInfo& info); | 143 std::ostream& operator<<(std::ostream& os, const BytecodeSourceInfo& info); |
| 138 std::ostream& operator<<(std::ostream& os, const BytecodeNode& node); | 144 std::ostream& operator<<(std::ostream& os, const BytecodeNode& node); |
| 139 | 145 |
| 140 } // namespace interpreter | 146 } // namespace interpreter |
| 141 } // namespace internal | 147 } // namespace internal |
| 142 } // namespace v8 | 148 } // namespace v8 |
| 143 | 149 |
| 144 #endif // V8_INTERPRETER_BYTECODE_PIPELINE_H_ | 150 #endif // V8_INTERPRETER_BYTECODE_PIPELINE_H_ |
| OLD | NEW |