| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 int ref_counts_[kNumRegisters]; | 74 int ref_counts_[kNumRegisters]; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 | 77 |
| 78 // ------------------------------------------------------------------------- | 78 // ------------------------------------------------------------------------- |
| 79 // Register allocator | 79 // Register allocator |
| 80 // | 80 // |
| 81 | 81 |
| 82 class RegisterAllocator BASE_EMBEDDED { | 82 class RegisterAllocator BASE_EMBEDDED { |
| 83 public: | 83 public: |
| 84 RegisterAllocator(CodeGenerator* cgen) : code_generator_(cgen) {} | 84 explicit RegisterAllocator(CodeGenerator* cgen) : code_generator_(cgen) {} |
| 85 | 85 |
| 86 int num_registers() const { return RegisterFile::kNumRegisters; } | 86 int num_registers() const { return RegisterFile::kNumRegisters; } |
| 87 | 87 |
| 88 int count(int reg_code) { return registers_.count(reg_code); } | 88 int count(int reg_code) { return registers_.count(reg_code); } |
| 89 | 89 |
| 90 // Explicitly record a reference to a register. | 90 // Explicitly record a reference to a register. |
| 91 void Use(Register reg) { registers_.Use(reg); } | 91 void Use(Register reg) { registers_.Use(reg); } |
| 92 | 92 |
| 93 // Explicitly record that a register will no longer be used. | 93 // Explicitly record that a register will no longer be used. |
| 94 void Unuse(Register reg) { registers_.Unuse(reg); } | 94 void Unuse(Register reg) { registers_.Unuse(reg); } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 106 Register AllocateWithoutSpilling(); | 106 Register AllocateWithoutSpilling(); |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 CodeGenerator* code_generator_; | 109 CodeGenerator* code_generator_; |
| 110 RegisterFile registers_; | 110 RegisterFile registers_; |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } } // namespace v8::internal | 113 } } // namespace v8::internal |
| 114 | 114 |
| 115 #endif // V8_REGISTER_ALLOCATOR_IA32_H_ | 115 #endif // V8_REGISTER_ALLOCATOR_IA32_H_ |
| OLD | NEW |