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_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // using result scopes as far as possible. | 309 // using result scopes as far as possible. |
310 class TemporaryRegisterScope { | 310 class TemporaryRegisterScope { |
311 public: | 311 public: |
312 explicit TemporaryRegisterScope(BytecodeArrayBuilder* builder); | 312 explicit TemporaryRegisterScope(BytecodeArrayBuilder* builder); |
313 ~TemporaryRegisterScope(); | 313 ~TemporaryRegisterScope(); |
314 Register NewRegister(); | 314 Register NewRegister(); |
315 | 315 |
316 void PrepareForConsecutiveAllocations(size_t count); | 316 void PrepareForConsecutiveAllocations(size_t count); |
317 Register NextConsecutiveRegister(); | 317 Register NextConsecutiveRegister(); |
318 | 318 |
| 319 bool RegisterIsAllocatedInThisScope(Register reg) const; |
| 320 |
319 private: | 321 private: |
320 void* operator new(size_t size); | 322 void* operator new(size_t size); |
321 void operator delete(void* p); | 323 void operator delete(void* p); |
322 | 324 |
323 BytecodeArrayBuilder* builder_; | 325 BytecodeArrayBuilder* builder_; |
324 const TemporaryRegisterScope* outer_; | 326 const TemporaryRegisterScope* outer_; |
325 ZoneVector<int> allocated_; | 327 ZoneVector<int> allocated_; |
326 int next_consecutive_register_; | 328 int next_consecutive_register_; |
327 int next_consecutive_count_; | 329 int next_consecutive_count_; |
328 | 330 |
329 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 331 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
330 }; | 332 }; |
331 | 333 |
332 | 334 |
333 } // namespace interpreter | 335 } // namespace interpreter |
334 } // namespace internal | 336 } // namespace internal |
335 } // namespace v8 | 337 } // namespace v8 |
336 | 338 |
337 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 339 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |