| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 | 168 |
| 169 // ------------------------------------------------------------------------- | 169 // ------------------------------------------------------------------------- |
| 170 // Register allocator | 170 // Register allocator |
| 171 // | 171 // |
| 172 | 172 |
| 173 class RegisterAllocator BASE_EMBEDDED { | 173 class RegisterAllocator BASE_EMBEDDED { |
| 174 public: | 174 public: |
| 175 explicit RegisterAllocator(CodeGenerator* cgen) : cgen_(cgen) {} | 175 explicit RegisterAllocator(CodeGenerator* cgen) : cgen_(cgen) {} |
| 176 | 176 |
| 177 static RegisterFile Reserved() { |
| 178 RegisterFile reserved; |
| 179 reserved.Use(esi); |
| 180 reserved.Use(ebp); |
| 181 reserved.Use(esp); |
| 182 return reserved; |
| 183 } |
| 184 |
| 177 int num_registers() const { return RegisterFile::kNumRegisters; } | 185 int num_registers() const { return RegisterFile::kNumRegisters; } |
| 178 | 186 |
| 179 // Predicates and accessors for the registers' reference counts. | 187 // Predicates and accessors for the registers' reference counts. |
| 180 bool is_used(int reg_code) const { return registers_.is_used(reg_code); } | 188 bool is_used(int reg_code) const { return registers_.is_used(reg_code); } |
| 181 bool is_used(Register reg) const { return registers_.is_used(reg.code()); } | 189 bool is_used(Register reg) const { return registers_.is_used(reg.code()); } |
| 182 int count(int reg_code) const { return registers_.count(reg_code); } | 190 int count(int reg_code) const { return registers_.count(reg_code); } |
| 183 int count(Register reg) const { return registers_.count(reg.code()); } | 191 int count(Register reg) const { return registers_.count(reg.code()); } |
| 184 | 192 |
| 185 // Explicitly record a reference to a register. | 193 // Explicitly record a reference to a register. |
| 186 void Use(Register reg) { registers_.Use(reg); } | 194 void Use(Register reg) { registers_.Use(reg); } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 233 } |
| 226 | 234 |
| 227 private: | 235 private: |
| 228 CodeGenerator* cgen_; | 236 CodeGenerator* cgen_; |
| 229 RegisterFile registers_; | 237 RegisterFile registers_; |
| 230 }; | 238 }; |
| 231 | 239 |
| 232 } } // namespace v8::internal | 240 } } // namespace v8::internal |
| 233 | 241 |
| 234 #endif // V8_REGISTER_ALLOCATOR_IA32_H_ | 242 #endif // V8_REGISTER_ALLOCATOR_IA32_H_ |
| OLD | NEW |