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 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 if (reg4.is_valid() && reg3.index() + 1 != reg4.index()) { | 115 if (reg4.is_valid() && reg3.index() + 1 != reg4.index()) { |
116 return false; | 116 return false; |
117 } | 117 } |
118 if (reg5.is_valid() && reg4.index() + 1 != reg5.index()) { | 118 if (reg5.is_valid() && reg4.index() + 1 != reg5.index()) { |
119 return false; | 119 return false; |
120 } | 120 } |
121 return true; | 121 return true; |
122 } | 122 } |
123 | 123 |
124 std::string Register::ToString(int parameter_count) { | 124 std::string Register::ToString(int parameter_count) const { |
125 if (is_current_context()) { | 125 if (is_current_context()) { |
126 return std::string("<context>"); | 126 return std::string("<context>"); |
127 } else if (is_function_closure()) { | 127 } else if (is_function_closure()) { |
128 return std::string("<closure>"); | 128 return std::string("<closure>"); |
129 } else if (is_new_target()) { | 129 } else if (is_new_target()) { |
130 return std::string("<new.target>"); | 130 return std::string("<new.target>"); |
131 } else if (is_parameter()) { | 131 } else if (is_parameter()) { |
132 int parameter_index = ToParameterIndex(parameter_count); | 132 int parameter_index = ToParameterIndex(parameter_count); |
133 if (parameter_index == 0) { | 133 if (parameter_index == 0) { |
134 return std::string("<this>"); | 134 return std::string("<this>"); |
135 } else { | 135 } else { |
136 std::ostringstream s; | 136 std::ostringstream s; |
137 s << "a" << parameter_index - 1; | 137 s << "a" << parameter_index - 1; |
138 return s.str(); | 138 return s.str(); |
139 } | 139 } |
140 } else { | 140 } else { |
141 std::ostringstream s; | 141 std::ostringstream s; |
142 s << "r" << index(); | 142 s << "r" << index(); |
143 return s.str(); | 143 return s.str(); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 } // namespace interpreter | 147 } // namespace interpreter |
148 } // namespace internal | 148 } // namespace internal |
149 } // namespace v8 | 149 } // namespace v8 |
OLD | NEW |