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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 } | 206 } |
207 | 207 |
208 // Copy the reference counts from this register file to the other. | 208 // Copy the reference counts from this register file to the other. |
209 void CopyTo(RegisterFile* other) { | 209 void CopyTo(RegisterFile* other) { |
210 for (int i = 0; i < kNumRegisters; i++) { | 210 for (int i = 0; i < kNumRegisters; i++) { |
211 other->ref_counts_[i] = ref_counts_[i]; | 211 other->ref_counts_[i] = ref_counts_[i]; |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 private: | 215 private: |
216 static const int kNumRegisters = RegisterAllocatorConstants::kNumRegisters; | 216 // C++ doesn't like zero length arrays, so we make the array length 1 even if |
217 // we don't need it. | |
218 static const int kNumRegisters = | |
Søren Thygesen Gjesse
2010/04/07 10:46:51
4 space indent.
Erik Corry
2010/04/07 12:49:17
Done.
| |
219 (RegisterAllocatorConstants::kNumRegisters == 0 ? | |
Søren Thygesen Gjesse
2010/04/07 10:46:51
1 : RegisterAllocatorConstants::kNumRegisters on s
Erik Corry
2010/04/07 12:49:17
Done.
| |
220 1 : | |
221 RegisterAllocatorConstants::kNumRegisters); | |
217 | 222 |
218 int ref_counts_[kNumRegisters]; | 223 int ref_counts_[kNumRegisters]; |
219 | 224 |
220 // Very fast inlined loop to find a free register. Used in | 225 // Very fast inlined loop to find a free register. Used in |
221 // RegisterAllocator::AllocateWithoutSpilling. Returns | 226 // RegisterAllocator::AllocateWithoutSpilling. Returns |
222 // kInvalidRegister if no free register found. | 227 // kInvalidRegister if no free register found. |
223 int ScanForFreeRegister() { | 228 int ScanForFreeRegister() { |
224 for (int i = 0; i < RegisterAllocatorConstants::kNumRegisters; i++) { | 229 for (int i = 0; i < RegisterAllocatorConstants::kNumRegisters; i++) { |
225 if (!is_used(i)) return i; | 230 if (!is_used(i)) return i; |
226 } | 231 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 } | 312 } |
308 | 313 |
309 private: | 314 private: |
310 CodeGenerator* cgen_; | 315 CodeGenerator* cgen_; |
311 RegisterFile registers_; | 316 RegisterFile registers_; |
312 }; | 317 }; |
313 | 318 |
314 } } // namespace v8::internal | 319 } } // namespace v8::internal |
315 | 320 |
316 #endif // V8_REGISTER_ALLOCATOR_H_ | 321 #endif // V8_REGISTER_ALLOCATOR_H_ |
OLD | NEW |