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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Allocate a temporary register. | 58 // Allocate a temporary register. |
59 int AllocateTemporaryRegister(); | 59 int AllocateTemporaryRegister(); |
60 | 60 |
61 ZoneSet<int> free_temporaries_; | 61 ZoneSet<int> free_temporaries_; |
62 int allocation_base_; | 62 int allocation_base_; |
63 int allocation_count_; | 63 int allocation_count_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterAllocator); | 65 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterAllocator); |
66 }; | 66 }; |
67 | 67 |
68 // A class than allows the instantiator to allocate temporary registers that are | 68 // A class that allows the instantiator to allocate temporary registers that are |
69 // cleaned up when scope is closed. | 69 // cleaned up when scope is closed. |
70 class BytecodeRegisterAllocator final { | 70 class BytecodeRegisterAllocator final { |
71 public: | 71 public: |
72 explicit BytecodeRegisterAllocator(Zone* zone, | 72 explicit BytecodeRegisterAllocator(Zone* zone, |
73 TemporaryRegisterAllocator* allocator); | 73 TemporaryRegisterAllocator* allocator); |
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); |
(...skipping 18 matching lines...) Expand all Loading... |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterAllocator); | 98 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterAllocator); |
99 }; | 99 }; |
100 | 100 |
101 } // namespace interpreter | 101 } // namespace interpreter |
102 } // namespace internal | 102 } // namespace internal |
103 } // namespace v8 | 103 } // namespace v8 |
104 | 104 |
105 | 105 |
106 #endif // V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_ | 106 #endif // V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_ |
OLD | NEW |