| 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" |
| 11 #include "src/globals.h" |
| 11 | 12 |
| 12 namespace v8 { | 13 namespace v8 { |
| 13 namespace internal { | 14 namespace internal { |
| 14 namespace interpreter { | 15 namespace interpreter { |
| 15 | 16 |
| 16 // An interpreter Register which is located in the function's Register file | 17 // An interpreter Register which is located in the function's Register file |
| 17 // in its stack-frame. Register hold parameters, this, and expression values. | 18 // in its stack-frame. Register hold parameters, this, and expression values. |
| 18 class Register final { | 19 class V8_EXPORT_PRIVATE Register final { |
| 19 public: | 20 public: |
| 20 explicit Register(int index = kInvalidIndex) : index_(index) {} | 21 explicit Register(int index = kInvalidIndex) : index_(index) {} |
| 21 | 22 |
| 22 int index() const { return index_; } | 23 int index() const { return index_; } |
| 23 bool is_parameter() const { return index() < 0; } | 24 bool is_parameter() const { return index() < 0; } |
| 24 bool is_valid() const { return index_ != kInvalidIndex; } | 25 bool is_valid() const { return index_ != kInvalidIndex; } |
| 25 | 26 |
| 26 static Register FromParameterIndex(int index, int parameter_count); | 27 static Register FromParameterIndex(int index, int parameter_count); |
| 27 int ToParameterIndex(int parameter_count) const; | 28 int ToParameterIndex(int parameter_count) const; |
| 28 | 29 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 private: | 131 private: |
| 131 int first_reg_index_; | 132 int first_reg_index_; |
| 132 int register_count_; | 133 int register_count_; |
| 133 }; | 134 }; |
| 134 | 135 |
| 135 } // namespace interpreter | 136 } // namespace interpreter |
| 136 } // namespace internal | 137 } // namespace internal |
| 137 } // namespace v8 | 138 } // namespace v8 |
| 138 | 139 |
| 139 #endif // V8_INTERPRETER_BYTECODE_REGISTER_H_ | 140 #endif // V8_INTERPRETER_BYTECODE_REGISTER_H_ |
| OLD | NEW |