| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 class RegisterAllocator BASE_EMBEDDED { | 268 class RegisterAllocator BASE_EMBEDDED { |
| 269 public: | 269 public: |
| 270 explicit RegisterAllocator(CodeGenerator* cgen) : cgen_(cgen) {} | 270 explicit RegisterAllocator(CodeGenerator* cgen) : cgen_(cgen) {} |
| 271 | 271 |
| 272 // A register file with each of the reserved registers counted once. | 272 // A register file with each of the reserved registers counted once. |
| 273 static RegisterFile Reserved(); | 273 static RegisterFile Reserved(); |
| 274 | 274 |
| 275 // Unuse all the reserved registers in a register file. | 275 // Unuse all the reserved registers in a register file. |
| 276 static void UnuseReserved(RegisterFile* register_file); | 276 static void UnuseReserved(RegisterFile* register_file); |
| 277 | 277 |
| 278 // True if the register is reserved by the code generator, false if it |
| 279 // can be freely used by the allocator. |
| 280 static bool IsReserved(int reg_code); |
| 281 static bool IsReserved(Register reg) { return IsReserved(reg); } |
| 282 |
| 278 // Predicates and accessors for the registers' reference counts. | 283 // Predicates and accessors for the registers' reference counts. |
| 279 bool is_used(int reg_code) const { return registers_.is_used(reg_code); } | 284 bool is_used(int reg_code) const { return registers_.is_used(reg_code); } |
| 280 bool is_used(Register reg) const { return registers_.is_used(reg.code()); } | 285 bool is_used(Register reg) const { return registers_.is_used(reg.code()); } |
| 281 int count(int reg_code) const { return registers_.count(reg_code); } | 286 int count(int reg_code) const { return registers_.count(reg_code); } |
| 282 int count(Register reg) const { return registers_.count(reg.code()); } | 287 int count(Register reg) const { return registers_.count(reg.code()); } |
| 283 | 288 |
| 284 // Explicitly record a reference to a register. | 289 // Explicitly record a reference to a register. |
| 285 void Use(Register reg) { registers_.Use(reg); } | 290 void Use(Register reg) { registers_.Use(reg); } |
| 286 | 291 |
| 287 // Explicitly record that a register will no longer be used. | 292 // Explicitly record that a register will no longer be used. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 329 } |
| 325 | 330 |
| 326 private: | 331 private: |
| 327 CodeGenerator* cgen_; | 332 CodeGenerator* cgen_; |
| 328 RegisterFile registers_; | 333 RegisterFile registers_; |
| 329 }; | 334 }; |
| 330 | 335 |
| 331 } } // namespace v8::internal | 336 } } // namespace v8::internal |
| 332 | 337 |
| 333 #endif // V8_REGISTER_ALLOCATOR_H_ | 338 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |