| Index: src/register-allocator-ia32.h
|
| ===================================================================
|
| --- src/register-allocator-ia32.h (revision 969)
|
| +++ src/register-allocator-ia32.h (working copy)
|
| @@ -68,6 +68,14 @@
|
| }
|
| }
|
|
|
| + // Copy the reference counts from this register file to the other.
|
| + void CopyTo(RegisterFile* other);
|
| +
|
| +#ifdef DEBUG
|
| + // True if the reference counts all match the other register file.
|
| + bool Equals(RegisterFile* other);
|
| +#endif
|
| +
|
| static const int kNumRegisters = 8;
|
|
|
| private:
|
| @@ -81,7 +89,7 @@
|
|
|
| class RegisterAllocator BASE_EMBEDDED {
|
| public:
|
| - RegisterAllocator(CodeGenerator* cgen) : code_generator_(cgen) {}
|
| + explicit RegisterAllocator(CodeGenerator* cgen) : code_generator_(cgen) {}
|
|
|
| int num_registers() const { return RegisterFile::kNumRegisters; }
|
|
|
| @@ -105,6 +113,24 @@
|
| // no_reg.
|
| Register AllocateWithoutSpilling();
|
|
|
| + // Copy the internal state to a register file, to be restored later
|
| + // by RestoreFrom.
|
| + void SaveTo(RegisterFile* register_file) {
|
| + registers_.CopyTo(register_file);
|
| + }
|
| +
|
| + void RestoreFrom(RegisterFile* register_file) {
|
| + register_file->CopyTo(®isters_);
|
| + }
|
| +
|
| +#ifdef DEBUG
|
| + // True if the reference counts of this allocator match those saved in the
|
| + // given register file.
|
| + bool Matches(RegisterFile* register_file) {
|
| + return registers_.Equals(register_file);
|
| + }
|
| +#endif
|
| +
|
| private:
|
| CodeGenerator* code_generator_;
|
| RegisterFile registers_;
|
|
|