| 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_REGISTER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_REGISTER_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_REGISTER_H_ | 6 #define V8_INTERPRETER_BYTECODE_REGISTER_H_ |
| 7 | 7 |
| 8 #include "src/interpreter/bytecodes.h" | 8 #include "src/interpreter/bytecodes.h" |
| 9 | 9 |
| 10 #include "src/frames.h" | 10 #include "src/frames.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 int index_; | 99 int index_; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 class RegisterList { | 102 class RegisterList { |
| 103 public: | 103 public: |
| 104 RegisterList() : first_reg_index_(Register().index()), register_count_(0) {} | 104 RegisterList() : first_reg_index_(Register().index()), register_count_(0) {} |
| 105 RegisterList(int first_reg_index, int register_count) | 105 RegisterList(int first_reg_index, int register_count) |
| 106 : first_reg_index_(first_reg_index), register_count_(register_count) {} | 106 : first_reg_index_(first_reg_index), register_count_(register_count) {} |
| 107 | 107 |
| 108 // Increases the size of the register list by one. |
| 109 void IncrementRegisterCount() { register_count_++; } |
| 110 |
| 108 // Returns a new RegisterList which is a truncated version of this list, with | 111 // Returns a new RegisterList which is a truncated version of this list, with |
| 109 // |count| registers. | 112 // |count| registers. |
| 110 const RegisterList Truncate(int new_count) { | 113 const RegisterList Truncate(int new_count) { |
| 111 DCHECK_GE(new_count, 0); | 114 DCHECK_GE(new_count, 0); |
| 112 DCHECK_LT(new_count, register_count_); | 115 DCHECK_LT(new_count, register_count_); |
| 113 return RegisterList(first_reg_index_, new_count); | 116 return RegisterList(first_reg_index_, new_count); |
| 114 } | 117 } |
| 115 | 118 |
| 116 const Register operator[](size_t i) const { | 119 const Register operator[](size_t i) const { |
| 117 DCHECK_LT(static_cast<int>(i), register_count_); | 120 DCHECK_LT(static_cast<int>(i), register_count_); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 131 private: | 134 private: |
| 132 int first_reg_index_; | 135 int first_reg_index_; |
| 133 int register_count_; | 136 int register_count_; |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 } // namespace interpreter | 139 } // namespace interpreter |
| 137 } // namespace internal | 140 } // namespace internal |
| 138 } // namespace v8 | 141 } // namespace v8 |
| 139 | 142 |
| 140 #endif // V8_INTERPRETER_BYTECODE_REGISTER_H_ | 143 #endif // V8_INTERPRETER_BYTECODE_REGISTER_H_ |
| OLD | NEW |