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_ALLOCATOR_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_ |
6 #define V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_ | 6 #define V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_ |
7 | 7 |
8 #include "src/interpreter/bytecodes.h" | 8 #include "src/interpreter/bytecodes.h" |
9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 ~BytecodeRegisterAllocator(); | 74 ~BytecodeRegisterAllocator(); |
75 Register NewRegister(); | 75 Register NewRegister(); |
76 | 76 |
77 // Ensure |count| consecutive allocations are available. | 77 // Ensure |count| consecutive allocations are available. |
78 void PrepareForConsecutiveAllocations(size_t count); | 78 void PrepareForConsecutiveAllocations(size_t count); |
79 | 79 |
80 // Get the next consecutive allocation after calling | 80 // Get the next consecutive allocation after calling |
81 // PrepareForConsecutiveAllocations. | 81 // PrepareForConsecutiveAllocations. |
82 Register NextConsecutiveRegister(); | 82 Register NextConsecutiveRegister(); |
83 | 83 |
84 // Prepare consecutive register allocations and initialize an array | |
85 // of registers with the allocations. | |
86 void PrepareAndInitializeConsecutiveAllocations(Register* registers, | |
87 size_t count); | |
88 | |
89 // Returns true if |reg| is allocated in this allocator. | 84 // Returns true if |reg| is allocated in this allocator. |
90 bool RegisterIsAllocatedInThisScope(Register reg) const; | 85 bool RegisterIsAllocatedInThisScope(Register reg) const; |
91 | 86 |
92 // Returns true if unused consecutive allocations remain. | 87 // Returns true if unused consecutive allocations remain. |
93 bool HasConsecutiveAllocations() const { return next_consecutive_count_ > 0; } | 88 bool HasConsecutiveAllocations() const { return next_consecutive_count_ > 0; } |
94 | 89 |
95 private: | 90 private: |
96 TemporaryRegisterAllocator* base_allocator() const { return base_allocator_; } | 91 TemporaryRegisterAllocator* base_allocator() const { return base_allocator_; } |
97 | 92 |
98 TemporaryRegisterAllocator* base_allocator_; | 93 TemporaryRegisterAllocator* base_allocator_; |
99 ZoneVector<int> allocated_; | 94 ZoneVector<int> allocated_; |
100 int next_consecutive_register_; | 95 int next_consecutive_register_; |
101 int next_consecutive_count_; | 96 int next_consecutive_count_; |
102 | 97 |
103 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterAllocator); | 98 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterAllocator); |
104 }; | 99 }; |
105 | 100 |
106 } // namespace interpreter | 101 } // namespace interpreter |
107 } // namespace internal | 102 } // namespace internal |
108 } // namespace v8 | 103 } // namespace v8 |
109 | 104 |
110 | 105 |
111 #endif // V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_ | 106 #endif // V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_ |
OLD | NEW |