| 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 #include "src/interpreter/bytecode-register.h" | 5 #include "src/interpreter/bytecode-register.h" |
| 6 | 6 |
| 7 #include "src/frames.h" | |
| 8 | |
| 9 namespace v8 { | 7 namespace v8 { |
| 10 namespace internal { | 8 namespace internal { |
| 11 namespace interpreter { | 9 namespace interpreter { |
| 12 | 10 |
| 13 static const int kLastParamRegisterIndex = | 11 static const int kLastParamRegisterIndex = |
| 14 (InterpreterFrameConstants::kRegisterFileFromFp - | 12 (InterpreterFrameConstants::kRegisterFileFromFp - |
| 15 InterpreterFrameConstants::kLastParamFromFp) / | 13 InterpreterFrameConstants::kLastParamFromFp) / |
| 16 kPointerSize; | 14 kPointerSize; |
| 17 static const int kFunctionClosureRegisterIndex = | 15 static const int kFunctionClosureRegisterIndex = |
| 18 (InterpreterFrameConstants::kRegisterFileFromFp - | 16 (InterpreterFrameConstants::kRegisterFileFromFp - |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 kPointerSize; | 30 kPointerSize; |
| 33 static const int kBytecodeOffsetRegisterIndex = | 31 static const int kBytecodeOffsetRegisterIndex = |
| 34 (InterpreterFrameConstants::kRegisterFileFromFp - | 32 (InterpreterFrameConstants::kRegisterFileFromFp - |
| 35 InterpreterFrameConstants::kBytecodeOffsetFromFp) / | 33 InterpreterFrameConstants::kBytecodeOffsetFromFp) / |
| 36 kPointerSize; | 34 kPointerSize; |
| 37 static const int kCallerPCOffsetRegisterIndex = | 35 static const int kCallerPCOffsetRegisterIndex = |
| 38 (InterpreterFrameConstants::kRegisterFileFromFp - | 36 (InterpreterFrameConstants::kRegisterFileFromFp - |
| 39 InterpreterFrameConstants::kCallerPCOffsetFromFp) / | 37 InterpreterFrameConstants::kCallerPCOffsetFromFp) / |
| 40 kPointerSize; | 38 kPointerSize; |
| 41 | 39 |
| 42 STATIC_CONST_MEMBER_DEFINITION const int Register::kInvalidIndex = kMaxInt; | |
| 43 STATIC_CONST_MEMBER_DEFINITION const int Register::kRegisterFileStartOffset = | |
| 44 InterpreterFrameConstants::kRegisterFileFromFp / kPointerSize; | |
| 45 | |
| 46 Register Register::FromParameterIndex(int index, int parameter_count) { | 40 Register Register::FromParameterIndex(int index, int parameter_count) { |
| 47 DCHECK_GE(index, 0); | 41 DCHECK_GE(index, 0); |
| 48 DCHECK_LT(index, parameter_count); | 42 DCHECK_LT(index, parameter_count); |
| 49 int register_index = kLastParamRegisterIndex - parameter_count + index + 1; | 43 int register_index = kLastParamRegisterIndex - parameter_count + index + 1; |
| 50 DCHECK_LT(register_index, 0); | 44 DCHECK_LT(register_index, 0); |
| 51 return Register(register_index); | 45 return Register(register_index); |
| 52 } | 46 } |
| 53 | 47 |
| 54 int Register::ToParameterIndex(int parameter_count) const { | 48 int Register::ToParameterIndex(int parameter_count) const { |
| 55 DCHECK(is_parameter()); | 49 DCHECK(is_parameter()); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } else { | 140 } else { |
| 147 std::ostringstream s; | 141 std::ostringstream s; |
| 148 s << "r" << index(); | 142 s << "r" << index(); |
| 149 return s.str(); | 143 return s.str(); |
| 150 } | 144 } |
| 151 } | 145 } |
| 152 | 146 |
| 153 } // namespace interpreter | 147 } // namespace interpreter |
| 154 } // namespace internal | 148 } // namespace internal |
| 155 } // namespace v8 | 149 } // namespace v8 |
| OLD | NEW |