| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 // Record that a register will no longer be used by decrementing its | 237 // Record that a register will no longer be used by decrementing its |
| 238 // reference count. | 238 // reference count. |
| 239 void Unuse(Register reg) { | 239 void Unuse(Register reg) { |
| 240 ASSERT(!reg.is(no_reg)); | 240 ASSERT(!reg.is(no_reg)); |
| 241 ASSERT(is_used(reg.code())); | 241 ASSERT(is_used(reg.code())); |
| 242 ref_counts_[reg.code()]--; | 242 ref_counts_[reg.code()]--; |
| 243 } | 243 } |
| 244 | 244 |
| 245 // Copy the reference counts from this register file to the other. | 245 // Copy the reference counts from this register file to the other. |
| 246 void CopyTo(RegisterFile* other); | 246 void CopyTo(RegisterFile* other) { |
| 247 for (int i = 0; i < kNumRegisters; i++) { |
| 248 other->ref_counts_[i] = ref_counts_[i]; |
| 249 } |
| 250 } |
| 247 | 251 |
| 248 private: | 252 private: |
| 249 int ref_counts_[kNumRegisters]; | 253 int ref_counts_[kNumRegisters]; |
| 250 | 254 |
| 251 // Very fast inlined loop to find a free register. | 255 // Very fast inlined loop to find a free register. |
| 252 // Used in RegisterAllocator::AllocateWithoutSpilling. | 256 // Used in RegisterAllocator::AllocateWithoutSpilling. |
| 253 // Returns kNumRegisters if no free register found. | 257 // Returns kNumRegisters if no free register found. |
| 254 inline int ScanForFreeRegister() { | 258 inline int ScanForFreeRegister() { |
| 255 int i = 0; | 259 int i = 0; |
| 256 for (; i < kNumRegisters ; ++i) { | 260 for (; i < kNumRegisters ; ++i) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 335 } |
| 332 | 336 |
| 333 private: | 337 private: |
| 334 CodeGenerator* cgen_; | 338 CodeGenerator* cgen_; |
| 335 RegisterFile registers_; | 339 RegisterFile registers_; |
| 336 }; | 340 }; |
| 337 | 341 |
| 338 } } // namespace v8::internal | 342 } } // namespace v8::internal |
| 339 | 343 |
| 340 #endif // V8_REGISTER_ALLOCATOR_H_ | 344 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |