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-allocator.h" | 5 #include "src/interpreter/bytecode-register-allocator.h" |
6 | 6 |
7 #include "src/interpreter/bytecode-array-builder.h" | 7 #include "src/interpreter/bytecode-array-builder.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 Register BytecodeRegisterAllocator::NextConsecutiveRegister() { | 217 Register BytecodeRegisterAllocator::NextConsecutiveRegister() { |
218 DCHECK_GE(next_consecutive_register_, 0); | 218 DCHECK_GE(next_consecutive_register_, 0); |
219 DCHECK_GT(next_consecutive_count_, 0); | 219 DCHECK_GT(next_consecutive_count_, 0); |
220 base_allocator()->BorrowConsecutiveTemporaryRegister( | 220 base_allocator()->BorrowConsecutiveTemporaryRegister( |
221 next_consecutive_register_); | 221 next_consecutive_register_); |
222 allocated_.push_back(next_consecutive_register_); | 222 allocated_.push_back(next_consecutive_register_); |
223 next_consecutive_count_--; | 223 next_consecutive_count_--; |
224 return Register(next_consecutive_register_++); | 224 return Register(next_consecutive_register_++); |
225 } | 225 } |
226 | 226 |
| 227 void BytecodeRegisterAllocator::PrepareAndInitializeConsecutiveAllocations( |
| 228 Register* registers, size_t count) { |
| 229 PrepareForConsecutiveAllocations(count); |
| 230 for (size_t i = 0; i < count; i++) { |
| 231 registers[i] = NextConsecutiveRegister(); |
| 232 } |
| 233 } |
| 234 |
227 } // namespace interpreter | 235 } // namespace interpreter |
228 } // namespace internal | 236 } // namespace internal |
229 } // namespace v8 | 237 } // namespace v8 |
OLD | NEW |